Android speech recognition conflicting with Text to Speech

时光怂恿深爱的人放手 提交于 2019-12-25 08:18:12

问题


I have implemented continuous speech recognition in my app based on the method given here: Android Speech Recognition Continuous Service. It works reasonably well by itself.

However, I want to implement a feature where the app is reading a web page using Text To Speech and during the reading is going on, I want to have the speech recognition turned on so that i can ask it to stop using voice. However, I am seeing that the speech recognition starts recognition the Text to Speech output as well. Is there a way by which I can make it ignore the sounds coming out of the phone and only recognize what I say in the microphone.


回答1:


What you can do is having a short pause between paragraphs and listen to user commands during this pause. To implement it you need to use UtteranceProgressListener. Speak a paragraph and then in onDone turn on the speech recognizer. Set a countdown timer and onFinish turn off the speech recognizer and read the next paragraph.



来源:https://stackoverflow.com/questions/39625265/android-speech-recognition-conflicting-with-text-to-speech

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!