mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Do not set gender if voice name is specified in Google Cloud TTS (#120848)
* Use TextToSpeechAsyncClient in Google Cloud TTS * Do not set gender if voice name is specified in Google Cloud TTS
This commit is contained in:
parent
75e3afd369
commit
bf608691d5
@ -262,15 +262,18 @@ class GoogleCloudTTSProvider(Provider):
|
||||
options = options_schema(options)
|
||||
|
||||
encoding = options[CONF_ENCODING]
|
||||
gender = texttospeech.SsmlVoiceGender[options[CONF_GENDER]]
|
||||
voice = options[CONF_VOICE]
|
||||
if voice and not voice.startswith(language):
|
||||
language = voice[:5]
|
||||
if voice:
|
||||
gender = None
|
||||
if not voice.startswith(language):
|
||||
language = voice[:5]
|
||||
|
||||
request = texttospeech.SynthesizeSpeechRequest(
|
||||
input=texttospeech.SynthesisInput(**{options[CONF_TEXT_TYPE]: message}),
|
||||
voice=texttospeech.VoiceSelectionParams(
|
||||
language_code=language,
|
||||
ssml_gender=texttospeech.SsmlVoiceGender[options[CONF_GENDER]],
|
||||
ssml_gender=gender,
|
||||
name=voice,
|
||||
),
|
||||
audio_config=texttospeech.AudioConfig(
|
||||
|
Loading…
x
Reference in New Issue
Block a user