Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
muflone committed Jul 1, 2009
1 parent a4ce405 commit fb15691
Show file tree
Hide file tree
Showing 15 changed files with 1,143 additions and 407 deletions.
6 changes: 3 additions & 3 deletions DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Package: gespeaker
Version: 0.4
Version: 0.5
Section: sound
Priority: optional
Architecture: all
Depends: espeak, python, python-gtk2, python-gobject, alsa-utils
Installed-Size: 110
Depends: espeak, espeak-data, python, python-gtk2, python-gobject, alsa-utils | pulseaudio-utils
Installed-Size: 280
Maintainer: Muflone Ubuntu Trucchi <[email protected]>
Description: A GTK+ frontend for the espeak system
Gespeaker is a GTK+ frontend for espeak. It allows to play
Expand Down
13 changes: 12 additions & 1 deletion DialogFileOpenSave.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, useForOpen=True, title=None, initialDir=None, initialFile=Non
action=gtk.FILE_CHOOSER_ACTION_SAVE,
buttons=(
gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_SAVE, gtk.RESPONSE_OK
useForOpen and gtk.STOCK_OPEN or gtk.STOCK_SAVE, gtk.RESPONSE_OK
)
)
self.connect('response', self._response_callback)
Expand All @@ -32,6 +32,17 @@ def _response_callback(self, *args):
def show(self):
super(self.__class__, self).run()
return self.response==gtk.RESPONSE_OK

def addFilter(self, name, patterns=None, mimetypes=None):
filter = gtk.FileFilter()
filter.set_name(name)
if patterns:
for pattern in patterns:
filter.add_pattern(pattern)
if mimetypes:
for mimetype in mimetypes:
filter.add_mime_type(mimetype)
super(self.__class__, self).add_filter(filter)

class DialogFileSave(DialogFileOpenSave):
def __init__(self, title=None, initialDir=None, initialFile=None, askOverwrite=True):
Expand Down
40 changes: 38 additions & 2 deletions EspeakFrontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
##

import SubprocessWrapper
import os

class EspeakFrontend(object):
def __init__(self):
Expand Down Expand Up @@ -32,11 +33,20 @@ def pauseOrResume(self, status):
else:
self.procTalk[1].resume()

def play(self, cmdEspeak, cmdPlayer):
def play(self, cmdEspeak, cmdPlayer, fileToRecord=None):
"Play the command provided"
# If save to file has been requested add -w else --stdout
cmdEspeak += fileToRecord and ['-w', fileToRecord] or ['--stdout']
# Execute espeak and pipe it with player
procEspeak = SubprocessWrapper.Popen(cmdEspeak.split(),
print cmdEspeak, cmdPlayer.split()
procEspeak = SubprocessWrapper.Popen(cmdEspeak,
stdout=SubprocessWrapper.PIPE)
# Save to file has been requested so we have to wait for espeak end
# and to pipe filename content to the player
if fileToRecord:
procEspeak.wait()
procEspeak = SubprocessWrapper.Popen(['cat', fileToRecord],
stdout=SubprocessWrapper.PIPE)
procPlay = SubprocessWrapper.Popen(cmdPlayer.split(),
stdin=procEspeak.stdout,
stdout=SubprocessWrapper.PIPE,
Expand Down Expand Up @@ -68,3 +78,29 @@ def loadLanguages(self, cmdEspeak):
proc = SubprocessWrapper.Popen((cmdEspeak, '--voices'),
stdout=SubprocessWrapper.PIPE)
return proc.communicate()[0].split('\n')[1:-1]

def loadVariants(self, cmdEspeak):
"Load variants list from espeak"
vardir = '/usr/share/espeak-data/voices/!v'
print 'loading variants from %s' % vardir
variantsM = []
variantsF = []
# Check if voice variants dir exists
if os.path.exists(vardir) and os.path.isdir(vardir):
# Load files from vardir
for f in os.listdir(vardir):
# Only files
if os.path.isfile(os.path.join(vardir, f)):
varfile = open(os.path.join(vardir, f), mode='r')
varcontent = varfile.read().split('\n')
varfile.close()
# Check if it's a valid variant
if varcontent[0] == 'language variant' and \
varcontent[1][:5] == 'name ' and \
varcontent[2][:7] == 'gender ':
# Check gender
if varcontent[2][7:] == 'female':
variantsF.append((f, varcontent[1][5:]))
else:
variantsM.append((f, varcontent[1][5:]))
return (variantsM, variantsF)
3 changes: 3 additions & 0 deletions SubprocessWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ def resume(self):
return self.process.send_signal(signal)
else:
return os.kill(self.pid, signal)

def wait(self):
return self.process.wait()
18 changes: 18 additions & 0 deletions doc/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
gespeaker (0.5) all; urgency=low

* Added an exteder separator for settings to allow maximum usage of the
window with the text.
* Added filters for load/save text dialogs.
* Added support for recording the audio track to wave.
* Added a statusbar showing the active record mode.
* Added preferences dialog.
* Added preferences save and reload for welcome message, window size,
voice settings and expander status.
* Added support for audio frontend: ALSA (aplay), PulseAudio (paplay)
and user customized player command, with audio command test.
* Added voice variants by scanning /usr/share/espeak-data/voices/!v
folder for extra voice variants.
* Fixed stock icon for DialogFileOpenSave.

-- Muflone <[email protected]> Fri, 30 Jun 2009 18:48:50 +0100

gespeaker (0.4) all; urgency=medium

* Added SubprocessWrapper.Popen to wrap subprocess.Popen in order to
Expand Down
Loading

0 comments on commit fb15691

Please sign in to comment.