Linux text to speech with Festival
There are many reasons why you would want to enable a text to speech feature on a computer. You could suffer from poor (or no) vision, you might need the feature for a science experiment, or maybe you just want to have your log files read to you. No matter the reason, text to speech in Linux is a fairly straight-forward task.
There are also many sub-systems that can be used for this purpose. But in this article I want to address using the Festival system to enable text to speech recognition. Once this is working you can use it however you need and in as many ways as you need.
Festival
The Festival text to speech system was created by Alan W. Black  at the Center for Speech Technology Research at the University of Edinburgh (with contributions from Carnegie Melon University). Festival is a full text to speech system with many APIs and a full environment for research and development in the area of speech synthesis.
Festival has been designed as a multi-lingual system which includes English (British and American pronunciation), Welsh, and Spanish. For other languages (such as Castilian Spanish, Czech, Finnish, Hindi, Italian, Marathi, Polish, Russian and Telugu) add ons must be installed for use.
Installation
Many distributions already include Festival by default. But in case your did not, you can install it with these easy steps:
Open up a terminal window.
- Su to the root user (or use sudo if needed).
- Issue the command yum install festival (replace yum with your particular package installer such as apt-get).
- Accept any dependencies.
That's it! Festival should now be on your system and ready to go. Let's test it.
Testing, testing.
Naturally you will need to have a working sound system on your PC to use Festival. Let's make sure Festival is working. Open up a terminal window again and issue the command:
echo "Would you like to play a game?" | festival --tts
NOTE: Hopefully you know what the above quote is from. ;-)
If you heard the synthesized voice Festival is working. Now let's have Festival read from a text file. Create a text file with some content and save the file as test.txt. Now, back in the terminal window, issue the command:
festival --tts test.txt
You should be hearing the synthesized voice reading back your text for you.
PDFs
With Festival working properly you can also read PDFs with the help of Adobe reader. With Adobe reader installed you can open up a PDF and then click View > Read Out Loud to enable text to speech on a document. With this system you can pause, read entire documents, read only a page, and more.
Final thoughts
You can really have fun with the Festival system. You could set up alarms (using the at command) to wake you with a special synthesized alarm clock and much more. But text to speech isn't just for fun or research. Remember, there is a world of computer users out there who rely on systems like this. Fortunately the Linux community has this need covered.
Advertisement
Am also unsatisfied with the text to speech service. the voices are still metallic and not human
create this script xtalk
#!/bin/bash
xsel | festival –tts –pipe
set it executable “chmod 755 xtalk”
create a new custom keyboard shortcut, any key combo, i use alt x and the
prog to run is your xtalk script
select the text u want read press alt x
Here is a Perl script which uses Google TTS. It takes a text file and generates mp3 output:
http://michalfapso.blogspot.com/2012/01/using-google-text-to-speech.html
SIOD ERROR: could not open file /usr/lib/festival/siod.scm
I install festival, speech_tools, festvox (everything i need it) but i don’t know what to do in this case. Someone have any idea about it?
thanks
I had tested many Text to Speech service… Completely unsatisfied.
TTS will be successful only is there is a better user friendly experience and most of
them fail
I have one small problem, I need working TTS all the time, not just run a command in terminal. I need it to speak the entire screen live (like a windows screen reader) and even work within an X desktop (I know orca and gnome do this). I would also need to be able to use any function in said X desktop strictly by keyboard (a mouse is useless for me).
comments?
As long as the quality of the voices is worthless, the mention of such programs is useless. You should specify at least the frequency of the voices, those should be at least 22 kHz.