自动超时识别器Intent
我正在尝试 Android 的语音识别,并且希望能够使语音识别意图超时。我正在基于 Android API 示例代码创建并启动语音识别意图,并且运行良好。我想要的是如果 N 毫秒后没有音频输入,能够自动取消/超时语音检测。换句话说,聆听讲话,如果短时间内没有讲话,则返回到启动意图的活动。这可能吗?我查看了 RecognizerIntent 的文档,发现没有额外的字段来表示执行此操作的意图。
I am playing around with Android's speech recognition and would like to be able to timeout the voice recognition intent. I am creating and starting the speech recognition intent, based on the Android API example code, and it works fine. What I would like is the ability to to automatically cancel/timeout the speech detection if there is no audio input after N milli seconds. In otherwords, listen for speech and if there is none after a short time return to the activity that started the intent. Is this possible? I looked at the documentation for RecognizerIntent and there were no extra fields for the intent for doing this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过调整
RecognizerIntent
中的参数,例如EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS
适用于发送
Intent
的标准和直接使用SpeechRecognizer
类。Have you tried adjusting the parameters in the
RecognizerIntent
such asEXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS
that work for both the standard sending the
Intent
and for using theSpeechRecognizer
class directly.我想到的一件事是您设置了一个后延迟处理程序。该处理程序将等待 x 秒,然后在时间耗尽且仍在运行时取消 RecognizerIntent。
One thing that comes to mind is that you set up a Post Delayed Handler. This handler will wait x seconds and then cancel the RecognizerIntent if time runs out and it is still up.