我正在使用the TTS library from Google。我在Python中的代码与their sample code几乎相同。但是我无法在启用WaveNet语音的情况下致电他们的服务(我的目标是非英语,但也显示为WaveNet语音支持)。我的假设是它将基于此param.,但我看不到它在任何地方的用途。
答案 0 :(得分:1)
弄清楚:
# 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示例中可以找到 name参数。例如,在捷克语中,它是 cs-CZ-Wavenet-A 和“ cs-CZ-Standard-A” 。