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.
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
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.