diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2009-03-10 01:39:00 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2009-03-10 01:39:00 (GMT) |
commit | 92d05c2600fd7dfc1f3c9c03e69aafabcce9b3c2 (patch) | |
tree | c9aa19d2b772e0c659458e1899d68ff13010bdbc /Speak.activity/audio.py | |
parent | 79553f3d45558c12f19b1ec130c22af5bb61e42b (diff) |
Tweak default values for pitch/rate
Diffstat (limited to 'Speak.activity/audio.py')
-rw-r--r-- | Speak.activity/audio.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Speak.activity/audio.py b/Speak.activity/audio.py index a9bf1c4..cd69529 100644 --- a/Speak.activity/audio.py +++ b/Speak.activity/audio.py @@ -37,6 +37,20 @@ from struct import * logger = logging.getLogger('speak') +try: + import gst + gst.element_factory_make('espeak') + + PITCH_MAX = 200 + RATE_MAX = 200 + PITCH_DEFAULT = PITCH_MAX/2 + RATE_DEFAULT = RATE_MAX/2 +except: + PITCH_MAX = 99 + RATE_MAX = 99 + PITCH_DEFAULT = PITCH_MAX/2 + RATE_DEFAULT = RATE_MAX/3 + class AudioGrab(gobject.GObject): __gsignals__ = { 'new-buffer': (gobject.SIGNAL_RUN_FIRST, None, [gobject.TYPE_PYOBJECT]) @@ -57,8 +71,8 @@ class AudioGrab(gobject.GObject): self._playfile(wavpath) def _speak(self, status, text): - pitch = int(status.pitch) * 2 - 100 - rate = int(status.rate) * 2 - 100 + pitch = int(status.pitch) - 100 + rate = int(status.rate) - 100 logger.debug('pitch=%d rate=%d voice=%s text=%s' % (pitch, rate, status.voice.name, text)) |