I'm coding an app to read random study questions to students.
The basic flow is:
- Generate random question
- Assign the text to a SpeechUtterrance
- Play the SpeechUtterance with the SpeechSynthesizer
- Get the student's answer
- Check it
- Generate a new random question
- Repeat
Everything works except I can't get it to read more than one question. It'll speak the first one, accept an answer, but I can't get it to read subsequent utterances.
Is there a method I can call to reset the SpeechSynthesizer/SpeechUtterance after the didFinish is run?
So I was using SFSpeechRecognizer and AVSpeechSynthesizer and starting the audio recorder cut off the audio channel to play audio.
I had to change
try audioSession.setCategory(AVAudioSessionCategoryRecord)
to
try audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
and that resolved my issue.