Wednesday, July 13, 2011
1:46 PM

Making a script speak.


espeak: Speech synthesiser.

If you ever wanted your script to speak out words or messages, here is a command that will come handy, "espeak".
"espeak " will speak out any english word or sentence you give as input. It supports a few other languages too.

Eg:
Open a terminal and type
$ espeak  "hello" 

If your speaker is turned on, you should hear a digial voice speak hello to you. This could be used to make scripts
very user friendly and interestingly inetractive.
The speed, pitch and amplitude of the voice can be changed by options -s,-p and -a respectively.
For eg:
Save the following as speak.sh

**********speak.sh***********
espeak -s 20 "hello"
espeak -a 30 -p 5 "welcome"
espeak -s 100 "Have a great day"
******************************

Now run the script from the terminal

$ sh speak.sh

you should hear the three sentences being spoken at different speeds and amplitudes. Change the numbers being passed to the options
and see the different voices that you can generate.
If you do not have the package installed you can get it from

http://espeak.sourceforge.net/



Go ahead, let your scripts do the talking :-)



0 comments:

Post a Comment