2

I have an app that uses AVSpeechUtterance which has been working fine until iOS 12. It still works but the en-US voice sounds garbled. This doesnt happen on the xcode simulator or on the new iPhone XS Max. It seems to only happen on iPhone X. Removing and re-installing the app does not fix the problem. The only fix was to change the voice to en-IE. Has anyone else experienced this or found a workaround??

AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:@"This is a test"];
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"];
utterance.rate = AVSpeechUtteranceDefaultSpeechRate;
[self.synthesizer speakUtterance:utterance];
ijason03
  • 571
  • 2
  • 9
  • 26

2 Answers2

2

iOS12 Made 'en-US' use Fred instead of Samantha,

Try to replace:

utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"];

With:

utterance.voice = [AVSpeechSynthesisVoice voiceWithIdentifier:@"com.apple.ttsbundle.Samantha-compact"];
Mute Dan
  • 428
  • 2
  • 14
0

macOS 12.3 monterey with FRED voice — i had a similar question — only i was unable to obtain the Fred voice. it would keep overriding with the Alex voice (which I did not want). thank you for the above tip — which allowed me to derive the correct syntax to get the voice > identifier and the identifier string to obtain Fred:

mouseCount = Int.random(in: 1..<numPhrases)
let mouseCountStr : String = mousePhrases[mouseCount]
let utterance = AVSpeechUtterance(string: mouseCountStr)
utterance.voice = AVSpeechSynthesisVoice(identifier:"com.apple.speech.synthesis.voice.Fred")
utterance.volume = 0.75
synthesizer.delegate = self
synthesizer.speak(utterance)
johnrpenner
  • 175
  • 1
  • 8