0

As the title says, after I updated the Google App in my Android Marshmallow phone, speech recognition takes up to 7 seconds to stop, after I have finished talking. The end of speech timeout takes only 2 seconds when I run my app in a Lollipop device with an older version of Google App.

Here is my code:

SpeechRecognizer speechrecognizer;
    String TAG="joshtag";
    class listener implements RecognitionListener          
       { 
                public void onReadyForSpeech(Bundle params)
                { 
                         loge("onReadyForSpeech");
                } 
                public void onBeginningOfSpeech() 
                { 
                         loge("onBeginningOfSpeech");
                } 
                public void onRmsChanged(float rmsdB)
                { 
                         loge("onRmsChanged");
                } 
                public void onBufferReceived(byte[] buffer)
                { 
                         loge("onBufferReceived");
                } 
                public void onEndOfSpeech() 
                { 
                         loge("onEndofSpeech");
                } 
                public void onError(int error)
                { 
                         loge("error " +  error);
                         stopMicrophoneGlow();
                } 
                public void onResults(Bundle results)                   
                { 
                    stopMicrophoneGlow();
                         String str = new String();
                         loge("ASR2 onResults " + results);
                         ArrayList data = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
                         loge("result " + data.get(0));
                         sendTextInputFromUser(data.get(0).toString())  ; 
                } 
                public void onPartialResults(Bundle partialResults)
                { 
                         loge("onPartialResults");
                } 
                public void onEvent(int eventType, Bundle params)
                { 
                         loge("onEvent " + eventType);
                } 
       } 

speechIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);      
speechIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
speechIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1);       speechIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 2000);     speechIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS, 1500);    speechIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE,"en");
speechIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,this.getPackageName());
speechrecognizer = SpeechRecognizer.createSpeechRecognizer(this);       
speechrecognizer.setRecognitionListener(new listener());   

In the above code I call speech recognition, with "new Listener()". It allows me to do Voice Recognition without the Google Speak Popup, but the end of Speech timeout is way to long: around 7 seconds, despite I specified only 2000 miliseconds in the Intent.

WORKAROUND: Instead, if I call Voice Recognition, WITH the "Speak" popup, like this:

this.startActivityForResult(speechIntent, SPEECHRECON_CODE);

Then, the end of speech timeout is very short (some 2 secs) and everything is fine.

How can I do Voice Recognition without the Popup, bypassing the lond end of speech "bug" in the latest Google App update?? any ideas?

Josh
  • 6,251
  • 2
  • 46
  • 73
  • @brandall yes, it is indeed a duplicate... what shall we do here? – Josh Jul 13 '16 at 14:49
  • Use other services, it is possible to provide feedback immediately in realtime, with reaction less than 0.1 second ;) – Nikolay Shmyrev Jul 13 '16 at 14:58
  • Which other services? @NikolayShmyrev – Josh Jul 13 '16 at 15:14
  • @Josh depends on what you want to implement, a simple keyword spotting or full large vocabulary recognition. – Nikolay Shmyrev Jul 13 '16 at 17:54
  • I am doing the same old google speech recognition, usually for single sentences. But... without that green popup. It has been working fine in my app for ages. Now, users have started to update the "Google App" in their phones, and now the end of Speech is detected 8, or more, long seconds after the user has stopped speaking. @NikolayShmyrev Check the answer above, it seems to be a big fat Google Bug. – Josh Jul 13 '16 at 20:42

0 Answers0