Festival - A Free Text to Speech Tool

January 24, 2006

What is Festival ?


Festival is a free text to speech tool developed by the Center for Speech Technology Research at the University of Edinburgh.

It is shipped with most Linux distributions and has been released under an X11-type license allowing unrestricted commercial and non-commercial use alike.

A text to speech tool accepts any written text as input and read it out to you.

I use Festival to read me an e-book I downloaded from Project Gutenberg.

Festival Usage


When you pass a text file to festival, it converts the contents of a text file into voice. For example, if I want to read a letter (mail) which is residing in a text file (say letter.txt). I can let festival read it out loud for me as follows:

$ festival --tts letter.txt

A Few More Examples


You can use festival in batch process mode without any user interaction.

If festival is started with out passing any command line parameters, you are dropped into a shell where you can make festival read out what ever text you type on the command line.

For instance, check the following examples:

$ festival 
festival> (SayText "Greetings from www.aboutlinux.info")

You can ask Festival to read a text file for you.

festival> (tts "myfile.txt")

Advantages


  • Available for Free under an open source license.
  • The quality of the voice and the pronunciations are very good. 
  • Supports 3 languages - English, Spanish, and Welsh.

Disadvantages


  • When it encounters a word not in its vocabulary, it tends to spell the word rather than pronounce it.
  • At present, it works only on text files. So if you intend to read a PDF document using festival, it won't work.

Other than such minor hiccups, Festival is a very usable, free text to speech tool available in Linux.

