mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +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 list of supported languages."""
|
||||||
return 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):
|
def get_tts_audio(self, message, language, options=None):
|
||||||
"""Load TTS from Microsoft."""
|
"""Load TTS from Microsoft."""
|
||||||
if language is None:
|
if language is None:
|
||||||
@ -175,8 +185,8 @@ class MicrosoftProvider(Provider):
|
|||||||
trans = pycsspeechtts.TTSTranslator(self._apikey, self._region)
|
trans = pycsspeechtts.TTSTranslator(self._apikey, self._region)
|
||||||
data = trans.speak(
|
data = trans.speak(
|
||||||
language=language,
|
language=language,
|
||||||
gender=self._gender,
|
gender=options[CONF_GENDER],
|
||||||
voiceType=self._type,
|
voiceType=options[CONF_TYPE],
|
||||||
output=self._output,
|
output=self._output,
|
||||||
rate=self._rate,
|
rate=self._rate,
|
||||||
volume=self._volume,
|
volume=self._volume,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user