fix speechd driver dialect

This commit is contained in:
chrys 2016-08-16 23:34:23 +02:00
parent 3d5d048a4b
commit 85166bf552
2 changed files with 10 additions and 4 deletions

View File

@ -10,8 +10,8 @@ driver=speechd
rate=0.75 rate=0.75
pitch=0.5 pitch=0.5
module=espeak module=espeak
voice=us voice=
language=en language=english-us
volume=1.0 volume=1.0
autoReadIncomming=True autoReadIncomming=True

View File

@ -6,6 +6,7 @@ class speech():
def __init__(self ): def __init__(self ):
self._sd = None self._sd = None
self._isInitialized = False self._isInitialized = False
self._language = ''
try: try:
import speechd import speechd
self._sd = speechd.SSIPClient('fenrir') self._sd = speechd.SSIPClient('fenrir')
@ -18,6 +19,10 @@ class speech():
if not self._isInitialized: if not self._isInitialized:
return False return False
if queueable == False: self.cancel() if queueable == False: self.cancel()
try:
self._sd.set_synthesis_voice(self._language)
except:
pass
self._sd.speak(text) self._sd.speak(text)
return True return True
@ -39,7 +44,8 @@ class speech():
if not self._isInitialized: if not self._isInitialized:
return False return False
try: try:
self._sd.set_voice(voice) if voice != '':
self._sd.set_voice(voice)
return True return True
except: except:
return False return False
@ -74,7 +80,7 @@ class speech():
def setLanguage(self, language): def setLanguage(self, language):
if not self._isInitialized: if not self._isInitialized:
return False return False
self._sd.set_language(language) self._language = language
def setVolume(self, volume): def setVolume(self, volume):
if not self._isInitialized: if not self._isInitialized: