diff options
Diffstat (limited to 'espeak_gst.py')
-rw-r--r-- | espeak_gst.py | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/espeak_gst.py b/espeak_gst.py deleted file mode 100644 index 9f159c5..0000000 --- a/espeak_gst.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (C) 2009, Aleksey Lim -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import logging -logger = logging.getLogger('speak') - -import gi -gi.require_version('Gst', '1.0') -from gi.repository import Gst -import espeak - -PITCH_MAX = 200 -RATE_MAX = 200 - - -class AudioGrabGst(espeak.BaseAudioGrab): - def speak(self, status, text): - if not [i for i in unicode(text, 'utf-8', errors='ignore') \ - if i.isalnum()]: - return - - self.make_pipeline('espeak name=espeak ! wavenc') - src = self.pipeline.get_by_name('espeak') - - pitch = int(status.pitch) - 120 - rate = int(status.rate) - 120 - - logger.debug('pitch=%d rate=%d voice=%s text=%s' % (pitch, rate, - status.voice.name, text)) - - src.props.text = text - src.props.pitch = pitch - src.props.rate = rate - src.props.voice = status.voice.name - - self.restart_sound_device() - - -def voices(): - out = [] - - for i in Gst.element_factory_make('espeak').props.voices: - name, language, dialect = i - #if name in ('en-rhotic','english_rp','english_wmids'): - # these voices don't produce sound - # continue - out.append((language, name)) - - return out |