Those in the Flash community when looking to solve a technological problem come up with a singular solution. We’ll bang it, slam it, heat it, cool it, bend it, trim it, do whatever we can to hack something into formation in the pursuit of providing a working solution to the problem. Often-times this may even work.
One thing many forget is the numerous technologies out there that can help us. When you become overly-familiar with Flash, you tend to keep with what you know. Sometimes this can end up costing you a lot of coding effort, a ton of debugging, and perhaps less-than-optimal results.
Recently I was working with text-to-speech and also looking for a voice recognition library. I wanted to make my own version of 2001’s HAL. It was a fun project. Well, I found some AS3 libraries online to handle the text-to-speech, but I ended up using a cloud service. It offered me the flexibility of choosing from about twenty voices, many localized if I ever decided to go that way. Connection to the cloud was AS3, but I only had to write about 15 lines of code to support it.
Now, the voice recognition thing had me spinning my wheels for quite some time. It made me nervous, made me queasy, had me studying audio patterns, and upped my caffeine intake. All the while overlooking a simple, already present technology on my machine.
Apple has provided Speakable Items with it’s operating system for a long while now. I used to play around with it by navigating web pages with my headset. I almost forgot all about it. It’s text to speech is passable, but the cloud service I found kicks the shit out of it pretty handily. It’s voice recognition service is actually quite good. I didn’t exactly know how it worked, but I knew that I could add an application to Speakable Items by asking it to add the application to the list while it had focus. For instance, “Make this speakable.”
Digging around online and through my Library, I discovered many cool things about how the service works. And it’s now driving my voice recognition/tts system (which resides in Flash by the way). How is it done? It’s not nearly as hard as you might think.
I’m looking for the same solution. Can you please tell me details of what you did so I can try it? Thanks
Go here /Users//Library/Speech
Now under Speakable Items you’ll see another folder called Application Speakable Items. Add a folder called “Flash Player” – now when the Flash Player has focus in the OS, speakable commands will look in this folder for file names matching the command you give. For instance “date”. Make your date file an applescript…
tell application “System Events”
keystroke “4”
end tell
That’s it. Now when Flash Player has focus & you have Speakable Items on, your “date” command to the OS will run the applescript and send the keystroke to the Flash Player… and then you use the key listener to do what you will with it.