Who doesn’t want a talking computer?
Linux is great for accessibility. Whether you need a text-to-speech (TTS) system to help you with daily computer tasks or you’re an experimental musician looking to incorporate robot voices into your songs, Linux has got your back. While there are a number of TTS programs for Linux, the one we’re going to discuss now is called Festival.
Festival is free software written in C++. It is a multilingual TTS system and framework developed by The Centre for Speech Technology Research at the University of Edinburgh. To hear Festival in action before installing it, go check out the online demo.
Festival is available from most mainstream Linux repositories. Search for “festival” and install the core program as well as any voices you may want, which will also come up in your search.
If it isn’t in your repository, you can download the tar file from its download page. Festival will run on any Unix-like system, including Windows with Cygwin installed.
Festival is a command-line program, though it can also be used as a TTS backend for other applications. To open up an interactive prompt, simply type
The command to make it talk follows the format:
(SayText "Hello, world!")
I added the punctuation for show, but unfortunately, Festival voices don’t recognize punctuation. If you type in several sentences in the same prompt, Festival will read them as a run-on sentence. You can always record the output and edit it in an audio editor though.
To see all the voices available in your Festival installation, type:
And to switch to a different voice, type the name of the voice in parentheses. For example:
Note that the example above assumes you also have mbrola voices installed. If you don’t, then the mbrola voices won’t be available to Festival. Some people like the mbrola voices better, so I would recommend installing them.
Festival can read text files too. Just enter this in your command line, without entering the interactive prompt (note: you can quit the interactive prompt with the command
festival --tts [file]
You can produce an audio file directly from festival. Again, we don’t enter the interactive prompt in this scenario. Rather, we use a tool that comes packaged with Festival called text2wave. Run it like so:
text2wave document.txt -o audiobook.wav
This is great for creating audiobooks or podcasts.
Here’s one last trick:
Get an SSH client for your smartphone, such as the ConnectBot for Android. Next time a friend uses your computer, go into the other room, SSH into your system, and run Festival to start a conversation with your friend. Fun times will be had by all!