The old way to set the language for a speech utterance in Swift for text to speech was:
let utterance = AVSpeechUtterance(string: "Hello world")
utterance.voice = AVSpeechSynthesisVoice(language: "en-GB")
utterance.rate = 0.1
let synthesizer = AVSpeechSynthesizer()
synthesizer.speak(utterance)
there was one voice per country.
However Apple has since added more than one voice per country, male and female voices and custom voices. There is an Alex, Samantha etc. Users can create their own voice. Apple has introduced Voiceovers and a lot of the voice questions seem to now fall under accessibility. Although Apple is marketing the ability for users to select new voices, the documentation does not seem to give a straightforward way to access the wider range of voices programatically.
What apis are you supposed to use to programatically access these new voices in 2024?
Thanks for any suggestions.