ios 文本到语音在德语中重复奇怪的文本

v1uwarro  于 2023-05-19  发布在  iOS
关注(0)|答案(1)|浏览(123)

我正在使用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)
        }
    }
}
wfsdck30

wfsdck301#

同样的问题在这里与德国设置。

let utterance = AVSpeechUtterance(string: "Es ist das Jahr 2023")
utterance.voice = AVSpeechSynthesisVoice(language: "de-DE")

Demo-String的发音为:“Es ist das Jahr homograph 2023 homograph end”
这只发生在真实的设备上。在模拟器中,发音正确

相关问题