Why is AVSpeechSynthesizer reproducing more information that my text?

84 Views Asked by At

I'm using AVSpeechSynthesizer for texts, here's relevant code.-

guard let nonNilText = text else { return }
let utterance = AVSpeechUtterance(string: nonNilText)
utterance.voice = AVSpeechSynthesisVoice(language: Locale.current.identifier)
utterance.rate = 0.4
synthesizer.speak(utterance)

Everything works fine, but seems that in some devices, particularly when the iPhone locale is set to English, voice over is reproducing what sounds like a description of the utterance itself: something like "Speak: rate xxx, voice name equals to com.apple..." before my text.

I'm guessing this might have to do with some accessibility setting, but can't figure out where to enable it to reproduce the issue on my iPhone. Any idea?.

2

There are 2 best solutions below

2
ssantos On BEST ANSWER

What finally worked was just removing the line.-

utterance.voice = AVSpeechSynthesisVoice(language: Locale.current.identifier)

to let the synthesizer pick the voice itself.

3
devdchaudhary On

Goto Accessibility in Settings.

Tap on VoiceOver

Tap on Verbosity, toggle off "Speak Hints" option.