Add support for gender and google_style inputs to Google TTS

This commit is contained in:
Mark Backman
2024-09-30 15:47:41 -04:00
parent 8aae4e9856
commit a397b859fe
3 changed files with 11 additions and 1 deletions

View File

@@ -558,6 +558,8 @@ class TTSUpdateSettingsFrame(ControlFrame):
style: Optional[str] = None
style_degree: Optional[str] = None
role: Optional[str] = None
gender: Optional[str] = None
google_style: Optional[str] = None
@dataclass

View File

@@ -235,6 +235,14 @@ class TTSService(AIService):
async def flush_audio(self):
pass
@abstractmethod
async def set_gender(self, gender: str):
pass
@abstractmethod
async def set_google_style(self, google_style: str):
pass
# Converts the text to audio.
@abstractmethod
async def run_tts(self, text: str) -> AsyncGenerator[Frame, None]:

View File

@@ -272,7 +272,7 @@ class GoogleTTSService(TTSService):
logger.debug(f"Switch TTS gender to [{gender}]")
self._params.gender = gender
async def google_style(
async def set_google_style(
self, google_style: Literal["apologetic", "calm", "empathetic", "firm", "lively"]
) -> None:
logger.debug(f"Switching TTS google style to: [{google_style}]")