diff options
Diffstat (limited to 'autogpts/autogpt/autogpt/speech/macos_tts.py')
-rw-r--r-- | autogpts/autogpt/autogpt/speech/macos_tts.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/autogpts/autogpt/autogpt/speech/macos_tts.py b/autogpts/autogpt/autogpt/speech/macos_tts.py new file mode 100644 index 000000000..e88331d21 --- /dev/null +++ b/autogpts/autogpt/autogpt/speech/macos_tts.py @@ -0,0 +1,23 @@ +""" MacOS TTS Voice. """ +from __future__ import annotations + +import os + +from autogpt.speech.base import VoiceBase + + +class MacOSTTS(VoiceBase): + """MacOS TTS Voice.""" + + def _setup(self) -> None: + pass + + def _speech(self, text: str, voice_index: int = 0) -> bool: + """Play the given text.""" + if voice_index == 0: + os.system(f'say "{text}"') + elif voice_index == 1: + os.system(f'say -v "Ava (Premium)" "{text}"') + else: + os.system(f'say -v Samantha "{text}"') + return True |