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