Details

In this HakTip we're setting up Festival for the GUI in Linux

Download HD Download MP4

Festival is a multi-lingual speech synthesis system. It was originally developed by Alan Black at the Centre for Speech Technology Research at the University of Edinburgh and additional contributions have been made by Garnegie Mellon University.

It sports a text to speech API, among others, and a command interface for extensions. The system supports English (both Brithsh and American) as well as Welsh and Spanish. You can also find packages for Finnish, Polish and Russian to name a few. And if that wasn't enough the whole lot of it is published under the BSD license - meaning it's free and open source.

To get started we'll need a few packages: Obviously first we'll need festival and xsel.

cat << eof > talk.sh
#!/bin/bash
xsel | festival --tts --pipe
eof
cmod +x ~/tts.sh

Next bind mod4+z to ~/talk.sh. From Ubuntu key bindings are found under System, Preferences, Keyboard Shortcuts

If you run into the error Linux: can't open /dev/dsp

echo "
(Parameter.set 'Audio_Command "aplay -q -c 1 -t raw -f s16 -r $SR $FILE")
(Parameter.set 'Audio_Method 'Audio_Command)
" >> ~/.festivalrc

The speech rate can be configured in /usr/share/festival/voices/english/kal_diphone/festvox/kal_diphone.scm
under the setting "Parameter.set 'Duration_Stretch" -- the lower the value the faster the speech rate.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

8 Comments

  • Jaime Sanchez 2 years ago

    Hi, just a note:

    if you are using, as I am, spanish or other non-ascii characters, just use:

    xsel | iconv -f utf-8 -t iso-8859-1 | festival –tts –pipe

    or

    echo “Para español, pulse uno” | iconv -f utf-8 -t iso-8859-1 | festival –tts –pipe

    hope it helps

  • Occulus 2 years ago

    Awesome tip, I’m going to set this up when I get home from work.

  • Hi all,

    Nice article. hought i’d give it a try. just a note, should it now be

    chmod +x ~/talk.sh

    rather than cmod +x ~/tts.sh?

    Great site – much love and goodnight!

  • QuikSilver75 2 years ago

    I am not able to get it to work on BT5. I keep getting
    Linux: can’t open /dev/dsp
    When I tried to install festival it said it was already installed. Not sure what to do next since I am fairly new to linux

  • QuikSilver75 2 years ago

    Here are the errors I get after using the code that I missed in the printed portion of this page. What can I do from this point?

    root@bt:~# echo ”
    > (Parameter.set ‘Audio_Command “aplay -q -c 1 -t raw -f s16 -r $SR $FILE”)
    > (Parameter.set ‘Audio_Method ‘Audio_Command)
    > “>>~/.festivalrc
    root@bt:~# festival
    SIOD ERROR: unbound variable : aplay
    closing a file left open: /root/.festivalrc
    closing a file left open: /usr/share/festival/init.scm
    festival: fatal error exiting.

  • QuikSilver75 2 years ago

    printf “;use ALSA\n(Parameter.set ‘Audio_Method ‘Audio_Command)\n(Parameter.set ‘Audio_Command \”aplay -q -c 1 -t raw -f s16 -r \$SR \$FILE\”)\n” > ~/.festivalrc

    Ok, I got it to work using the code above…I think the forward slash was misssing in the code on this page…or I did something else wrong…but the above code worked so I can move forward..thanks guys.

    I got the commands from: http://ubuntuforums.org/showthread.php?t=1190751

  • QuikSilver75 2 years ago

    Ok new prob when creating the shortcut. I am using backtrack so the default user is root. I am trying to set the shortcut but I am not sure what to put in the command field. I tried /root/talk.sh and other variations but no luck here is how my files look:

    root@bt:~# ls
    Desktop Downloads talk.sh test2
    root@bt:~#

    What else can I try?