Use of say command in MAC
This is a fun one: say
converts text to speech, using the same TTS engine OS X uses for VoiceOver. Without any options, say
will simply speak whatever text you give it out loud.
$ say "Never trust a computer you can't lift."
You can also use say
to speak the contents of a text file with the -f
flag, and you can store the resulting audio clip with the -o
flag:
$ say -f mynovel.txt -o myaudiobook.aiff
The say
command can be useful in place of console logging or alert sounds in scripts. For instance, you can set up an Automator or Hazel script to do batch file processing and then announce the task’s completion with say
.
But the most enjoyable use for say
is rather more sinister: if you have ssh
access to a friend or coworker’s Mac, you can silently log into their machine and haunt them through the command line. Give ‘em a Siri-ous surprise.
You can set the voice (and language!) used by say
by changing the default setting in the Dictation & Speech panel in System Preferences.