如何在swift中增加AVSpeechUtterance的音量

时间:2018-04-11 13:27:26

标签: ios swift avspeechutterance

所有 当我在模拟器中运行时,我使用我的项目AVSpeechUtterance进行文本到语音的工作正常但是当我在我的设备中运行语音音量很慢时,我的代码...

        let utterance = AVSpeechUtterance(string: "Good night all")

    if UserDefaults.standard.string(forKey: "LNG") == "Eng"
    {
        utterance.voice = AVSpeechSynthesisVoice(language: "en-US")
    }
    else
    {
        utterance.voice = AVSpeechSynthesisVoice(language: "de-DE")
    }

    utterance.rate = AVSpeechUtteranceDefaultSpeechRate
    utterance.volume = 1
    let synth = AVSpeechSynthesizer()
    synth.speak(utterance)

0 个答案:

没有答案
相关问题