Mac speech recognition software - How to create custom commands

Mac speech recognition software FAQ: Can I add my own commands to the Mac speech recognition software system, and if so, how?

While the built-in Mac speech recognition software doesn't recognize voices nearly as well as Sphinx-4, it does have one virtue: You can add custom commands to it fairly easily, as long as you don't mind writing a little AppleScript.

The short story is that if you go to this folder:

/Users/Al/Library/Speech/Speakable Items

on your computer system (replacing "Al" with your home directory name), you'll find a folder with a number of Mac plist files and a few AppleScript files. You'll also find a subdirectory named "Application Speakable Items" that has folders named after some of the Mac applications installed on your system, including Finder, Mail, Safari, Internet Explorer(?), and possibly others.

Creating custom Mac speech recognition software commands

I don't have enough time to give you all the details of creating your own custom Mac speech recognition software commands today, but as a quick example, just follow these steps:

  1. Create an AppleScript script named "Say Hello.scpt". (Make sure you keep that space in there.)
  2. Place that AppleScript file in the "Speakable Items" folder.
  3. Start the Mac speech recognition software.
  4. Press the [Esc] key (your voice activation key) and say "Say hello" to your computer.
  5. The computer should respond by doing whatever AppleScript action you defined in your "Say Hello.scpt" file.

As a very simple example, your AppleScript file can contain this one-line:

say "Hello, user"

So when you say "Say hello" to your computer, it will speak back the words "Hello, user" in whatever your default system voice is.

Mac speech recognition software - custom command notes

I'll come back and update this article within a few days, but if you're interested in working with the Mac speech recognition software asap, there are a few important things to know:

  1. Any script you put in the root directory will work as a voice command regardless of what application you're using.
  2. If you put a script in a subdirectory like "Google Chrome", that voice command will only work when Google Chrome is your foreground application.
  3. As you saw in the example above, the phrase you say must match the name of your AppleScript file. In my example the file was named "Say Hello.scpt", so the computer knew to execute that AppleScript when it heard the words "Say hello".