banner
Previous Page
PCLinuxOS Magazine
PCLinuxOS
Article List
Disclaimer
Next Page

Say It Out Loud With googlesay


by critter

I have an announcement...

Texstar recently introduced a new utility, called googlesay, to forum members. Install the file from the PCLinuxOS repository, along with any dependencies.

To use it, type something along the lines of:

googlesay "Welcome" en



Anything inside the quotes will be spoken, and the 'en' is the language code. Since I live in the UK, I get a British English accent. To make it an American accent, use en-us. Similarly, you can use de, fr, it etc., to add an accent to the spoken language. Try

googlesay "Wilkommen" de

The googlesay utility is actually a small bash script, and as such, it understands things like environment variables passed in the text.



To make use of this I wrote the following script:


#!/bin/bash
# welcome.sh

DAY=$(date '+%A')
MONTH=$(date '+%B')
DATE=$(date '+%e')
googlesay "Welcome to $HOSTNAME, Today is $DAY $MONTH $DATE" en-us

I made it executable with the command chmod +x welcome.sh.

I then added it to my start up files. To do this in KDE, open Configure Your Desktop > Startup and Shutdown > Autostart. Click on add script and browse to the script. If you are not using KDE and don't know how to do this, then you could have a look at one of the excellent special editions on the magazine website. Most desktop types have been covered.

I now get reminded of the date every time I restart my computer.

If you would like to add a comment when you start up an application, it can be done in a similar manner. For example, to create a new document in LibreOffice, and be asked which type of document you want, you could use this.


#!/bin/bash
# office.sh
$(sleep 2 ; googlesay "Please select a document type" en-us) &
libreoffice4.1
exit 0

The sleep command is to allow the application to appear before the speech starts, and you may need to adjust this. Also, if you are using a version of LibreOffice other than 4.1, then adjust this value. Name the script office.sh, save it to your home directory, make it executable with chmod +x office.sh and then add the following to your .bashrc file.

alias office='~/office.sh'

Type office in a terminal to run it (You may have to restart the terminal to activate the new alias). Alternatively, you could add an icon to your desktop or panel. Open a text editor and enter the following text:





[Desktop Entry]
Name=systeminfo
Type=Application
Comment=Show System Infos
Terminal=false
Exec=systeminfo %U
Icon=systeminfo.png
Categories=Infos;System;Monitor;
GenericName=Systeminfos
Encoding=UTF­8

Save it as office.desktop and the drop it onto your desktop.

If you have a home network and you are the administrator (have access to other accounts), you could leave a birthday or anniversary message for a family member. In fact, you could get up to all sorts of mischief if you were so inclined.

Now, with googlesay, you can not only just launch a program, but you can announce it aloud.



Previous Page              Top              Next Page