From 387eb5f24ca12b119b642c0841d7e043c9db657f Mon Sep 17 00:00:00 2001 From: chrys Date: Sat, 21 Oct 2017 03:10:59 +0200 Subject: [PATCH] fix rate --- src/fenrir/speechDriver/emacspeakDriver.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/fenrir/speechDriver/emacspeakDriver.py b/src/fenrir/speechDriver/emacspeakDriver.py index 3736c87d..c526b17b 100644 --- a/src/fenrir/speechDriver/emacspeakDriver.py +++ b/src/fenrir/speechDriver/emacspeakDriver.py @@ -27,20 +27,26 @@ class driver(): try: self.server.terminate() except Exception as e: - self.env['runtime']['debug'].writeDebugOut('speechDriver:shutdown:self.server.terminate():' + str(e),debug.debugLevel.WARNING) + self.env['runtime']['debug'].writeDebugOut('speechDriver:shutdown:self.server.terminate():' + str(e),debug.debugLevel.ERROR) def speak(self,text, queueable=True): if not self._isInitialized: return if not queueable: self.cancel() - self.server.sendline('tts_say ' + '\"' + text.replace('"', '\\\"') +'\"') - + try: + self.server.sendline('tts_say ' + '\"' + text +'\"') + #print(text.replace('"', '\\\"')) + #self.server.sendline('tts_say ' + '\"' + text.replace('"', '\\\"') +'\"') + except Exception as e: + self.env['runtime']['debug'].writeDebugOut('speechDriver:speak:self.server.sendline():' + str(e),debug.debugLevel.ERROR) def cancel(self): if not self._isInitialized: return - self.server.sendline('s') - + try: + self.server.sendline('s') + except Exception as e: + self.env['runtime']['debug'].writeDebugOut('speechDriver:cancel:self.server.sendline():' + str(e),debug.debugLevel.ERROR) def setCallback(self, callback): print('SpeechDummyDriver: setCallback') @@ -59,7 +65,10 @@ class driver(): def setRate(self, rate): if not self._isInitialized: return - self.server.sendline('tts_set_speech_rate' + str(rate)) + try: + self.server.sendline('tts_set_speech_rate' + str(int(rate * 500))) + except Exception as e: + self.env['runtime']['debug'].writeDebugOut('speechDriver:setRate:self.server.sendline():' + str(e),debug.debugLevel.ERROR) def setModule(self, module): pass