compiling festival lite on osx

Festival is a text-to-speech (TTS) system that was developed until 2005 by the Speech Group at Carnegie Mellon University It is a nifty little tool and the voice sounds like a robot. Jude and I have been working on our robot and will need some text to speech capability on our OpenWRT Asus WL-520gu. Of course, I also want to test things on my Mac and therefore I needed to complile the festival lite kit locally. This took some digging, but the mailing list archives turned up the answers.

First you will want to go to the website to see whats there:

http://www.speech.cs.cmu.edu/flite/

Then in a terminal grab the source:

wget http://www.speech.cs.cmu.edu/flite/packed/flite-1.3/flite-1.3-release.tar.gz

Unpack the source and go to the folder:

tar xvzf flite-1.3-release.tar.gz
rm flite-1.3-release.tar.gz
cd flite-1.3-release

Now here is the trick. The Apple sting.h file defines a method called swab which we don’t want. So lets cheat and make a copy of the string.h file in our local include folder:

cp /usr/include/string.h include/
chmod +w include/string.h

Now, comment out the offending line (for me this was line 137):

// void     swab(const void * __restrict, void * __restrict, ssize_t);

Then in your terminal, make:

make

At this point everything should build (assuming you have a good build chain). Then you can run flite:

bin/flite --help

Of course, some of the options are not going to work (namely, outputting to an OSX sound device). For me that is okay, I can just process it through lame and play it using madplay or mpg123:

bin/flite "Hello World" hello.wav; lame hello.wav; mpg123 hello.wav.mp3