android - Why the SpeechRecognizer is busy when I start it after the onEndOfSpeech has been called? -
i developing in android , use speechrecognizer
implement continuous speech recognition.
after start speech recognition via following code:
private void startlistening(){ recognizerintent = new intent(recognizerintent.action_recognize_speech); recognizerintent.putextra(recognizerintent.extra_language_model,recognizerintent.language_model_web_search); recognizerintent.putextra(recognizerintent.extra_language_preference, "en"); recognizerintent.putextra(recognizerintent.extra_calling_package, getactivity().getpackagename()); recognizerintent.putextra(recognizerintent.extra_speech_input_complete_silence_length_millis,long.valueof(3000l)); recognizerintent.putextra(recognizerintent.extra_max_results,1); }
and call startlistening()
again when onendofspeech
has been called.
but onerror
been called , , show speechrecognizer.error_recognizer_busy
.
q1: why speechrecognizer
busy when start after onendofspeech
has been called?
q2 how implement crooect way of continuous speech recognition ?
the android speech recognition library designed in such way there timeout when used extensively.
as such there no official documentation on why google , when using google apps there no continuous voice recognition available.
to overcome need play around speech callback methods catch hold of error , try listening again. created library overcome time out issue , think serve purpose well.
head on github - droidspeech , add library project either clone or can use gradle dependancy. once added initialise droid speech , set listener mentioned below,
droidspeech droidspeech = new droidspeech(this, null); droidspeech.setondroidspeechlistener(this);
to start listening user call below code,
droidspeech.startdroidspeechrecognition();
and voice result in listener method,
@override public void ondroidspeechfinalresult(string finalspeechresult, boolean droidspeechwilllisten) { // whatever want speech result }
what makes library different is
- offers continuous speech recognition support after each word uttered,
- you don't need worry speech busy & time out errors library takes care of , makes sure eradicates issue altogether,
- you don't have write lines of code specific speech recognition other initialising library , setting listener methods,
- can take care of asking microphone permissions user if required
- takes care of annoying beep sound if there error
Comments
Post a Comment