A fun article today on how to use OSX speech command with the command line.

Speak

You can have your system say a sentence by using:

1
$ say Hello World. My Name is Jonathan.

Specify a voice

Your mac ships with a few voices, use -v to specify a voice.

Example:

1
$ say -v Karen Hello World

List of voices: Alex, Bruce, Fred, Kathy, Vicky, Victoria, Daniel, Tessa, Fiona, Moira, Veena, Karen.

Specify a file

You can use -f to specify the path to a file to read.

1
$ say -f ~/testvoice.txt

You can also pipe the content of the file into the say command:

1
$ cat ~/testvoice.txt | say

If are looking for text to fill in your text file, checkout http://fucklorem.com/.

Output the speech to a file

Use the -o flag to output the

1
say -o /Users/klugjo/outputvoice.m4a Hello World

Combine it all together

1
$ say -v Fiona -f ~/testvoice.txt -o outputvoice.m4a

Hope you had fun, not the most useful command but I had quite a bit of fun with it.

Check out more OS X commands here.