开发者

How to increase the amount of time to consider input complete, in android voice recognition?

开发者 https://www.devze.com 2023-02-19 02:00 出处:网络
In android voice recognition, Can any one know how to increase the amount of time that it开发者_开发百科 should take after we stop hearing speech to consider the input possibly complete. I need to pre

In android voice recognition, Can any one know how to increase the amount of time that it开发者_开发百科 should take after we stop hearing speech to consider the input possibly complete. I need to prevent the endpointer cutting off during very short mid-speech pauses while voice recognition. If anyone knows the solution, please give reply. Any response would be appreciated.

thanks in advance


Hi Im also having this problem, but I found something,

here's my code

private void startVoiceRecognitionActivity()   
    {   

        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_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS, 2000000);   
//        intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 2000000);
        intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS, 20000000);

        intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "XXXXXXX");   

        startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);   
    }

in google API I found the 3 extra to change the time issue, but none of them seems to work, u can also try to test them.


These two parameters are relevant and they control the amount of silence the recognizer needs to hear before stopping.

EXTRA_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS or EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS

They both seem to control the same thing and which ever is lower is the one it uses.

For example, if complete_silence = 20000 and possibly = 10000 then the recognizer will stop after it hears 10000 milliseconds of silence.


String EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS   The amount of time that it should take after we stop hearing speech to consider the input complete.
 String EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS    The minimum length of an utterance.
 String EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS  The amount of time that it should take after we stop hearing speech to consider the input possibly complete.

These parameters stopped working for Jelly Bean devices. They still work for ICS devices and below.


Try this, it works for me. 5 sec. waiting for you to start talking

    intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS, 50000000);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号