Text to Speech in Mac OS X

This tip was written by 11 year old Alex Hwang. Be sure to check out his blog, as he's recently posted an application that allows you to customise your Dock without having to play around with Terminal commands...

Since Mac OS X 10.4 Tiger, the amazing operating system has included many built in things. One of the many great things included with Mac OS X is called TTS (text to speech). I'll be covering an easy way to dive into text to speech. All you have to do is fire up Terminal.app (/Applications/Utilities/Terminal.app) and type in:

say 'text to say with no quotes'

So if you type in:

say Hello World

And hit return, then (as long as your speakers are turned on) your computer will 'say' hello world to you! A more advanced way to do this is to type in:

osascript -e 'say "some text" using "some voice"'

Terminal Text to Speech

You can check the voices your system has in System Preferences in the Speech pane under the Text to Speech tab. You might have to select “Show more voices” at the bottom to get the full list.

[Matt adds: For any Cocoa application (Safari, TextEdit, etc.) there is a "Start Speaking Text" option under the Services menu (in the Application menu) that will speak your selection in the currently selected system voice. Great if you want a web page or long piece of text read to you. You can even assign a keyboard shortcut to it in the "Keyboard and Mouse" section of System Preferences. Also, since Leopard, Apple has added a new voice, Alex, which is much more realistic than the usual "robot" sounding voices that are available.]

Speech System Preferences

blog comments powered by Disqus