Speech synthesis on the OS X command line

The problem was this: My computer would do some heavy lifting (like importing a couple M records into a MySQL database), and I would sit over at another desk (with BastianQ) doing something else.

Now, I got tired of walking over to my machine every five minutes to see if it was done yet. So I wasted a few minutes trying to figure out how to make the Mac beep after it’s finished its command line job, but neither beep nor alert nor sound nor anything else I could think of worked, so I gave up.

A much neater solution came along today, through this Mac Geekery post:

wc -l imdb.nt ; say "ok, what's next?"

The first part is the long-running command. The second part is just coolness.

Apple has announced that the next version of OS X will have much improved speech synthesis. That’s too bad, I dig this weird female robot voice. (In case your computer can play .aiff files: ok.aiff)

(In related geekness, I spent a tenth of a second wondering if say "ok, what's next?" > ok.aiff would work. It should! Turns out not even Unix is perfect.)

2 Responses to “Speech synthesis on the OS X command line”

  1. Tom Anderson Says:

    It turns out that unix is perfect: the > symbol just redirects standard output from the terminal to a file. So it should make an empty file.

    If you want to send the output an aiff file use:

    say “plugh” -o plugh.aiff

    you can see this an more with

    man say

  2. Tom Anderson Says:

    Oops that should have been:

    say -o plugh.aiff “plugh”

Leave a Reply