我正在使用the TTS library from Google。我在Python中的代码与their sample code几乎相同。但是我无法在启用WaveNet语音的情况下致电他们的服务(我的目标是非英语,但也显示为WaveNet语音支持)。我的假设是它将基于此param.,但我看不到它在任何地方的用途。
最佳答案
想办法:
# Build the voice request, select the language code ("en-US") and the ssml
# voice gender ("neutral")
voice = texttospeech.types.VoiceSelectionParams(
language_code='cs-CZ',
name="cs-CZ-Wavenet-A",
ssml_gender=texttospeech.enums.SsmlVoiceGender.FEMALE)
# Select the type of audio file you want returned
audio_config = texttospeech.types.AudioConfig(
audio_encoding=texttospeech.enums.AudioEncoding.MP3,
pitch=0)
# Perform the text-to-speech request on the text input with the selected
# voice parameters and audio file type
response = client.synthesize_speech(synthesis_input, voice, audio_config)
在here的JSON示例中可以找到名称param。例如,在捷克语中为cs-CZ-Wavenet-A和“ cs-CZ-Standard-A”。
关于python - 如何使用python调用Google TTS Wavenet语音,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56873111/