29 comments:

  • This is a nice utility. Thanks for explaining it on your blog.
    Does it have a GUI front end or something ?
    Howard
    Washington DC

  • Thanks for another good article. I did install it but have not tried it till today.
    I have HEARD this artical (copied as .txt) now and probably i will be using it regularly.

  • superstoned

    i know of a nice GUI frontend ;-)

    KDE. konqueror supports it, kwrite (so most kde apps that allow text input), and Koffice 1.5 (just entered feature freeze, so it'll be out soon) will support it, too. kttsd (kde text to speech deamon) is an easy to use fronted, with the just mentioned integration in most kde applications.

  • I tried it in Ubuntu Linux. But I had to first kill the esd daemon before festival will work.

    Specifically, I had to do a
    $ killall esd

    I wonder if any body has encountered this in Ubuntu ?

  • Ravi,
    There is a plugin available for Gaim that interfaces with festival. It allows for instant messages to be spoken by festival so you can hear it thru your speakers.

    James
    New York

  • Festival is great, but the one feature that is most important is not mentioned... text2wave. Using text2wave (part of Festival) you can read in a text file, output to .wav and pass it through lame or oggenc. This way one can pause, rewind, and take the audio with you. This does take up some resources, so it's best to split up the files into chapters (not more than 300 lines). Contact me at coathanger3 at netscape d0t net for two perl scripts, one to split the file, one to do a batch encoding. You may also want to run dos2unix against the book file before you split it up when using *nix.

  • Re: Anonymous 10:05PM

    Ubuntu has problems with esd more generally. For instance, to get sound out of most flash animations, one has to killall esd. And of course, to get sound working properly again for the general system, esd has to be restarted. What I want to know is if this kind of problem is encountered, in this or other forms, in different distros.

  • @ anonymous 11:57 PM
    I have been using Fedora core 2 and it does not have this problem. Fedora doesn't use Esd in my knowledge. It uses Alsa direct.

  • A nice frontend is also perlbox, which can recognise your voice, and do commands, and speak back with festival.

  • One of the best voice for Festival is cmu_us_slt_arctic_hts which can be found here. More about this on forums.gentoo.org.

  • Harry

    @anonymous (1st comment)
    If you are using KDE 3.5 (I am not sure if it is there in older versions of KDE), then open konquorer and navigate to the menu Tools > Speak Text

    And you will be able to configure festival to read the web page to you. It uses kttsd.

    I personally feel that the main problem in such a software is the quality of the voice file.

  • Although Festival advertises Welsh support, the voice that would allow this does not seem to be generally available, so it is a bit misleading.

  • so cool man ! thanks

  • For festival to actually be useful as a book reader it needs a frontend that handles things like pause and resume, navigation (eg. re-read the last paragraph) and especially bookmarking. I found the lack of bookmarking a real nuisance when reading ebooks until I realized that Opera handles that with html formatted texts.

    A festival book reader frontend would, for example, feed a paragraph at a time to festival and keep track of the location of this paragraph in the full text to permit navigation and bookmarking.

    This sounds like a good project for someone who is a better coder than I am.

  • For those who are using Ubuntu - I'm using Ubuntu 5.10 and have been using the companion project to Festival called FreeTTS - it's a Java-based utility which can use the Festival voices. Related to FreeTTS (and also sponsored by CMU) is Festvox. I use FreeTTS without having to kill esd.

    http://freetts.sourceforge.net/
    http://festvox.org/
    http://www.speech.cs.cmu.edu/

    DarrenR114 AT yahoo dot com

  • I use Ubuntu 5.10. I have no issues with audio at all- play music, watch movies, flash,and even festival.

  • grupotux

    I also use Ubuntu 5.10; tried festival from the command line and noticed that it does not recognize accented vowels (á, é, í, ó, ú, ü).
    These are essential for correct pronunciation (and intended meaning) in Spanish. Strings containing accented vowels are spelled out while the accented character is merely skipped. Is there a way around this?

  • On the KDE desktop, I place an ICON with this action:

    dcop klipper klipper getClipboardContents | fmt | festival --tts

    Then I simply highlight text with the mouse and click the icon. The highlighted text is read to me. Very cool.

  • Neat, but I couldn't figure out how to download a higher quality voice and start using it.

    On Windoze I had AT&T's Natural Voices (with ReadPlease) read books to me. It was great, but the higher quality voices make a big difference.

  • Most programs can be configured to use ESD. For programs that can't use ESD natively, you have two options (besides killing the esd daemon, of course)

    1. Prefix the command you're running with "esddsp ". For example,
    $ esddsp festival

    This will intercept open() calls that try to access /dev/dsp and route those through esd.

    2. Configure esd to release the dsp device after some period of inactivity with the -as option. For example if you pass esd "-as 5", it will release /dev/dsp after 5 seconds of inactivity so that any other program can access it directly. You can set this behavior by default in /etc/esound/esd.conf

  • Great tip about esd!
    edit /etc/esound/esd.conf
    turn on auto_spawn=1

  • this is great and i'm gonna do a project where by i want Festival to support Xhosa as well,i would like to know more about Festival,how it operates and help me to this project

  • I wrote this little script to read long clipboard texts relatively smoothly without slowing down.

    #!/bin/bash
    xclip -o |fmt --width=2000 | while read LINE; do
    cat << THISSTRINGSHOULDNTHAPPENNATURALLY |festival --tts
    $LINE
    THISSTRINGSHOULDNTHAPPENNATURALLY
    sleep .5
    done


    Then I just create a link to that script from my toolbar and voila I have a more generic text reader.

  • Contrary to this article, you can use Festival with PDF files! The "less" command allows you to browse a PDF file, so you can simply pipe its output to festival on the command line:

    less myfile.pdf | festival --tts

    This will speak the text in myfile.pdf. Similarly, you could pipe the output of a program like 'Antiword' to read Word documents.

  • As has already mentioned , you can read PDFs with the command

    less myfile.pdf | festival --tts

    you can then pause by doing a CTRL-Z and restart by typing 'bg' or 'fg' (depending on if you want the process to resume in the background or foreground.

  • I have installed "Fala" a Graphical User Interface frontend in Ubuntu Gutsy 7.10
    A simple software that speaks a text. You can type the text or appoint a file. Fala is just a frontend to festival. It's designed for GNOME, but if you have gtk, pyhton and festival you are able to run it.
    Available at sourceforgeDOTnet site. it is quite simple and useful.

  • Hi. I'm guessing this is scriptable but I also wondered if there's any possibilty of 'teaching' it new words. Way back in the days of the BBC Micro there was a text-to-speech program that allowed you to enter a word using a phonics code and to bind the phonics to a particular spelling (as long as it hadn't been defined already). If this were possible somehow in festival it would clear up quite a few problems. The BBC may have been behind the C64 for graphics but for programmability and expandability it was years ahead of its time (in fact they almost released a version after the BBC Master which had a built in Modem but that was when they started having financial trouble and released them without the modem as normal BBC Masters - our school had some of that model, it didn't have a modem built in but all you had to do was plug the modem in and it was ready to visit the BBSes - unlike other BBCs which needed a lot more configuration).

  • ravinder

    can anybody suggest me how can i integrate festival to a new application...i.e i want to read an entre file just by one click on the file

  • Don

    A more elegant way to convert PDF files to text is the "pdftotext" utility. In my distribution (openSUSE 11.3), pdftotext is provided by the poppler-tools package.

    pdftotext any.pdf - | festival --tts