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

This entry was posted in General. Bookmark the permalink.

3 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”

  3. Thanks! I’m trying to use this to run meetings:

    say “Hello, and welcome to the meeting. We begin with announcements. 10 minutes. Begin”
    sleep 540
    say “9 minutes have passed”
    sleep 60
    say “ok, Time up”
    say “What’s next?”
    say “Items we will discuss for 5 minutes. Ready?”
    say “Item 1: Widget output. Yes, I can even read the agenda items to us. If I do that, it could help keep us on track…”

Comments are closed.