From fb6fa54fd8b69b7ce7dfddaa9e9fb9dfa401f036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Forslund?= Date: Mon, 5 Jun 2017 10:52:47 +0200 Subject: [PATCH] refactor Google tts to take advantage of playback thread --- mycroft/tts/google_tts.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mycroft/tts/google_tts.py b/mycroft/tts/google_tts.py index 22aac2aa60..13abc1a758 100644 --- a/mycroft/tts/google_tts.py +++ b/mycroft/tts/google_tts.py @@ -19,7 +19,6 @@ from gtts import gTTS from mycroft.tts import TTS, TTSValidator -from mycroft.util import play_mp3 __author__ = 'jdorleans' @@ -27,12 +26,12 @@ __author__ = 'jdorleans' class GoogleTTS(TTS): def __init__(self, lang, voice): super(GoogleTTS, self).__init__(lang, voice, GoogleTTSValidator(self)) + self.type = 'mp3' - def execute(self, sentence): + def get_tts(self, sentence, wav_file): tts = gTTS(sentence, self.lang) - tts.save(self.filename) - p = play_mp3(self.filename) - p.communicate() # Wait for termination + tts.save(wav_file) + return (wav_file, None) # No phonemes class GoogleTTSValidator(TTSValidator):