0

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.

Community
  • 1
  • 1
doomguy
  • 401
  • 10
  • 26
  • 1
    No, that isn't possible – brandall Sep 21 '16 at 21:35
  • @brandall Thanks, thats good to know. Will have to find a work around. How do you manage this in Utter (which by the way is really great!)? Do you always keep the speech recognizer running or pause it while it is saying something and if so how do you wake it up using speech again? Any hints would be appreciated. – doomguy Sep 21 '16 at 22:38
  • 2
    Thanks :) You have to have a global 'restart hotword' boolean, which you check when the text to speech utterance has completed, or an incoming call has ended, or a separate voice interaction has completed etc. It's not straight forward... – brandall Sep 21 '16 at 23:47

1 Answers1

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.

Hoan Nguyen
  • 18,033
  • 3
  • 50
  • 54
  • Thanks @brandall and Hoan, I was thinking on similar lines. Will work based on this. Accepting your answer for now. – doomguy Sep 21 '16 at 23:55