Using Festival TTS on OS X
This is a quick guide on compiling and installing the Festival Text-to-Speech Package on OS X. This was somewhat of a gigantic pain, but eventually, seemed to work fine. The below is a collection
This tutorial assumes you have MacPorts installed from http://www.macports.org/ and can use the
- Festival and friends seem to work best on a Mac when compiled from the latest sources, obtained from SVN
1a. To install SVN:
sudo port install subversion
1b. Make a directory in your home folder called “tts”:
1c. Move into that folder:
1d. Checkout the latest versions:
svn checkout http://svn.berlios.de/svnroot/repos/festlang/trunk
1e. Copy the “festival”, “speech_tools” and “festvox” folders into the ~/tts folder, using the finder or otherwise.
- According to this site, you’ll need to open speech_tools/include/EST_math.h and change:
/* Apple OSX */ #if defined(__APPLE__) #define isnanf(X) isnan(X) #define isnan(X) __isnan(X) #endif
/* Apple OSX */ #if defined(__APPLE__) #define isnanf(X) isnan(X) #if (__GNUC__ >= 4) #define isnan(X) __inline_isnan(X) #else #define isnan(X) __isnan(X) #endif #endif
Now compile speech tools:
Now compile Festival:
Now compile festvox
Now ready OS X’s audio for this. This next part is stolen (and updated slightly) from this site. First, open up Xcode (you do have the Developer Tools installed don’t you?):
File -> Open... /Developer/Examples/CoreAudio/Services/AudioFileTools/AudioFileTools.xcodeproj
Then build the project.
Open up a terminal:
sudo mv /Developer/Examples/CoreAudio/Services/AudioFileTools/build/Debug-Tiger/afplay /usr/bin/
sudo chown root:wheel /usr/bin/afplay
If you find yourself missing any of the above files, download a precompiled version of afplay and copy it to /usr/bin/afplay as described above.
Open ~/tts/festival/lib/siteinit.scm and add the following:
(Parameter.set ‘Audio_Required_Format ‘riff)
(Parameter.set ‘Audio_Command “afplay $FILE”)
(Parameter.set ‘Audio_Method ‘Audio_Command)
If the file doesn’t exist, create it as a plaintext file such that it contains only the above lines.
- Go to this website and download:
Then drag the folder inside the festival/lib/dicts folder in that file into ~/tts/festival/lib/dict (create the folder if it doesn’t exist yet)
Then drag the festival/lib/voices into ~/tts/festival/lib/ on your machine.
Open ~/.profile and add the following lines:
Don’t bother with the “prompt them” script for recording. It’s a gigantic pain. Instead, do any recordings in Audacity. Then, for instance, if you’re recording files for a clock, split the recorded prompts into “time0001.wav”, “time0002.wav”, etc. If you want to attempt “prompt them”, you’ll need to install sox (sudo port install sox) then change any calls to
playand the na_record line with
rec wav/$f.wav trim 0 $duration(Thanks to this post).
From there, run whatever tutorial you’d like, you should be good to go. Also, sorry, but I can’t really support this method. Please don’t email me or comment looking for additional tech support information about this.
Enjoy! (and sorry for the exceptionally dry post, but this is a useful bit of information to have out there :))
Have a question, comment, or concern about this post? Contact me!