did some renaming for members
This commit is contained in:
parent
e5641f80d7
commit
cfc1dfb1ca
@ -7,7 +7,7 @@ import hashlib
|
||||
import difflib
|
||||
import textwrap
|
||||
import speech.es as es
|
||||
#import speech.sd as sd
|
||||
import speech.sd as sd
|
||||
|
||||
runtime = {
|
||||
'running':True,
|
||||
@ -25,8 +25,8 @@ runtime = {
|
||||
'newContentAttrib': b'',
|
||||
'oldTTY':'0',
|
||||
'newTTY':'0',
|
||||
'speechDriverString':'es',
|
||||
'speechDriver': es.speech()
|
||||
'speechDriverString':'sd',
|
||||
'speechDriver': sd.speech()
|
||||
}
|
||||
|
||||
while(runtime['running']):
|
||||
|
@ -4,48 +4,48 @@
|
||||
|
||||
class speech():
|
||||
def __init__(self, ):
|
||||
self.es = None
|
||||
self.isInitialized = False
|
||||
self._es = None
|
||||
self._isInitialized = False
|
||||
try:
|
||||
from espeak import espeak
|
||||
self.es = espeak
|
||||
self.isInitialized = True
|
||||
self._es = espeak
|
||||
self._isInitialized = True
|
||||
except:
|
||||
self.initialized = False
|
||||
self._initialized = False
|
||||
|
||||
|
||||
def speak(self,text, queueable=True):
|
||||
if not self.isInitialized:
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
if queueable == False: self.cancel()
|
||||
self.es.synth(text)
|
||||
self._es.synth(text)
|
||||
return True
|
||||
|
||||
def cancel(self):
|
||||
if not self.isInitialized:
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
self.es.cancel()
|
||||
self._es.cancel()
|
||||
return True
|
||||
|
||||
def clear_buffer(self):
|
||||
if not self.isInitialized:
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
return True
|
||||
|
||||
def setVoice(self, voice):
|
||||
if not self.isInitialized:
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
return es.set_voice('de')
|
||||
return _es.set_voice('de')
|
||||
|
||||
def setPitch(self, pitch):
|
||||
if not self.isInitialized:
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
return es.set_parameter(espeak.Parameter.Pitch, pitch)
|
||||
return _es.set_parameter(espeak.Parameter.Pitch, pitch)
|
||||
|
||||
def setSpeed(self, speed):
|
||||
if not self.isInitialized:
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
return es.set_parameter(espeak.Parameter.Rate, speed)
|
||||
return _es.set_parameter(espeak.Parameter.Rate, speed)
|
||||
|
||||
def setModule(self, module):
|
||||
pass
|
||||
|
@ -3,67 +3,67 @@
|
||||
# speech-dispatcher driver
|
||||
|
||||
class speech():
|
||||
def __init__(self, ):
|
||||
self.sd = None
|
||||
self.isInitialized = False
|
||||
def __init__(self ):
|
||||
self._sd = None
|
||||
self._isInitialized = False
|
||||
try:
|
||||
import speechd
|
||||
self.sd = speechd.SSIPClient('fenrir')
|
||||
self.isInitialized = True
|
||||
self._sd = speechd.SSIPClient('fenrir')
|
||||
self._isInitialized = True
|
||||
except:
|
||||
self.initialized = False
|
||||
self._initialized = False
|
||||
|
||||
|
||||
def speak(self,text, queueable=True):
|
||||
if not self.isInitialized:
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
if queueable == False: self.cancel()
|
||||
self.sd.speak(text)
|
||||
self._sd.speak(text)
|
||||
return True
|
||||
|
||||
def cancel(self):
|
||||
if not self.isInitialized:
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
self.sd.cancel()
|
||||
self._sd.cancel()
|
||||
return True
|
||||
|
||||
def clear_buffer(self):
|
||||
if not self.isInitialized:
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
return True
|
||||
|
||||
def setVoice(self, voice):
|
||||
if not self.isInitialized:
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
try:
|
||||
self.sd.set_voice(voice)
|
||||
self._sd.set_voice(voice)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
def setPitch(self, pitch):
|
||||
if not self.isInitialized:
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
try:
|
||||
self.sd.set_pitch(pitch)
|
||||
self._sd.set_pitch(pitch)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
def setSpeed(self, speed):
|
||||
if not self.isInitialized:
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
try:
|
||||
self.sd.set_rate(speed)
|
||||
self._sd.set_rate(speed)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
def setModule(self, module):
|
||||
if not self.isInitialized:
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
try:
|
||||
self.sd.set_output_module(module)
|
||||
self._sd.set_output_module(module)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
@ -71,4 +71,4 @@ class speech():
|
||||
|
||||
def shutdown(self):
|
||||
self.cancel()
|
||||
self.sd.close()
|
||||
self._sd.close()
|
||||
|
Loading…
Reference in New Issue
Block a user