Colin Charles Agenda

Making your Mac speak from the command line

The xkcd comic I’m an idiot has some context to this (no, I wasn’t locked out or anything).

It seems like one can do wonders within the command line in Mac OS X. For example, to mute the volume, you do: osascript -e "set Volume 0". Similarly, to make the volume the loudest, you can do: osascript -e "set Volume 10".

Then you know, in OS X there is also a magic say(1) command. It converts text to audible speech, and you can even specify the voice. Something as simple as say "Hello World" will use the system voice to execute.

One can imagine this being useful. Now, I know there’s another variation (from a little searching) to changing the volume: doing osascript -e "set volume output volume 100" makes the volume as loud as possible. Note that if you do it this way, it ranges from 0-100. The method two paragraphs ago, is 0-10. Weird?