• 22
  • Dec

If you are like me, and have a slight case of attention deficit disorder, you do not like to read for long periods of time. Text to speech can be a god send. By using Festival, we can easily convert text files to wav format with one command.

Text2Wav

If you haven’t already, check out the Transform Linux into a Talking Companion post to learn how to install and use Festival.

Included in Festival is a command called text2wav. The output of cat can be redirected into text2wave to produce TTS wav files.

How to convert text files to wav files with text2wave:

  1. Copy and paste the chosen text into a new text file. Name it something simple like tts.txt
  2. Next, open a terminal and cd into the directory that you have save the tts.txt file to
  3. Now, type the follwing command to convert the text to wav format — cat tts.txt | text2wave -o tts.wav
  4. If all went well, you should have a new file in the same directory called tts.wav. Congratulations, you just converted your first text file to wav using Festival!

Since wav files are huge, you may want to consider using lame to convert to MP3 if you plan on keeping or sharing your TTS audio files. You will need to install it and the command is very simple — lame tts.wav tts.mp3

I hope you find this as useful as I do. Forget about buying the audio book next time; if you can find the ebook, just make your own.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
  • 24
  • Nov

TTSText-to-speech is really convenient, especially when you are lazy like me. Festival enables us to achieve a TTS system with limitless possibilities thanks to our Linux bash shell. I will show you some ways that we can use Festival as an enabler to our laziness and also produce some really cool and useful effects when coupling this technology with common things like PHP, cron, dnotify, or login scripts.

Remember the movie 2001: A Space Odyssey? I’d like to think that I am Dave, I just hope that my PC doesn’t turn on me (Although, I think it has in the past).

Credit were credit is due - some ideas from xenocafe.com and linuxgazette.net.

image via link
 

Installation

You need to install Festival. su root if need be.

Ubuntu:

sudo apt-get install festival festvox-kallpc16k

festvox-kallpc16k is the male american voice. Ubuntu doesn’t install a voice unless you specify which will cause the program to crash. Look in synaptic for other voices and language support.

Fedora - CentOS - Redhat:

yum install festival

openSUSE:

yast -i festival

The Basics

Now that we have Festival installed, lets start with the basics.

Make Festival say something:

echo “My talking Linux PC efin rocks” | festival --tts

Make Festival read a text file:

cat -A file.txt | festival --tts

Make Festival say the time:

date ‘+%I, %M %p’ | festival --tts

Read the rest of this entry …