add commands {inc,dec}_{speech,sound}_{volume,rate,pitch}
This commit is contained in:
parent
b534e554e5
commit
cd123ac072
@ -19,3 +19,11 @@
|
|||||||
#=toggle_autoRead
|
#=toggle_autoRead
|
||||||
#=quit_fenrir
|
#=quit_fenrir
|
||||||
#=foreward_keypress
|
#=foreward_keypress
|
||||||
|
#=inc_speech_volume
|
||||||
|
#=dec_speech_volume
|
||||||
|
#=inc_speech_rate
|
||||||
|
#=dec_speech_rate
|
||||||
|
#=inc_speech_pitch
|
||||||
|
#=dec_speech_pitch
|
||||||
|
#=inc_sound_volume
|
||||||
|
#=dec_sound_volume
|
||||||
|
@ -19,3 +19,11 @@
|
|||||||
#=toggle_autoRead
|
#=toggle_autoRead
|
||||||
#=quit_fenrir
|
#=quit_fenrir
|
||||||
#=foreward_keypress
|
#=foreward_keypress
|
||||||
|
#=inc_speech_volume
|
||||||
|
#=dec_speech_volume
|
||||||
|
#=inc_speech_rate
|
||||||
|
#=dec_speech_rate
|
||||||
|
#=inc_speech_pitch
|
||||||
|
#=dec_speech_pitch
|
||||||
|
#=inc_sound_volume
|
||||||
|
#=dec_sound_volume
|
||||||
|
@ -12,10 +12,18 @@
|
|||||||
1-FENRIR,1-KEY_KPDOT=exit_review
|
1-FENRIR,1-KEY_KPDOT=exit_review
|
||||||
#=curr_screen
|
#=curr_screen
|
||||||
#=last_incomming
|
#=last_incomming
|
||||||
1-FENRIR,1-KEY_F2=toggle_braille
|
#1-FENRIR,1-KEY_F2=toggle_braille
|
||||||
1-FENRIR,1-KEY_F3=toggle_sound
|
#1-FENRIR,1-KEY_F3=toggle_sound
|
||||||
1-FENRIR,1-KEY_F4=toggle_speech
|
1-FENRIR,1-KEY_F4=toggle_speech
|
||||||
#=toggle_output
|
#=toggle_output
|
||||||
#=toggle_autoRead
|
#=toggle_autoRead
|
||||||
#=quit_fenrir
|
#=quit_fenrir
|
||||||
1-FENRIR,1-KEY_A=foreward_keypress
|
1-FENRIR,1-KEY_A=foreward_keypress
|
||||||
|
1-FENRIR,1-KEY_F2=inc_speech_volume
|
||||||
|
1-FENRIR,1-KEY_F3=dec_speech_volume
|
||||||
|
#=inc_speech_rate
|
||||||
|
#=dec_speech_rate
|
||||||
|
#=inc_speech_pitch
|
||||||
|
#=dec_speech_pitch
|
||||||
|
#=inc_sound_volume
|
||||||
|
#=dec_sound_volume
|
||||||
|
@ -12,7 +12,7 @@ pitch=0.5
|
|||||||
module=espeak
|
module=espeak
|
||||||
voice=de
|
voice=de
|
||||||
language=de
|
language=de
|
||||||
volume=1.0
|
volume=0.8
|
||||||
autoReadIncomming=True
|
autoReadIncomming=True
|
||||||
|
|
||||||
[braille]
|
[braille]
|
||||||
|
22
src/fenrir-package/commands/commands/dec_sound_volume.py
Normal file
22
src/fenrir-package/commands/commands/dec_sound_volume.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/python
|
||||||
|
import math
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def run(self, environment):
|
||||||
|
|
||||||
|
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'sound', 'volume')
|
||||||
|
|
||||||
|
value = round((math.ceil(20 * value) / 20) - 0.1, 2)
|
||||||
|
if value < 0.1:
|
||||||
|
value = 0.1
|
||||||
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'volume', str(value))
|
||||||
|
|
||||||
|
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent sound volume", soundIcon='SoundOff', interrupt=True)
|
||||||
|
|
||||||
|
return environment
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
22
src/fenrir-package/commands/commands/dec_speech_pitch.py
Normal file
22
src/fenrir-package/commands/commands/dec_speech_pitch.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/python
|
||||||
|
import math
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def run(self, environment):
|
||||||
|
|
||||||
|
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'pitch')
|
||||||
|
|
||||||
|
value = round((math.ceil(20 * value) / 20) - 0.1, 2)
|
||||||
|
if value < 0.0:
|
||||||
|
value = 0.0
|
||||||
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'pitch', str(value))
|
||||||
|
|
||||||
|
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent speech pitch", soundIcon='SpeechOff', interrupt=True)
|
||||||
|
|
||||||
|
return environment
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
22
src/fenrir-package/commands/commands/dec_speech_rate.py
Normal file
22
src/fenrir-package/commands/commands/dec_speech_rate.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/python
|
||||||
|
import math
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def run(self, environment):
|
||||||
|
|
||||||
|
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'rate')
|
||||||
|
|
||||||
|
value = round((math.ceil(20 * value) / 20) - 0.1, 2)
|
||||||
|
if value < 0.0:
|
||||||
|
value = 0.0
|
||||||
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'rate', str(value))
|
||||||
|
|
||||||
|
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent speech rate", soundIcon='SpeechOff', interrupt=True)
|
||||||
|
|
||||||
|
return environment
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
22
src/fenrir-package/commands/commands/dec_speech_volume.py
Normal file
22
src/fenrir-package/commands/commands/dec_speech_volume.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/python
|
||||||
|
import math
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def run(self, environment):
|
||||||
|
|
||||||
|
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'volume')
|
||||||
|
|
||||||
|
value = round((math.ceil(20 * value) / 20) - 0.1, 2)
|
||||||
|
if value < 0.1:
|
||||||
|
value = 0.1
|
||||||
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'volume', str(value))
|
||||||
|
|
||||||
|
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent speech volume", soundIcon='SpeechOff', interrupt=True)
|
||||||
|
|
||||||
|
return environment
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
22
src/fenrir-package/commands/commands/inc_sound_volume.py
Normal file
22
src/fenrir-package/commands/commands/inc_sound_volume.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/python
|
||||||
|
import math
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def run(self, environment):
|
||||||
|
|
||||||
|
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'sound', 'volume')
|
||||||
|
|
||||||
|
value = round((math.ceil(20 * value) / 20) + 0.1, 2)
|
||||||
|
if value > 1.0:
|
||||||
|
value = 1.0
|
||||||
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'volume', str(value))
|
||||||
|
|
||||||
|
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent sound volume", soundIcon='SoundOn', interrupt=True)
|
||||||
|
|
||||||
|
return environment
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
22
src/fenrir-package/commands/commands/inc_speech_pitch.py
Normal file
22
src/fenrir-package/commands/commands/inc_speech_pitch.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/python
|
||||||
|
import math
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def run(self, environment):
|
||||||
|
|
||||||
|
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'pitch')
|
||||||
|
|
||||||
|
value = round((math.ceil(20 * value) / 20) + 0.1, 2)
|
||||||
|
if value > 1.0:
|
||||||
|
value = 1.0
|
||||||
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'pitch', str(value))
|
||||||
|
|
||||||
|
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent speech pitch", soundIcon='SpeechOn', interrupt=True)
|
||||||
|
|
||||||
|
return environment
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
22
src/fenrir-package/commands/commands/inc_speech_rate.py
Normal file
22
src/fenrir-package/commands/commands/inc_speech_rate.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/python
|
||||||
|
import math
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def run(self, environment):
|
||||||
|
|
||||||
|
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'rate')
|
||||||
|
|
||||||
|
value = round((math.ceil(20 * value) / 20) + 0.1, 2)
|
||||||
|
if value > 1.0:
|
||||||
|
value = 1.0
|
||||||
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'rate', str(value))
|
||||||
|
|
||||||
|
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent speech rate", soundIcon='SpeechOn', interrupt=True)
|
||||||
|
|
||||||
|
return environment
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
22
src/fenrir-package/commands/commands/inc_speech_volume.py
Normal file
22
src/fenrir-package/commands/commands/inc_speech_volume.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/python
|
||||||
|
import math
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def run(self, environment):
|
||||||
|
|
||||||
|
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'volume')
|
||||||
|
|
||||||
|
value = round((math.ceil(20 * value) / 20) + 0.1, 2)
|
||||||
|
if value > 1.0:
|
||||||
|
value = 1.0
|
||||||
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'volume', str(value))
|
||||||
|
|
||||||
|
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent speech volume", soundIcon='SpeechOn', interrupt=True)
|
||||||
|
|
||||||
|
return environment
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
@ -19,7 +19,7 @@ class outputManager():
|
|||||||
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'].getSettingAsFloat(environment, 'speech', 'pitch'))
|
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'].setRate(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)
|
||||||
|
@ -45,10 +45,10 @@ class speech():
|
|||||||
return False
|
return False
|
||||||
return self._es.set_parameter(self._es.Parameter().Pitch, int(pitch * 99))
|
return self._es.set_parameter(self._es.Parameter().Pitch, int(pitch * 99))
|
||||||
|
|
||||||
def setSpeed(self, speed):
|
def setRate(self, rate):
|
||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
return False
|
return False
|
||||||
return self._es.set_parameter(self._es.Parameter().Rate, int(speed*450 + 80))
|
return self._es.set_parameter(self._es.Parameter().Rate, int(rate*450 + 80))
|
||||||
|
|
||||||
def setModule(self, module):
|
def setModule(self, module):
|
||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
|
@ -59,11 +59,11 @@ class speech():
|
|||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def setSpeed(self, speed):
|
def setRate(self, rate):
|
||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
self._sd.set_rate(int(-100 + speed * 200))
|
self._sd.set_rate(int(-100 + rate * 200))
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user