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