Playing with OS/X Text To Speech

TL;DR – I built an app that exercises OS/X’s support for various spoken voices. You can run the packaged app here:

The .zip file will show up in your Downloads folder.  Click on  You will be asked if you want to run the application  Click “Yes”.

You should see a window that displays different voice names while the computer speaks in that voice:

Here’s how I went about building the above…

The OS/X default Terminal shell allows the user to invoke the text-to-speech interface via the “say” command.  If you don’t have Terminal active on your Mac, hold down the Command button while pressing the spacebar.  The Spotlight application should be visible.

In Spotlight, enter the word Terminal by itself.

Click the Terminal entry by the word Applications.  You should now be at a Terminal prompt that looks something like this:

At the prompt, enter the following line:

say -v Bell Hello, world!

You should hear a voice that sounds like a bell saying “Hello, world!”

To see a list of all voices supported by your system, enter the following line in the Terminal window:

say -v ? | more

You should see output that looks similar to the window below:

You may press the spacebar to scroll to the next window, or you can press the “Q” key to quit.

I wrote a quick AWK script to convert the output of the above into a bash script.  The AWK script is as follows:

$2=="en_US" {
   printf("echo %s\n",$1);
   printf("say -v %s \"",$1);
   for(i=4;i<NF;i++) {
      printf("%s ",$i);

$3=="en_US" {
   printf("echo %s %s\n",$1,$2);
   printf("say -v \"%s %s\" \"",$1,$2);
   for(i=5;i<NF;i++) {
      printf("%s ",$i);

After saving the above as say2sh.awk, I created a Bash shell script file by running the following command at the Terminal prompt:

say -v ? | awk -f say2sh.awk >

Then, I had to make executable with the following command:

chmod a+x

Finally, I was able to run the script using the command:


My version of looks like this:

echo Agnes
say -v Agnes "Isn't it nice to have a computer that will talk to you?"
echo Albert
say -v Albert "I have a frog in my throat. No, I mean a real frog!"
echo Alex
say -v Alex "Most people recognize me by my voice."
echo Bad News
say -v "Bad News" "The light you see at the end of the tunnel is the headlamp of a fast approaching train."
echo Bahh
say -v Bahh "Do not pull the wool over my eyes."
echo Bells
say -v Bells "Time flies when you are having fun."
echo Boing
say -v Boing "Spring has sprung, fall has fell, winter's here and it's colder than usual."
echo Bruce
say -v Bruce "I sure like being inside this fancy computer"
echo Bubbles
say -v Bubbles "Pull the plug! I'm drowning!"
echo Cellos
say -v Cellos "Doo da doo da dum dee dee doodly doo dum dum dum doo da doo da doo da doo da doo da doo da doo"
echo Deranged
say -v Deranged "I need to go on a really long vacation."
echo Fred
say -v Fred "I sure like being inside this fancy computer"
echo Good News
say -v "Good News" "Congratulations you just won the sweepstakes and you don't have to pay income tax again."
echo Hysterical
say -v Hysterical "Please stop tickling me!"
echo Junior
say -v Junior "My favorite food is pizza."
echo Kathy
say -v Kathy "Isn't it nice to have a computer that will talk to you?"
echo Pipe Organ
say -v "Pipe Organ" "We must rejoice in this morbid voice."
echo Princess
say -v Princess "When I grow up I'm going to be a scientist."
echo Ralph
say -v Ralph "The sum of the squares of the legs of a right triangle is equal to the square of the hypotenuse."
echo Trinoids
say -v Trinoids "We cannot communicate with these carbon units."
echo Vicki
say -v Vicki "Isn't it nice to have a computer that will talk to you?"
echo Victoria
say -v Victoria "Isn't it nice to have a computer that will talk to you?"
echo Whisper
say -v Whisper "Pssssst, hey you, Yeah you, Who do ya think I'm talking to, the mouse?"
echo Zarvox
say -v Zarvox "That looks like a peaceful planet."

After playing with the script, I packaged the file as an application using Platypus. I then zipped up the resulting .app file with the command:

zip -r

…and staged the .zip file on my web site above.

Please note that I’m not used to distributing Mac apps, yet, so please let me know if you have difficulty running the app. I chose the .zip format because it seemed to be the most simple option available.


About Jim Lawless

I've been programming computers for about 36 years ... 30 of that professionally. I've been a teacher, I've worked as a consultant, and have written articles here and there for publications like Dr. Dobbs Journal, The C/C++ Users Journal, Nuts and Volts, and others.
This entry was posted in Technology and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s