diff --git a/config/settings/settings.conf b/config/settings/settings.conf index d6708f84..12611c8b 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -1,23 +1,28 @@ + [sound] -enabled=False, -driver=sox +enabled=True +driver=gstreamer theme=default [speech] enabled=True -driver=espeak -rate=800 +#driver=espeak +#language=en-us +#voice=en-us +driver=speechd +#rate=800 +rate=50 +volume=100 pitch=50 module=espeak -voice=en-us -language=en-us -volume=200 +voice=de +language=de [braille] enabled=False layout=en -[screen] +['screen] driver=linux [keyboard] @@ -28,3 +33,4 @@ wordEcho=True [general] debugLevel=0 punctuationLevel=1 + diff --git a/src/fenrir-package/1ChangeTTY.opus b/src/fenrir-package/1ChangeTTY.opus new file mode 100644 index 00000000..e147023b Binary files /dev/null and b/src/fenrir-package/1ChangeTTY.opus differ diff --git a/src/fenrir-package/1ChangeTTY.wav b/src/fenrir-package/1ChangeTTY.wav new file mode 100644 index 00000000..124e213c Binary files /dev/null and b/src/fenrir-package/1ChangeTTY.wav differ diff --git a/src/fenrir-package/commands/onInput/70000-speak_incomming.py b/src/fenrir-package/commands/onInput/70000-speak_incomming.py index 60c5b33c..2d69cb9b 100644 --- a/src/fenrir-package/commands/onInput/70000-speak_incomming.py +++ b/src/fenrir-package/commands/onInput/70000-speak_incomming.py @@ -12,8 +12,10 @@ class command(): if environment['screenData']['newDelta'] == environment['screenData']['oldDelta'] and \ not ttyChanged: return environment - + if ttyChanged: + environment['runtime']['outputManager'].playSoundIcon(environment,'ChangeTTY') environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], ttyChanged) + return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/core/outputManager.py b/src/fenrir-package/core/outputManager.py index 0b52a26d..8f26b964 100644 --- a/src/fenrir-package/core/outputManager.py +++ b/src/fenrir-package/core/outputManager.py @@ -41,8 +41,9 @@ class outputManager(): if environment['runtime']['soundDriver'] == None: return print(soundIconName) + environment['runtime']['soundDriver'].playSoundFile( environment['soundIcons'][soundIconName], interrupt) try: print(environment['soundIcons'][soundIconName]) - environment['runtime']['soundDriver'].playSoundFile(environment, environment['soundIcons'][soundIconName], interrupt) + environment['runtime']['soundDriver'].playSoundFile(environment['soundIcons'][soundIconName], interrupt) except: - print('no icon there for' + IconName) + print('no icon there for' + soundIconName) diff --git a/src/fenrir-package/core/settingsManager.py b/src/fenrir-package/core/settingsManager.py index 0addeafb..543479ce 100644 --- a/src/fenrir-package/core/settingsManager.py +++ b/src/fenrir-package/core/settingsManager.py @@ -86,16 +86,20 @@ class settingsManager(): Values[1] = Values[1].replace("'","") Values[1] = Values[1].replace('"',"") validSoundIcon = False + FilePath = '' if os.path.exists(Values[1]): FilePath = Values[1] - validKeyString = True + validSoundIcon = True else: + if not soundIconPath.endswith("/"): + soundIconPath += '/' if os.path.exists(soundIconPath + Values[1]): FilePath = soundIconPath + Values[1] validSoundIcon = True if validSoundIcon: environment['soundIcons'][soundIcon] = FilePath siConfig.close() + print(environment['soundIcons']) return environment def loadSettings(self, environment, settingConfigPath='../../config/settings/settings.conf'): diff --git a/src/fenrir-package/sound.py b/src/fenrir-package/sound.py new file mode 100644 index 00000000..14e25704 --- /dev/null +++ b/src/fenrir-package/sound.py @@ -0,0 +1,9 @@ +#!/bin/python + +import time + +from sound.gstreamer import sound + +s = sound() +s.playSoundFile('/home/chrys/Projekte/fenrir/fenrir/src/fenrir-package/1ChangeTTY.opus') +time.sleep(10) diff --git a/src/fenrir-package/sound/gstreamer.py b/src/fenrir-package/sound/gstreamer.py index 93c3ac25..9e0cd93b 100644 --- a/src/fenrir-package/sound/gstreamer.py +++ b/src/fenrir-package/sound/gstreamer.py @@ -1,4 +1,5 @@ import gi +import time from gi.repository import GLib try: @@ -18,33 +19,37 @@ class sound: return self.init() + def _onPlayerMessage(self, bus, message): if message.type == Gst.MessageType.EOS: self._player.set_state(Gst.State.NULL) elif message.type == Gst.MessageType.ERROR: self._player.set_state(Gst.State.NULL) error, info = message.parse_error() - + print(error, info) + print('drin') def _onPipelineMessage(self, bus, message): if message.type == Gst.MessageType.EOS: self._pipeline.set_state(Gst.State.NULL) elif message.type == Gst.MessageType.ERROR: self._pipeline.set_state(Gst.State.NULL) error, info = message.parse_error() - + print(error, info) + print('drin') + def _onTimeout(self, element): element.set_state(Gst.State.NULL) return False def playSoundFile(self, fileName, interrupt=True): if interrupt: - self.stop() + self.cancel() self._player.set_property('uri', 'file://%s' % fileName) self._player.set_state(Gst.State.PLAYING) def playFrequence(self, frequence, duration, adjustVolume, interrupt=True): if interrupt: - self.stop() + self.cancel() self._source.set_property('volume', tone.volume) self._source.set_property('freq', tone.frequency) self._source.set_property('wave', tone.wave) @@ -89,7 +94,7 @@ class sound: global _gstreamerAvailable if not _gstreamerAvailable: return - self.stop() + self.cancel() self._initialized = False _gstreamerAvailable = False