Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I keep the speech recognizer listening indefinitely?

Tags:

When I call the startListening method of a SpeechRecognizer object, the speech recognizer starts listening for speech. I would like to create a service that is waiting for speech of a specific keyword: when the user says this keyword and the speech recognizer detects this keyword, then the service becomes ready to receive user voice commands.

To this end, after a new SpeechRecognizer instantiated, I should call its startListening method: can I keep the speech recognizer listening indefinitely?

like image 421
enzom83 Avatar asked Apr 16 '12 23:04

enzom83


People also ask

What is continuous voice recognition?

Continuous speech recognition systems allow the user to talk to the system without stops and pauses. Continuous speech recognition systems can recognize more utterances than a command-and-control system. The guidelines for continuous speech recognition differ somewhat from those for command-and-control.

How do I use Google speech recognition offline?

Android does have offline speech recognition capabilities. You can activate this by going to Settings - Language and Input - Voice Input and touch the cog icon next to Enhanced Google Services.

Is speech recognition a solved problem?

In the last several years, researchers have made significant progress on this problem, but general speech recognition still has not been solved yet for any language. And that's because speech recognition is hard.

Is speech recognition difficult?

Even with good phoneme recognition, it is still hard to recognize speech. This is because the word boundaries are not defined beforehand. This causes problems while differentiating phonetically similar sentences. A classic example for such sentences are "Let's wreck a nice beach" and "Let's recognize speech".


2 Answers

The Android Speech recognizer can be customized through the intent extra data. See the android documentation.

public static final String EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS

The amount of time that it should take after we stop hearing speech to consider the input complete. [...]

public static final String EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS Since: API Level 8

The minimum length of an utterance. We will not stop recording before this amount of time. [...]

public static final String EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS

The amount of time that it should take after we stop hearing speech to consider the input possibly complete. [...]

Set the EXTRA_LANGUAGE_MODEL to websearch to capture only relevant words.

like image 161
rockeye Avatar answered Oct 08 '22 01:10

rockeye


You can implement onError of RecognitionListener interface like this. It is continuously listening in your activity.

@Override public void onError(int error) {     String errorMessage = getErrorText(error);     Log.i(Constants.TAG, "FAILED " + errorMessage);     speech.destroy();     speech = null;     StartListening(); }  private void StartListening() {     speech = SpeechRecognizer.createSpeechRecognizer(this);     speech.setRecognitionListener(this);     recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);     recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");     recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, this.getPackageName());     recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);     recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);      //if setting.SpeechEnable     speech.startListening(recognizerIntent); } 
like image 20
M.Eqbalazar Avatar answered Oct 08 '22 02:10

M.Eqbalazar