First we would need to install festival. We can install festival with the following command :
sudo apt-get install festival
Now we need to install voices which would be used to dictate the text (install any one of the following ) :
To install British Accented male voice issue the following command :
sudo apt-get install festvox-rablpc16k
To install American Accented male voice issue the following command:
sudo apt-get install festival festvox-kallpc16k
Now once you have installed festival and voice package we are ready to convert text files .wav files .
Lets say you want computer to read file named kaddu.txt you would need to pipe(send output of one command to other ) the cat command to festival. You can do so by issuing the following command :
cat -A kaddu.txt | festival --ttsNow instead if you want to convert kaddu.txt to kaddu.wav you can do so by piping the output of cat to a tool that comes with festival text2wave. You can do so by issuing the following command in the terminal window :
cat -A kaddu.txt | text2wave -o kaddu.wavNow however if you want to remove special characters and want festival/text2wav to read only a to z,A to Z, space, “,”,”.”,”!”,”?”. You can do so by piping the output of cat to sed and then piping the output of sed to text2wav/festival.
cat kaddu.txt |sed 's/[^a-zA-Z .,!?]//g'|festival --tts
cat kaddu.txt|sed 's/[^a-zA-Z .,!?]//g'|text2wave -o kaddu.wavNow the (.wav) file produced is uncompressed and are huge in size so you might like to convert it to mp3 to reduce it's size and to allow the files to be played on iPod or any other mp3 player. You can convert .wav files easily to (.mp3) file format by using lame .
To install lame issue the following command in the terminal window :
sudo apt-get install lameafter istallation is over to convert say kaddu.wav to kaddu.mp3 issue the following command :
lame -f kaddu.wav kaddu.mp3NOTE : I am using -f switch here which basically encodes mp3 file faster and in lower quality .
Article Written by : Ambuj Varshney (firstname.lastname@example.org)
For Desktop on Linux Blog , http://linuxondesktop.blogspot.com
(C) 2008 , Ambuj Varshney