Linux text to speech with Festival - gHacks Tech News

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.

  1. Su to the root user (or use sudo if needed).
  2. Issue the command yum install festival (replace yum with your particular package installer such as apt-get).
  3. 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

We need your help

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:


Previous Post: «
Next Post: »

Comments

  1. kada said on October 9, 2010 at 11:57 pm
    Reply

    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.

  2. Eric Oyen said on October 10, 2010 at 6:17 am
    Reply

    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?

  3. Rajandran R said on October 10, 2010 at 7:49 am
    Reply

    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

  4. Sabinin said on June 24, 2011 at 2:58 pm
    Reply

    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

  5. Michal Fapso said on January 29, 2012 at 9:00 pm
    Reply

    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

  6. wizo chocs said on March 2, 2012 at 12:49 pm
    Reply

    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

  7. david said on June 20, 2012 at 2:17 pm
    Reply

    Am also unsatisfied with the text to speech service. the voices are still metallic and not human

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.