unify pitch and rate with a value 0.0 - 1.0 in config
This commit is contained in:
parent
326561774f
commit
f51a5967eb
5
TODO
5
TODO
@ -1,8 +1,6 @@
|
||||
ToDos in Priority order:
|
||||
|
||||
- try to consume shortcuts
|
||||
- convert pitch to percent in config
|
||||
- convert rate to percent in config
|
||||
|
||||
- implement commands
|
||||
set_copy_begin_mark
|
||||
@ -123,6 +121,9 @@ except KeyboardInterrupt:
|
||||
- performance tuning
|
||||
- add sound volume
|
||||
- convert volume to percent in config
|
||||
- convert pitch to percent in config
|
||||
- convert rate to percent in config
|
||||
|
||||
- default soundIcon theme (soundfiles)
|
||||
- implement commands
|
||||
curr_word
|
||||
|
@ -7,8 +7,8 @@ volume=1.0
|
||||
[speech]
|
||||
enabled=True
|
||||
driver=espeak
|
||||
rate=800
|
||||
pitch=50
|
||||
rate=0.75
|
||||
pitch=0.5
|
||||
module=espeak
|
||||
voice=en-us
|
||||
language=en-us
|
||||
|
@ -7,7 +7,7 @@ class outputManager():
|
||||
if self.playSoundIcon(environment, soundIconName, interrupt):
|
||||
return
|
||||
self.speakText(environment, text, interrupt)
|
||||
self.brailleText(environment, text)
|
||||
self.brailleText(environment, text, interrupt)
|
||||
|
||||
def speakText(self, environment, text, interrupt=True):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'):
|
||||
@ -18,23 +18,23 @@ class outputManager():
|
||||
self.interruptOutput(environment)
|
||||
environment['runtime']['speechDriver'].setLanguage(environment['runtime']['settingsManager'].getSetting(environment, 'speech', 'language'))
|
||||
environment['runtime']['speechDriver'].setVoice(environment['runtime']['settingsManager'].getSetting(environment, 'speech', 'voice'))
|
||||
environment['runtime']['speechDriver'].setPitch(environment['runtime']['settingsManager'].getSettingAsInt(environment, 'speech', 'pitch'))
|
||||
environment['runtime']['speechDriver'].setSpeed(environment['runtime']['settingsManager'].getSettingAsInt(environment, 'speech', 'rate'))
|
||||
environment['runtime']['speechDriver'].setPitch(environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'pitch'))
|
||||
environment['runtime']['speechDriver'].setSpeed(environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'rate'))
|
||||
environment['runtime']['speechDriver'].setModule(environment['runtime']['settingsManager'].getSetting(environment, 'speech', 'module'))
|
||||
environment['runtime']['speechDriver'].setVolume(environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'volume'))
|
||||
environment['runtime']['speechDriver'].speak(text)
|
||||
|
||||
def brailleText(self, environment, text, soundIconName = '', interrupt=True):
|
||||
def brailleText(self, environment, text, interrupt=True):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'):
|
||||
return
|
||||
if environment['runtime']['brailleDriver'] == None:
|
||||
return
|
||||
print('braille')
|
||||
print('braille:'+text)
|
||||
def interruptOutput(self, environment):
|
||||
environment['runtime']['speechDriver'].cancel()
|
||||
environment['runtime']['soundDriver'].cancel()
|
||||
|
||||
def playSoundIcon(self, environment, soundIconName, interrupt=True):
|
||||
def playSoundIcon(self, environment, soundIconName = '', interrupt=True):
|
||||
if soundIconName == '':
|
||||
return False
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'):
|
||||
|
@ -12,8 +12,8 @@ settings = {
|
||||
'speech':{
|
||||
'enabled': True,
|
||||
'driver':'speechd',
|
||||
'rate': 1,
|
||||
'pitch': 1,
|
||||
'rate': 0.75,
|
||||
'pitch': 0.5,
|
||||
'module': '',
|
||||
'voice': 'de',
|
||||
'language': 'de',
|
||||
@ -30,7 +30,7 @@ settings = {
|
||||
'general':{
|
||||
'keyboardLayout': "desktop",
|
||||
'debugLevel': debug.debugLevel.DEACTIVE,
|
||||
'punctuationLevel': 1
|
||||
'punctuationLevel': 1,
|
||||
},
|
||||
'keyboard':{
|
||||
'device':"all",
|
||||
|
@ -43,12 +43,12 @@ class speech():
|
||||
def setPitch(self, pitch):
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
return self._es.set_parameter(self._es.Parameter().Pitch, pitch)
|
||||
return self._es.set_parameter(self._es.Parameter().Pitch, int(pitch * 99))
|
||||
|
||||
def setSpeed(self, speed):
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
return self._es.set_parameter(self._es.Parameter().Rate, speed)
|
||||
return self._es.set_parameter(self._es.Parameter().Rate, int(speed*450 + 80))
|
||||
|
||||
def setModule(self, module):
|
||||
if not self._isInitialized:
|
||||
|
@ -48,7 +48,7 @@ class speech():
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
try:
|
||||
self._sd.set_pitch(pitch)
|
||||
self._sd.set_pitch(int(-100 + pitch * 200))
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
@ -57,7 +57,7 @@ class speech():
|
||||
if not self._isInitialized:
|
||||
return False
|
||||
try:
|
||||
self._sd.set_rate(speed)
|
||||
self._sd.set_rate(int(-100 + speed * 200))
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user