0

I'm working on an android app, that offers continuous Speech Recognition.

Everything works fine except the silence delay after last word pronounced which is around 6 seconds.

I have seen that it's a known bug in Android, but is there any alternatives / hacks / workaround for this ?

Intent intent = new Intent (RecognizerIntent.ACTION_RECOGNIZE_SPEECH);

intent.putExtra (RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, Locale.getDefault ());
intent.putExtra (RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
intent.putExtra (RecognizerIntent.EXTRA_CONFIDENCE_SCORES, true);
intent.putExtra (RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 0);
intent.putExtra (RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS, 0);
intent.putExtra (RecognizerIntent.EXTRA_CALLING_PACKAGE, getApplication ().getPackageName ());

speechRecognizer.startListening (intent);

So basically RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS is not taken into consideration at all.

Is there any way to solve this ? or an alternative API ? (I have used PocketSphinx but couldn't make it work for sentences and words outside the dictionary).

  • Possible duplicate of [Google Speech Recognition timeout](http://stackoverflow.com/questions/38150312/google-speech-recognition-timeout) – brandall Aug 13 '16 at 22:25

1 Answers1

0

I suggest trying this:

mNoSpeechCountDown = new CountDownTimer(COUNT, COUNT) {

        @Override
        public void onTick(long l) {

        }

        @Override
        public void onFinish() {
            Log.v(TAG, "CountDown Finished");
            processResults(mResult + ' ' + mPartialResult);
            mListener.restartListener();

        }
    };
    mNoSpeechCountDown.start();

}

and restarting the countdown on every onPartial of course this requires you to implement your own RecognitionListener.

ContinuousRecognizer implements RecognitionListener

    08-13 15:50:22.680 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:22.680 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the
08-13 15:50:22.689 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:22.689 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the
08-13 15:50:22.765 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:22.765 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the
08-13 15:50:22.833 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:22.833 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the
08-13 15:50:22.970 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:22.970 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime
08-13 15:50:23.155 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:23.155 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime
08-13 15:50:23.327 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:23.327 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime
08-13 15:50:23.412 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:23.412 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series
08-13 15:50:23.734 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:23.734 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I
08-13 15:50:23.953 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:23.953 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I
08-13 15:50:24.523 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:24.523 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I want me Direct
08-13 15:50:24.754 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:24.754 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I
08-13 15:50:25.350 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:25.351 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I will
08-13 15:50:25.505 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:25.505 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I
08-13 15:50:25.835 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:25.837 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I
08-13 15:50:26.046 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:26.047 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I want you to
08-13 15:50:26.365 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: OnPartial
08-13 15:50:26.365 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: by the way for the lifetime series should I want you to direct
08-13 15:50:30.865 30790-30790/com.praktikum.bp.myambient V/ContinuousRecognizer: CountDown Finished
ketrox
  • 889
  • 1
  • 12
  • 23
  • Thanks. However there is no guarantee that `onPartial` returns something.. in fact it never did for me. –  Aug 13 '16 at 13:37
  • recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1); recognizerIntent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true); it always does for me this way which android version are you running ? – ketrox Aug 13 '16 at 13:38
  • from the docs : `The server may ignore a request for partial * results in some or all cases.` –  Aug 13 '16 at 13:45
  • since it seems that it's the only way, I'll ignore the warning on the doc and go with it. Thanks :) –  Aug 13 '16 at 18:35