AVSpeechSynthesisVoice not working for some users

Hello,

In my iOS app most users can hear the AVSpeechSynthesisVoice correctly, but some report that it simply does not work. I haven't been able to reproduce the issue locally, but here is how I use the API:

Code Block
let sentence = "the sentence to be told"
let synthesizer = AVSpeechSynthesizer()
let utterance = AVSpeechUtterance(string: sentence)
utterance.voice = AVSpeechSynthesisVoice(
language: "en-GB"
)
utterance.rate = AVSpeechUtteranceDefaultSpeechRate * 1.05
synthesizer.speak(utterance)


This works perfectly fine on iOS 13 (tested most minors), all iOS 14 versions, all the devices I could find... but I keep getting reports of people not getting any audio feedback.

Do you have any pointers on where to look, or at least reproduce the issue?


Thanks

Replies

Do you set the volume of the utterance ?

Check it is not 0.0

Code Block
utterance.volume = 1.0

Please be more specific.

it simply does not work.
What does this mean? No sound? Broken as "en-GB"? Does it work for "en-US"?


Isn't the user setting the device to Silent Mode? Or running some app which would mute other audio output?
@Claude31 I'm not touching the volume at all, I've put the entire code I use in my post.

@OOper By "does not work" I meant that there is no sound on the user's device. I am not able to replicate the behavior on my side, so I don't have much more info than users saying that they don't hear the sound. I'll check with them if they are in silent mode

Same thing happened here... no sound, running on iOS14 on my iPhone 11.

Then, I realized that the Ring/Silent Switch Button on my phone was turned to OFF. Turning it on fixed the problem.

Could this be it? It is worth trying.

This still seems a bit wrong... so you have to set the ringer on in order to hear tts? What if I want to keep the ringer off?

Same issue on iOS 15.0.1. I just get this error AVAudioSession setActive FALSE error: The operation couldn’t be completed. (OSStatus error 560030580.). I have no idea how to recovery. Does any one have idea for this ticket?