How do I pause scSpeechRecognizer until TextToSpeech completes?

My app uses scSpeechRecognizer.stopASR, then TextToSpeech to give spoken instructions, then calls scSpeechRecognizer.GetText to receive spoken input from the user. The trouble I'm having is that scSpeechRecognizer.GetText is activating before TextToSpeech has completed and is therefore picking up the instructions as input from the user. How can I make scSpeechRecognizer.GetText wait until TextToSpeech has completed it's message.

You have a Start Button - add a Stop Button. The Stop Button can call scSpeechRecognizer.GetText

2 Likes

Thanks for the reply. I could more easily simply call scSpeechRecognizer.GetText on the next click of the existing button. But my question anticipates other use cases. The app is to help children practice English pronunciation. I'm wanting to make the experience as intuitive and easy as possible - as close to actual conversation as I can get. There are other moments in the execution of the app where scSpeechRecognizer.GetText gets triggered before other messages have completed their delivery - when the student pushes a button to hear pronunciation for example. I may just introduce a short pause routine using clock if your answer means there is no way to pause scSpeechRecognizer.GetText itself.

...except that's not intuitive and prone to double-tap errors.

2 Likes

In App Inventor's own Speech Recogniser Blocks is an event 'After Getting Text' and a command 'SpeechRecogniser .Stop'

1 Like

I'm calling SpeechRecogniser .StopASR at the beginning of the above routine. My assumption was that speech recognition would stop until the intervening routines completed (like the SpeechToText). Does that need to be called within the 'After Getting Text' block?

Yes :sunglasses: You seem to be trying to cram too much into one Block. Try to keep your code (and GUI) as simple as possible.

2 Likes