I am started programming sl4a (in QPython) and it is really great. Now I tried to use the droid.recognizeSpeech function. This one works fine too, but I like to get it in the background listening for a keyword, like Google's 'OK Google'. So I looked around, but cannot find anything. I don't know how I can implement it. So I ask you, can someone tell me, if it is possible, how to make recognize speech always listening in the background waiting for a keyword?
-
You need to decompose this task. First try to implement the listener for the keyword with [PocketsphinxAndroid](http://cmusphinx.sourceforge.net/wiki/tutorialandroid) in Java. Second, implement call required java code from sl4a. You can run keyword search in a service and only get detection notifications with intent messaging. – Nikolay Shmyrev Jun 18 '14 at 10:51
-
Ok, is if I combine java and sl4a. But I am looking for a solution for sl4a only. – Tom Hans Jun 18 '14 at 10:54
1 Answers
I've toyed with the idea of doing this, but never found any useful practical application for it. So here's a summary of my research, I hope it's enough to get you started: 1. The Speech Recognizer facade has multiple parameters. Usually, everyone puts "none" in all of them except the first. Here's the facade in it's actuality:
recognizeSpeech:
Recognizes user's speech and returns the most likely result. prompt (String) text prompt to show to the user when asking them to speak (optional)
language (String) language override to inform the recognizer that it should expect speech in a language different than the one set in the java.util.Locale.getDefault() (optional)
languageModel (String) informs the recognizer which speech model to prefer (see android.speech.RecognizeIntent) (optional)
returns: (String) An empty string in case the speech cannot be recognized.
So you're looking for the languageModel in this case, that option is restricted to two types. A web search model and a free-form speech model. You're looking for the free-form speech model in this case. Here's a little more info on this model from the horse's mouth: Google on the Free-Form Language Model
Once you've looked at the free-form speech model, what should help you is Chrome's continuous speech recognition model, which should share a lot of the same characteristics of the Free-Form language model. Hope this helps set you on the right direction

- 21
- 3