Coming soon: (temp home at http://kentbros.blogspot.com/)

——-

This is directed towards Debian based distros, but could surely work with others. (i.e. substitute yum for apt-get on Redhat based distros).

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.

Step 1 Install needed software

You will need the speech synthesis and the gui prompt software.

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

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

#############################################################
#
# 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

Save the file.

Make the file executable:

$ chmod +x talk.sh

Step 3 Create a launcher

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.

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.

Step 5 Reading a file out loud.

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

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

$ gedit ~/talkfile.sh &

talkfile.sh

#############################################################
#
# Talking a file script
#
#--------------------------
# get words to talk
szAnswer=$(zenity --file-selection --title="Select a file to read outloud")
#--------------------------
# Say words.
festival --tts  $szAnswer
#--------------------------
# done

Save the file.

Make the file executable:

$ chmod +x talkfile.sh

Step 6 Set up a launcher again.

On the open desktop, right click on the desktop and choose: Create launcher. Press enter when done.

Call it “Talk a file” or whatever you want..

Step 7 Test it out.

Double click on the “Read a text file out load” launcher.

You will get the prompt window,
Choose what file you want to hear read out loud and press OK.

You should now hear the computer read the file out loud.

Note: Files with special characters could cause problems. You may need to edit accordingly.

Step 8 Epilogue.

Not only can you read a sentence out loud, should be able to read out loud a simple text file.

Time for a little refreshment:

Bonus: If you have a server without a monitor which is commonly known as headless, you can either use the internal speaker or attached speakers to speak out messages. Might be better than idiot lights and or a lcd that might eventually get ignored over time.

Server_status.sh (running in background).
[pseudocode]


if server overheating then
echo “Attention: server status message!. ” | festival –tts
echo “Warning the server is overheating. Warning the server is overheating. ” | festival –tts
echo “Warning the server is overheating. Warning the server is overheating. ” | festival –tts
fi


[/pseudocode]

Have fun!

Advertisements