我正在使用AVSpeechSynthesizer进行TTS,但它会重复奇怪的文本,如“homograf”和“encore”。“ActualValue 3261,Day 30,Month July,Year 1990,Age 32,星星Sign Leo,Birthday 30 July 1990,Days since birth 11974,Days until birthday 79,Born on which day Monday,Birthday this year Sunday”
下面是我使用的文本到语音的代码
var synth = AVSpeechSynthesizer()
synth.delegate = self
try? AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [])
try? AVAudioSession.sharedInstance().setActive(true, options: .notifyOthersOnDeactivation)
func playAudio(word: String){
let myUtterance = AVSpeechUtterance(string: word)
myUtterance.voice = AVSpeechSynthesisVoice(language: "de-DE")
if myUtterance.voice != nil {
myUtterance.rate = Float(ttsConfig.speed)/10.0
myUtterance.preUtteranceDelay = 0.5
if isPauseAudio {
synth.pauseSpeaking(at: .immediate)
} else {
synth.continueSpeaking()
print("SPEAK EVENT----> \(word)")
synth.speak(myUtterance)
}
}
}
1条答案
按热度按时间wfsdck301#
同样的问题在这里与德国设置。
Demo-String的发音为:“Es ist das Jahr homograph 2023 homograph end”
这只发生在真实的设备上。在模拟器中,发音正确