gpt4 book ai didi

python - 如何使用python调用google TTS Wavenet语音

转载 作者:行者123 更新时间:2023-12-01 07:38:12 37 4
gpt4 key购买 nike

我正在使用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 示例中找到。例如,在捷克语中,它是 cs-CZ-Wavenet-A“cs-CZ-Standard-A”

关于python - 如何使用python调用google TTS Wavenet语音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56873111/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com