diff --git a/majordom_va/IO/GCloudSpeechSynthesizer.py b/majordom_va/IO/GCloudSpeechSynthesizer.py index e5bba10..f2fc947 100644 --- a/majordom_va/IO/GCloudSpeechSynthesizer.py +++ b/majordom_va/IO/GCloudSpeechSynthesizer.py @@ -24,7 +24,7 @@ def stop(self): class GCloudSpeechSynthesizer(SpeechSynthesizer): - def __init__(self, name = 'ru-RU-Wavenet-B', language_code = config.language_code): + def __init__(self, name = config.voice_name, language_code = config.language_code): os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = config.goole_tts_json_key self._client = texttospeech.TextToSpeechClient() self._audio_config = texttospeech.AudioConfig(audio_encoding = texttospeech.AudioEncoding.LINEAR16) @@ -37,8 +37,8 @@ def __init__(self, name = 'ru-RU-Wavenet-B', language_code = config.language_cod ) def synthesize(self, text) -> Speech: - dir = f'audio/{self._name}' - path = f'{dir}/{self._transliterate(text)[:100]}.wav' + folder = f'audio/{self._name}' + path = f'{folder}/{self._transliterate(text)[:100]}.wav' if os.path.exists(path): return Speech(text, self._name, path) @@ -47,8 +47,8 @@ def synthesize(self, text) -> Speech: try: response = self._client.synthesize_speech(input = synthesis_input, voice = self._voice, audio_config = self._audio_config) - if not os.path.exists(dir): - os.makedirs(dir) + if not os.path.exists(folder): + os.makedirs(folder) with open(path, 'wb') as out: out.write(response.audio_content) except Exception as e: diff --git a/majordom_va/config.py b/majordom_va/config.py index b2ee3dd..9a276e0 100644 --- a/majordom_va/config.py +++ b/majordom_va/config.py @@ -5,6 +5,11 @@ # Google Cloud TTS goole_tts_json_key: str = 'downloads/gc-tts-key.json' language_code: str = 'ru-RU' +voice_name: str = 'ru-RU-Wavenet-B' # Silero TTS -silero_model_url: str = 'https://models.silero.ai/models/tts/ru/ru_v3.pt' \ No newline at end of file +silero_model_url: str = 'https://models.silero.ai/models/tts/ru/ru_v3.pt' + +# Picovoice Porcupine (Wakeword) +porcupine_key: str = '' +porcupine_keyword_path: str = 'downloads/porcupine-keywords.txt'