Advertisement
  1. Computer Skills
  2. OS X
Computers

Control a Mac With Siri-Like Voice Commands

by
Difficulty:IntermediateLength:ShortLanguages:

While Siri hasn’t yet made its way to the Mac, it’s still possible to replicate some of the functionality provided by Apple’s digital personal assistant with tools available in OS X. 

In this tutorial, I’ll show you how to recreate some of Siri’s magic using custom Dictation Commands, available within Automator in OS X 10.10 Yosemite

Screencast

Configuring Dictation

The basis of our faux-Siri will be the Dictation feature that is baked right into OS X. To configure Dictation, first launch System Preferences and navigate to the Dictation & Speech preference pane. 

Once in the Dictation pane, you’ll want to switch the Dictation option to On. That will enable only the most basic Dictation features available in OS X; notably, the ability to dictate text using your voice into any text field. While useful, that won’t get you very much closer to your goal of replicating some of Siri’s functionality. 

You can configure the basics of Dictation within System Preferences
You can configure the basics of Dictation within System Preferences

To do that, you’ll need to check the box labelled Use Enhanced Dictation, this enables many advanced features including offline use, continuous dictation with live feedback, and the ability to use the voice of Siri. 

It does, however, come at a cost: around 800MB of disk space. For users with large traditional hard drives, this shouldn’t be a problem, but if you rely on an SSD with limited space, you might want to think twice.

With Enhanced Dictation enabled, you can now move onto determining the shortcut that will launch the Dictation window. By default, Press Fn (Function) Key Twice is selected, although you can change this by selecting a preset, or an entirely custom shortcut, from the dropdown menu.

The final step in configuring the Dictation and Speech preference pane is to choose the microphone. For best results, you should opt for an external microphone, such as the one built into Apple’s own EarPod headphones. If that’s not possible, ensure the Mac is in a quiet room so that your voice can be picked up clearly.

Basics of Dictation Commands

Now that the system has been properly configured to use Dictation, you can create your first custom Dictation Command workflow. This is done by opening the Automator application and selecting Dictation Command as the document type. 

Note: Before you move on, it’s a good idea to have a basic understanding of how Automator workflows are made. Luckily, Tuts+ has a tutorial on Automator Workflows

If you’re familiar with Automator, you might expect a space near the top of the document window to define which file types can be accepted as input for your workflow. That’s not the case with Dictation Commands, however, as they don’t accept any input. 

This is a blessing and a curse. On the one hand, this means that Dictation Commands can be triggered at any time, from anywhere. On the other, that necessarily limits the scope of what Dictation Commands can do. It’s not possible to modify a file that has been selected in Finder, for example.

In place of an option to define accepted file input types, Dictation Commands include a space to set the phrase that will activate the workflow, titled Dictation Command:, this can be any phrase that you like. For example, my sample workflow is going to play my favorite album in iTunes to I could set that field to “Play my favorite album”

Below that option is a checkbox labelled Command Enabled, check this when you want to begin using your workflow, otherwise, the Mac won’t recognize the trigger phrase you just established.

Defining Siri’s Response

One of Siri’s headline features is her ability to respond to your commands with a witty rebuttal. You can simulate this functionality using workflow actions already built into Automator

To do so, drag the Get Specified Text action from the action library on the lefthand side of the Automator window into the workflow. Within this multi-line text field, you can define the text you would like your faux-Siri to respond with when your command is activated. 

The Get Specified Text and Speak Text actions enable your Mac to talk back
The "Get Specified Text" and "Speak Text" actions enable your Mac to talk back

Next, drag the Speak Text action into your workflow. This action will speak whatever text that was previously defined in the Get Specified Text action. By default, the text will be spoken in the Alex voice, one that has been a part of OS X since 2007. 

Text-to-speech technology has advanced quite a bit since then, so Alex sounds almost comically bad. You can switch Alex out for the voice of Siri by selecting Samantha from the Voice dropdown menu. 

You can preview what your predefined response will sound like by pressing Run in the application’s toolbar. 

At this point, you can define the rest of the workflow to fit your needs. As mentioned earlier, just about every other kind of workflow, except for those with file input functionality, can be repurposed as Dictation Commands.

Enabling Dictation Commands

Now that you have created a dictation command or two, you can enable them by navigating to Accessibility from the System Preferences application. Within Accessibility, navigate to the bottom of the list of options on the lefthand side, choose Dictation, and finally, click Dictation Commands…

Next, check the box at the bottom of the window labelled Enable advanced commands, this will allow the Dictation window to be brought up from anywhere within OS X. 

You can selectively enable and disable Dictation Commands by checking and unchecking the box next to each one, respectively. In addition to the commands created in Automator, OS X has dozens of powerful commands built in, including:

  • Switch to: brings a currently open application to the forefront
  • Search Spotlight for: search for anything that can be indexed by Spotlight
  • Stop listening: closes the Dictation window
  • Show commands: shows a list of all commands, including those defined by you
The Accessibility window allows you to enable advanced commands
The Accessibility window allows you to enable advanced commands

Once you’ve determined which commands you would like to enable, press Done and exit System Preferences

To test the new Dictation Commands, hit the keystroke you defined in the Dictation & Speech pane (by default, this is Press Fn (Function) Key Twice) and begin speaking. 

Conclusion

While one or two Dictation Commands won’t come close to matching the breadth or depth of Siri’s functionality, it’s possible to use them to create a custom-tailored version of Apple’s popular digital personal assistant. 

With any luck, Apple will introduce Siri on the Mac in the near future, but in the meantime, Dictation Commands serve as an interesting look at things to come. Let me know, in the comments below, how are you using Diction Commands.

Advertisement
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.