Google cloud platform ';en-GB-Wavenet-C';不';t工作[谷歌云文本到语音]
我是一个编码初学者。 我正在使用的一个小程序上使用用于Python的GoogleCloud文本到语音API。该功能正在工作,我得到的合成语音结果,但MP3文件是不同于我需要的。我选择了“en-GB-Wavenet-C”(英国口音的女声)作为语言代码,但MP3文件听起来像是美国口音的男声 我访问了云文本到语音API网站()并尝试了“说出来”演示。我试过“en-GB-Wavenet-C”,它听起来像英国口音的女声 我想知道适当的代码,以便获得“en-GB-Wavenet-C”语音结果 我使用Windows Subsystem for Linux中的Debian 9.3 我使用谷歌云SDK 210.0.0 先谢谢你 真诚地, 卡祖 这是我的代码:Google cloud platform ';en-GB-Wavenet-C';不';t工作[谷歌云文本到语音],google-cloud-platform,text-to-speech,google-cloud-speech,google-text-to-speech,Google Cloud Platform,Text To Speech,Google Cloud Speech,Google Text To Speech,我是一个编码初学者。 我正在使用的一个小程序上使用用于Python的GoogleCloud文本到语音API。该功能正在工作,我得到的合成语音结果,但MP3文件是不同于我需要的。我选择了“en-GB-Wavenet-C”(英国口音的女声)作为语言代码,但MP3文件听起来像是美国口音的男声 我访问了云文本到语音API网站()并尝试了“说出来”演示。我试过“en-GB-Wavenet-C”,它听起来像英国口音的女声 我想知道适当的代码,以便获得“en-GB-Wavenet-C”语音结果 我使用Wind
#!/usr/bin/env python
from google.cloud import texttospeech
client = texttospeech.TextToSpeechClient()
with open('resources/hello.ssml', 'r') as f:
ssml = f.read()
input_text = texttospeech.types.SynthesisInput(ssml=ssml)
# Note: the voice can also be specified by name.
# Names of voices can be retrieved with client.list_voices().
voice = texttospeech.types.VoiceSelectionParams(language_code='en-GB-Wavenet-C')
audio_config = texttospeech.types.AudioConfig(
audio_encoding=texttospeech.enums.AudioEncoding.MP3)
response = client.synthesize_speech(input_text, voice, audio_config)
# The response's audio_content is binary.
with open('output.mp3', 'wb') as out:
out.write(response.audio_content)
print('Audio content written to file "output.mp3"')
# [END tts_synthesize_ssml_file]
应该是
voice = texttospeech.types.VoiceSelectionParams(language_code='en-GB', name="en-GB-Wavenet-C")
非常感谢您的快速帮助。我试过你的建议。然而,这并没有解决我的问题。出现此错误消息。回溯(最后一次调用):文件“synthe_File_GB.py”,第17行,响应=client。合成语音(输入文本、语音、音频配置)文件“/mnt/c/gcp/voice/.venv/local/lib/python2.7/site packages/google/cloud/texttospeech v1/gapic/text_to_speech_client.py”,第257行,合成语音请求,retry=retry,timeout=timeout,metadata=metadata)文件“/mnt/c/gcp/voice/.venv/local/lib/python2.7/site packages/google/api_core/gapic_v1/method.py”,第143行,在call return wrapped_func(*args,**kwargs)文件“/mnt/c/gcp/voice/.venv/local/lib/python2.7/site packages/google/api_core/retry.py”,第270行,在retry_wrapped_func on_error=on_error中,文件“/mnt/c/gcp/voice/.venv/local/lib/python2.7/site packages/google/api_core/retry.py”,第179行,在retry_target return target()文件“/mnt/c/gcp/voice/.venv/local/lib/python2.7/site packages/google/api_core/timeout.py”中,第214行,在带有超时返回func(*args,**kwargs)文件的函数中“/mnt/c/gcp/voice/.venv/local/lib/python2.7/site packages/google/api_core/grpc_helpers.py”,第59行,在错误中重新映射了可调用的六个。从(异常。从grpc_error(exc),exc)文件/mnt/c/gcp/voice/.venv/local/lib/python2.7/site-packages/six.py“,第737行,从提升值google.api_core.exceptions.InvalidArgument:400无法找到TTS服务器来处理应用程序id:“cloud TTS”和触发器应用程序id:”和语音请求:语言:“en gb”名称:“cloud-Wavenet-C”云您能帮助我吗?
voice = texttospeech.types.VoiceSelectionParams(language_code='en-GB', name="en-GB-Wavenet-C")