Will Styler's Homepage
Will Styler

Associate Teaching Professor of Linguistics at UC San Diego

Director of UCSD's Computational Social Science Program

Using Festival TTS on OS X

This was originally posted on my blog, Notes from a Linguistic Mystic in 2011. See all posts

Note that this is probably very out of date, being from 2011, but I’ll leave it up in case it can help somebody!

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 port command.

  1. 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”: mkdir ~/tts

1c. Move into that folder: cd ~/tts

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.

  1. 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)  


/* Apple OSX */  
#if defined(__APPLE__)  
#define isnanf(X) isnan(X)  
#if (__GNUC__ >= 4)  
#define isnan(X) __inline_isnan(X)  
#define isnan(X) __isnan(X)  
  1. Now compile speech tools:
    cd ~/tts/speech_tools
    make test
    make install

  2. Now compile Festival:
    cd ~/tts/festival
    make install

  3. Now compile festvox
    cd ~/tts/festvox

  4. 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.

  1. 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.

  1. 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)

Also download:


Then drag the festival/lib/voices into ~/tts/festival/lib/ on your machine.

  1. Open ~/.profile and add the following lines:

    export PATH=/Users/stylerw/tts/festival/bin:/Users/stylerw/tts/speech_tools/bin:$PATH
    export ESTDIR=“/Users/stylerw/tts/speech_tools”
    export FESTVOXDIR=“/Users/stylerw/tts/festvox”

  2. 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 na_play with play and the na_record line with rec wav/$f.wav trim 0 $duration (Thanks to this post).

  3. 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 :))