mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Microsoft TTS: Add support for gender and type (#78848)
* Add support for gender and type * Reformat code
This commit is contained in:
parent
df47fda2a0
commit
772581dd28
@ -166,6 +166,16 @@ class MicrosoftProvider(Provider):
|
||||
"""Return list of supported languages."""
|
||||
return SUPPORTED_LANGUAGES
|
||||
|
||||
@property
|
||||
def supported_options(self):
|
||||
"""Return list of supported options like voice, emotion."""
|
||||
return [CONF_GENDER, CONF_TYPE]
|
||||
|
||||
@property
|
||||
def default_options(self):
|
||||
"""Return a dict include default options."""
|
||||
return {CONF_GENDER: self._gender, CONF_TYPE: self._type}
|
||||
|
||||
def get_tts_audio(self, message, language, options=None):
|
||||
"""Load TTS from Microsoft."""
|
||||
if language is None:
|
||||
@ -175,8 +185,8 @@ class MicrosoftProvider(Provider):
|
||||
trans = pycsspeechtts.TTSTranslator(self._apikey, self._region)
|
||||
data = trans.speak(
|
||||
language=language,
|
||||
gender=self._gender,
|
||||
voiceType=self._type,
|
||||
gender=options[CONF_GENDER],
|
||||
voiceType=options[CONF_TYPE],
|
||||
output=self._output,
|
||||
rate=self._rate,
|
||||
volume=self._volume,
|
||||
|
Loading…
x
Reference in New Issue
Block a user