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