Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delay when using android.speech.SpeechRecognizer in DICTATION_MODE

I'm using android.speech.SpeechRecognizer in DICTATION_MODE to recognize commands during a long period of time. In this mode the call to the callback method onPartialResults delays much more than in normal mode. Does anybody know why this happen and how to avoid this delay?

This is the configuration I use for the SpeechRecognizer:

Intent recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);  recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); recognizerIntent.putExtra("calling_package", mainActivity.getApplicationContext().getPackageName()); recognizerIntent.putExtra("android.speech.extra.DICTATION_MODE", true); recognizerIntent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true); recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 100); 
like image 257
acimutal Avatar asked Dec 10 '15 16:12

acimutal


People also ask

What is Recognizerintent?

A broadcast intent which can be fired to the BroadcastReceiver component specified in the meta-data defined in the DETAILS_META_DATA meta-data of an Activity satisfying ACTION_WEB_SEARCH . String.


1 Answers

The problem may be because of the internet speed.

Try to set EXTRA_PREFER_OFFLINE to true and check whether the delay will be reduced

https://developer.android.com/reference/android/speech/RecognizerIntent.html#EXTRA_PREFER_OFFLINE

like image 134
Grountex Avatar answered Oct 23 '22 15:10

Grountex