I was working on a mobile app for both android and iOS using titanium. Found two interesting things. Apple does not allow developer community access to SIRI and my phones do not have SIRI (iPhone 4). But I want my app to be voice enabled. How can I do this ? Is this even possible?
Answer is Yes. its possible. Here is my approach. If there is any interest I can share the code.
My requirement:
In my case i want get the user input via Voice like numbers.
Voice Synthesis (Talk your text to user)
Voice Recognition
Error Handling
Answer is Yes. its possible. Here is my approach. If there is any interest I can share the code.
My requirement:
- App should be able to talk to user
- User should be able to respond specific commands by voice.
- App should be able to respond with action or error voice.
In my case i want get the user input via Voice like numbers.
Voice Synthesis (Talk your text to user)
- I wanted the app to ask the user for inputs. Keeping it dynamic.
- I used google to synthesize the voice
- http://translate.google.com/translate_tts?tl=en&q=text”
- You send the question in text field of the above url, you will recieve a wav file back.
- Use Ti.Media to play back the way file. Note: Ti.Media does not work for android. Need to use third party module.
Voice Recognition
- Use Ti.Media to get the input from speaker from user. Note: Android will have to use a thrid party module.
- Record the wav file. I recorded it as 8KHz file to keep the wav file small.
- Send to to a conversion service online. There are many services available online to accomplish this task.
- I used this site http://api.ispeech.org/api/json which converts the voice to text.
Error Handling
- When the text is returned from recognition call. My call back will analyse if the data recieved is relevent. There is confidence level also returned. Based on confidence level and data recieved, I make decision to use the text or play back a custom error message.
- For example: I ask to enter numbers. The translated text has alpha, then i play back a message that i expected only numbers.
Observation was that over 3G the recognition service was slow. On LTE and WiFi it worked almost like SIRI. But I used a non paid service. Using google translate and voice you can have the app speak different languages too. I tried using the codebox module for android got stuck, now am writing my own.
Any thoughts welcome.
No comments:
Post a Comment