1

RecogniseListener works fine when there's continuous talk, but whenever there are 5-10seconds of silence, the listener's onReadyForSpeech() method is called, but onBegginingOfSpeech() is never called.

Here's my listener:

    sr = SpeechRecognizer.createSpeechRecognizer(this);
    sr.setRecognitionListener(new RecognitionListener() {
        @Override
        public void onReadyForSpeech(Bundle params) {
        }
        @Override
        public void onBeginningOfSpeech() {
        }

        @Override
        public void onRmsChanged(float rmsdB) {
        }

        @Override
        public void onBufferReceived(byte[] buffer) {
        }

        @Override
        public void onEndOfSpeech() {
            startRecognising();
        }


        @Override
        public void onError(int error) {
        }

        @Override
        public void onResults(Bundle results) {
            adapter.add(new MessageData(MessageData.TYPE_VOICE,  recognisedText.getText().toString()), 0);
            recyclerView.scrollToPosition(0);
            recognisedText.setText("");
        }

        @Override
        public void onPartialResults(Bundle partialResults) {
            ArrayList data = partialResults.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
            String word = (String) data.get(data.size() - 1);
            recognisedText.setText(word);
        }

        @Override
        public void onEvent(int eventType, Bundle params) {
        }
    });

The startRecognising() method:

private void startRecognising(){
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS, 20000000);
    intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,"voice.recognition.test");
    intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);

    intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,1);
    sr.startListening(intent);
}

By the way, are there any free alternatives that can recognise speech in real-time continuously?

Martis
  • 183
  • 1
  • 12
  • 1
    Is it related to the bugs linked from this answer http://stackoverflow.com/a/38150919/1256219 – brandall Mar 12 '17 at 20:24
  • @Martis - I do have same problem after the recent Google App update. Did you find any solution. I asked the question http://stackoverflow.com/questions/42919038/speechrecognizer-doesnt-timeout no answer yet. – Libin Mar 22 '17 at 15:49
  • Hi , I have same problem , do you solve the problem ? – Wun Jul 28 '17 at 05:10
  • Hey. No, I didn't. I came to conclusion that voice recogniser is not suitable for continuous speech recognition, and API should be used for such purpose. – Martis Jul 30 '17 at 12:44

0 Answers0