In my Swift program, I use AVSpeechSynthesizer to pronounce Chinese characters. This is my method:
static var synth = AVSpeechSynthesizer()
static func speak(string: String)
{
let utterance = AVSpeechUtterance(string: string)
utterance.voice = AVSpeechSynthesisVoice(language: "zh-CN")
utterance.rate = 0.1
synth.speak(utterance)
}
Often, a single character can have multiple pronunciations. Is there a way to use AVSpeechSynthesizer to pronounce a character given the pinyin. In other words, instead of passing the character "高", we would pass the pinyin "gāo". So far, just passing the pinyin has not worked in this method.
Many thanks in advance,
Jon