Zenspeak

You can give this one to children. It makes them noisier.

This one's just a simple interface to either espeak or festival: it asks you what to say via zenity and then says it. It doesn't take any arguments, so you start it up with a simple:

./zenspeak

In summary, it's not exactly dragon magic.

The code:
#!/bin/bash

# Zenspeak
#
# Provides a simple graphical (Gtk) interface to a speech production system:
# either espeak or festival. It's really simple too: you put in some text, 
# the text is spoken. When you put in zero text, the program ends.

# Parameters:
10#   None
11#
12# Depends:
13#   espeak      (apt:espeak)
14#   festival    (apt:festival)
15#   zenity      (apt:zenity)
16#
17# Author:
18#   Konrad Siek <konrad.siek@gmail.com>
19#
20# License information:
21#
22# This program is free software: you can redistribute it and/or modify
23# it under the terms of the GNU General Public License as published by
24# the Free Software Foundation, either version 3 of the License, or
25# (at your option) any later version.
26#
27# This program is distributed in the hope that it will be useful,
28# but WITHOUT ANY WARRANTY; without even the implied warranty of
29# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30# GNU General Public License for more details.
31#
32# You should have received a copy of the GNU General Public License
33# along with this program. If not, see <http://www.gnu.org/licenses/>.
34#
35# Copyright 2009 Konrad Siek
36
37# System for production of sound is selected by the parameter, 
38# or the defaut is used if none were specified.
39SYSTEM_DEFAULT=espeak
40SYSTEM=`(( $# == 0 )) && echo "$SYSTEM_DEFAULT" || echo "$1"`
41echo $SYSTEM
42
43# System dependent settings for espeak:
44espeak_speed=120            # default: 160
45espeak_pitch=60            # 0-99, default: 50
46espeak_amplitude=20            # 0-20, default: 10
47espeak_voide=english     # list of voices: `espeak --voices`
48espeak_variant=f2            # m{1,6}, f{1,4}
49
50# I'm completely pants when it comes to setting up festival, so I won't 
51# even attempt it here.
52
53while true
54do
55    # Show dialog and get user input.
56    something=`zenity --entry --title="Say something..." --text="Say:"`
57    
58    # If no user input or cancel: bugger off (and indicate correct result).
59    if [ -z "$something" ]
60    then
61        exit 0
62    fi
63
64    # Put the input through either espeak or festival.
65    if [ "$SYSTEM" == "espeak" ] 
66    then
67        # Note: the sound is padded within pulse, so that it can be 
68        # played simultaneously with other sources.
69        padsp espeak \
70            -a $espeak_amplitude \
71            -p $espeak_pitch \
72            -s $espeak_speed \
73            -v $espeak_voice+$espeak_variant \
74            "$something"
75    elif [ "$SYSTEM" == "festival" ]
76    then
77        # Incidentally, that's all I know about festival.
78        echo "$something" | festival --tts
79    fi    
80done


The code is also available at GitHub as bash/zenspeak.

lala moulati ana9a maghribia

seo

 

Blogroll

Site Info

Text

telechargementz Copyright © 2009 WoodMag is Designed by Ipietoon for Free Blogger Template