Emulate say() in Ubuntu

Macs come standard with the "say" command, which translates text into speech. It's pretty easy to do the same thing on linux, using a package called 'festival'.

Install the app_

sudo apt-get install festival

Then try it out_

echo "Hello World!" | festival -tts

If you get an error message that says "can't open /dev/dsp", do the following_

sudo apt-get install esound-clients sudo gedit /etc/festival.scm

and paste in the following lines_

(Parameter.set 'Audio_Command "esdplay $FILE") (Parameter.set 'Audio_Method 'Audio_Command) (Parameter.set 'Audio_Required_Format 'snd)

Now, save the file, and try it again.

I added a little alias, as well. Open up your ~/.bashrc and add these lines_

function say {     echo $1 | festival --tts }

Now the command requires much less typing_

say "Hello world!"

Have fun!


comments powered by Disqus