Delay when using android.speech.SpeechRecognizer in DICTATION_MODE
AndroidSpeech RecognitionAndroid Problem Overview
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);
Android Solutions
Solution 1 - Android
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
Solution 2 - Android
Response time depends on many factors, such as:
- device characteriscics
- OS version
- internet speed
And in common it is longer because this mode implies guessing the context and try to figure out meaning of that changes with each new word.