Hi @TheMichael,
Check this
class TTS {
let synth = AVSpeechSynthesizer()
func speak() {
let utterance = AVSpeechUtterance(string: "Hello World")
utterance.voice = AVSpeechSynthesisVoice(language: "en-US")
synth.speak(utterance)
}
}
Post
Replies
Boosts
Views
Activity
I solved it by declaring the AVSpeechSynthesizer as an instance variable instead of a local variable as above. As soon as an AVSpeechSynthesizer goes out of scope and is deallocated, speech output is stopped. Can you try instead storing the synthesizer as an instance or state variable?
Yeah, I am also experiencing the same issue. Even with current beta 6 it is not working. I am seeing some exception in the logs:
[catalog] Unable to list voice folder.
The required voices are present in the iPhone and working properly in Voice Over and Spoken content. Even the voice API AVSpeechSynthesisVoice.speechVoices() is fetching all the voices, but I am getting above exception at line synthesizer.speak(utterance).
Exact same code is working fine in iOS 15 and lower. It would be helpful if any solution is shared.