Tell your Mac to say “Anything” (and record it)

I don’t quite have the voice acting skills that people care to listen to on a pre-recorded message, so I was faced with a challenge when I decided I wanted one for our hosted virtual phone system over at PhoneBooth. I had a vague recollection that Apple provided recordable speech synthesis / text-to-speech (TTS) capabilities in the command line, so I went searching. Bingo. The app is called say.

This tutorial will show you how to use a Mac’s TTS capabilities to record text to an audio file, and then convert it to an MP3 for use with PhoneBooth, or any other application you might want to use.

Try this out from the command line (open Applications > Utilities > Terminal )

To save it to a file:

Or to read the text from a file,

PhoneBooth requires either wave or mp3 for its auto attendant scripts (e.g., “Press 1 for sales, 2 for billing,” etc.). Some voices support exports to wave (see the say documentation: man say), but the default in 10.6 doesn’t seem to – it creates an audio file, but produces no sound. The next step involves using lame to convert the file to a mono mp3. You will need to install lame using Fink or Mac Ports first. If you don’t have lame installed you can also use iTunes to do the conversion for you, but your tutorial more or less stops here without lame.

Finally, upload greetings.mp3 to PhoneBooth. Finished. For the curious, the -m m option tells lame to encode the mp3 to mono.

For the super-efficient folks out there, put it all into one line (and open when finished):

NB: If you wish to make your spoken text flow more naturally you can add [[slnc 300]] between sentences, increasing or decreasing the number for longer or shorter pauses. Apple has much more detailed documentation for the brave.




No Comments


You can leave the first : )



Leave a Reply