Monday, September 17, 2012

Introducing Anna!

So over the summer I was making the rounds doing a presentation on how to bring Speech Recognition to Android. As part of this work I put together a sample application that uses PhoneGap for the user interface and makes calls to plugins for speech recognition and text to speech functionality. The full source code has been available for quite awhile but I decided to publish the compiled .apk in the Play store as a free application.  Now, there is less of an impediment to folks checking it out.

Basically the application allows you to ask a question using natural language and get an answer. The internal workings of the application are pretty simple. First an intent is fired off to recognize speech. This brings up the Google Voice recognition dialog. Once the speech is completed it returns a text representation of what it thought it heard. I then turn around and ask Wolfram Alpha to answer the question. Once I get a result from Wolfram I display the result and have the app read the answer by using text to speech. Check out a couple examples on the right.
Since the Wolfram Alpha API is only free up 2000 requests per month I couldn't provide an API key with the application. If you want a result other than "I'm sorry I didn't understand" you'll need to register for an API key. The app will detect if you don't have an API key setup in the preferences and guide you in setting it up. I know it is an inconvenience but we'll have to live with it for now.

In addition if you don't want the answer to be read out to you in text to speech you can tell the app not to use TTS.

My next steps in this fun little side project is to start reading the device contacts to make it easier for folks to send emails or SMS via their own voice. Looking past that I'm going to make the application location aware. That's why those permissions are included in the app right now even though they are not used.

The app is intended to be a teaching tool and an example of how to do a host of things using the PhoneGap API. PhoneGap plugins that used in this application include:
The icons are courtesy of the Noun Project and the Speech Bubbles are from Nicolas Gallagher.

Also, if you want to add any features to this app yourself then fork my repo and start sending me pull requests. 

2 comments:

Unknown said...

Hi Simon,
When Text to Speech plugin will be available for IOS and other Platform.
Right now this plugin is only for Android platform

Simon MacDonald said...

@Rahul Gharat

I don't know. I don't have plans to write on at this moment.