doomguy doomguy - 1 month ago 7x
Android Question

Android speech recognition conflicting with Text to Speech

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.


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.