diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-27 13:38:21 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-27 13:38:21 +0200 |
| commit | 16905e89b0e0d15f86df4cdf6536a396e06c49e6 (patch) | |
| tree | 759894d39e631f83e657e02f19dd25ff9db9768c /client/speaker.py | |
| parent | 9c99faa2a5b25eba9fbb27e344afab3d9f6f12b0 (diff) | |
| parent | 434e94f0f3bfc0e57b4e2120f6fb5522dd0ed229 (diff) | |
| download | jasper-client-16905e89b0e0d15f86df4cdf6536a396e06c49e6.tar.gz jasper-client-16905e89b0e0d15f86df4cdf6536a396e06c49e6.zip | |
Merge pull request #155 from Holzhaus/new-speakers
Cleanup client.speaker and add additional tts speakers
Diffstat (limited to 'client/speaker.py')
| -rw-r--r-- | client/speaker.py | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/client/speaker.py b/client/speaker.py deleted file mode 100644 index c20c01b..0000000 --- a/client/speaker.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8-*- -""" -A Speaker handles audio output from Jasper to the user - -Speaker methods: - say - output 'phrase' as speech - play - play the audio in 'filename' - isAvailable - returns True if the platform supports this implementation -""" -import os -import json - - -class eSpeakSpeaker: - - """ - Uses the eSpeak speech synthesizer included in the Jasper disk image - """ - @classmethod - def isAvailable(cls): - return os.system("which espeak") == 0 - - def say(self, phrase, OPTIONS=" -vdefault+m3 -p 40 -s 160 --stdout > say.wav"): - os.system("espeak " + json.dumps(phrase, False, False) + OPTIONS) - self.play("say.wav") - - def play(self, filename): - os.system("aplay -D hw:1,0 " + filename) - - -class saySpeaker: - - """ - Uses the OS X built-in 'say' command - """ - - @classmethod - def isAvailable(cls): - return os.system("which say") == 0 - - def shellquote(self, s): - return "'" + s.replace("'", "'\\''") + "'" - - def say(self, phrase): - os.system("say " + self.shellquote(phrase)) - - def play(self, filename): - os.system("afplay " + filename) - - -def newSpeaker(): - """ - Returns: - A speaker implementation available on the current platform - - Raises: - ValueError if no speaker implementation is supported on this platform - """ - - for cls in [eSpeakSpeaker, saySpeaker]: - if cls.isAvailable(): - return cls() - raise ValueError("Platform is not supported") |
