Instructables
Picture of Text to speech with linux.
Ever wanted to get your computer to talk. This might be real important in an emergency if you can not talk. It is so easy to do this.

Update: Added a section to read a text file.

Note: There is a gui for Festival, but I have not found a use for it.

http://sourceforge.net/projects/carnival/files/

Step 1: Install needed software

You will need the speech synthesis and the gui prompt software. (This is for Debian based distros)

$ sudo apt-get update
$ sudo apt-get install festival zenity

Note: you need to have a working sound card and speakers of some kind obviously.

Step 2: Create the batch file for talking.

You need to use an editor such as gedit to create a file called talk.sh.

In gnome on the menu at Applications > Accessories > gedit Text Editor
or
use the command line

$ gedit ~/talk.sh &

talk.sh
[code]
###################################################################
#
# Talking script
#
#--------------------------
# get words to talk
szAnswer=$(zenity --entry --text "What do you want the computer to say?" )
#--------------------------
# Say words.
echo $szAnswer | festival --tts
#--------------------------
# done
[/code]

Save the file.

Make the file executable:

$ chmod +x talk.sh

talk.sh.txt323 bytes

Step 3: Create a launcher

Picture of Create a launcher
Screenshot-Choose an application....png
Screenshot-Add a new entry.png
On the open desktop, right click on the desktop and choose: Create launcher

Call it "Talk" or whatever you want..
Choose your batch file. (talk.sh)
Add a comment if you want.
Then press OK.

Step 4: Test it.

Picture of Test it.
Screenshot-Add a new entry.png
Double click on the "Talk" launcher (also know as shortcut on mswindows machines)

You will get the prompt window,
Type in what you want to say and press enter.

You should now hear the computer talk.

Note: Sometimes using phonetics can help the distinctions of the words. For example use tehst for test.
 
Remove these adsRemove these ads by Signing Up