Friday, February 22, 2013

Change Text-To-Speech By Using Automator

Mac OS X has a nice feature: Text-To-Speech. You can select a text and let Mac OS to read the text. Since OS X 10.8, Apple added Chinese speech support. For me, English and Chinese are two voices I used most of time. This can be set in System Preferences->Dictation & Speech, where a default voice can be set.

One thing bothers me is that it is so inconvenient to switch between voices. What I would like is a convenient way, such as short-cut-keys, to make change of voices. For me, I would like to switch between Alex to read English and Ting-Ting for Chinese quickly.

Finally, I found a way to do it. It is actually very easy to do it. This can be done by using Automator. Here are steps.

First, launch Automator from Spotlight (pressing command+space, and type Automator). Select Service  type documentation.

Create Services

Within workflow, only two items are needed: Service receives selected text, and Speak Text:

Save the service as "SpeechByAlex".

Repeat the same step to create another service with Ting-Ting as voice, and save it as "SpeechByTingTing".

Note: the services are saved in the local user's Library->Services folder.

Define Shortcut Keys

The next step is to define shortcut keys for those two services.

Open System Preferences->Keyboard. Select Keyboard Shortcuts tab. On the left panel, select Services. Find two services under Text group.

I used Control+Shift+Command+A for Alex, and Control+Shift+Command+T for Ting-Ting.

No comments: