Duy Huynh
Duy Huynh

Reputation: 21

Lagging issue with Android Speech Recognition

Have anyone experienced this problem recently? There is a long lag between 'when i stop speaking' and 'when android speech recognition stops listening'. The "silence period" was a lot shorter previously, and now it's really long. Previously it was around 1-2 seconds, now it is about 10 seconds. We didn't change anything in our code.

Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak now...");
startActivityForResult(intent, REQUEST_CODE);

Upvotes: 2

Views: 737

Answers (2)

Mark Amoako Marcel
Mark Amoako Marcel

Reputation: 11

It is an internet issue. I experimented with my Samsung Galaxy Tab A7. While offline, there is no lag but when I connect to the internet, there is a lag due to poor internet connection.

I solved my issue by adding the RecognizerIntent.EXTRA_PREFER_OFFLINE with value true, to the intent I pass.

Upvotes: 1

seeingwithsound
seeingwithsound

Reputation: 81

Yes, I have the exact same problem with Android 4.4.2 (HTC One M8). Setting options like intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, new Long(1000)) to shorten the listening time do not seem to take any effect. I used to shoot down the recognition dialog after 6 seconds for older phones that would not automatically close it, which is ugly but worked fine, but now that results in nothing being recognized unless I increase the timeout from 6 to over 10 seconds. That immutable 10 seconds default also seems undocumented, such that it all become trial and error to find out what works across devices and Android versions.

Upvotes: 0

Related Questions