diff --git a/.env.template b/.env.template index 525cd61c5f..f9a74c9ca4 100644 --- a/.env.template +++ b/.env.template @@ -11,4 +11,5 @@ OPENAI_API_BASE=your-base-url-for-azure OPENAI_API_VERSION=api-version-for-azure OPENAI_DEPLOYMENT_ID=deployment-id-for-azure IMAGE_PROVIDER=dalle -HUGGINGFACE_API_TOKEN= \ No newline at end of file +HUGGINGFACE_API_TOKEN= +USE_MAC_OS_TTS=False diff --git a/scripts/config.py b/scripts/config.py index 1eb74b2bc7..ef11aa9663 100644 --- a/scripts/config.py +++ b/scripts/config.py @@ -55,6 +55,9 @@ class Config(metaclass=Singleton): self.elevenlabs_api_key = os.getenv("ELEVENLABS_API_KEY") + self.use_mac_os_tts = False + self.use_mac_os_tts = os.getenv("USE_MAC_OS_TTS") + self.google_api_key = os.getenv("GOOGLE_API_KEY") self.custom_search_engine_id = os.getenv("CUSTOM_SEARCH_ENGINE_ID") diff --git a/scripts/speak.py b/scripts/speak.py index 10dd7c07f4..5d1e153c26 100644 --- a/scripts/speak.py +++ b/scripts/speak.py @@ -39,9 +39,15 @@ def gtts_speech(text): playsound("speech.mp3") os.remove("speech.mp3") +def macos_tts_speech(text): + os.system(f'say "{text}"') + def say_text(text, voice_index=0): if not cfg.elevenlabs_api_key: - gtts_speech(text) + if cfg.use_mac_os_tts == 'True': + macos_tts_speech(text) + else: + gtts_speech(text) else: success = eleven_labs_speech(text, voice_index) if not success: