我的AVSpeechSynthesizer(文本到语音)正在以非常快的速度谈话,我无法弄清楚如何减慢速度

时间:2015-11-25 17:43:19

标签: ios xcode swift avspeechsynthesizer

所以我在swift 2.0 Xcode 7.1.1上有一个完美的AVSpeechSynthesizer(文本到语音),但我无法弄清楚如何使它像我们以正常速度或甚至更慢的方式进行交谈? 代码:

 import UIKit
 import AVKit
 import AVFoundation

 class HomePage: UIViewController {
 let Voice = AVSpeechSynthesizer()

 override func viewDidLoad() {
    super.viewDidLoad()
 let TilteSpeakingText1 = AVSpeechUtterance(string: "Welcome back. The database should still be up for you")
            Voice.speakUtterance(TilteSpeakingText1)
            TilteSpeakingText1.rate = 0.003
            TilteSpeakingText1.pitchMultiplier = 0.60
            TilteSpeakingText1.volume = 0.75
            TilteSpeakingText1.postUtteranceDelay = 0.01
 }
}

2 个答案:

答案 0 :(得分:1)

AVSpeechUtterance有一个费率属性。尝试降低费率。

答案 1 :(得分:1)

在设定率,音高和音量属性后说出话语:

//Voice.speakUtterance(TilteSpeakingText1) <-remove this
            TilteSpeakingText1.rate = 0.003
            TilteSpeakingText1.pitchMultiplier = 0.60
            TilteSpeakingText1.volume = 0.75
            TilteSpeakingText1.postUtteranceDelay = 0.01
Voice.speakUtterance(TilteSpeakingText1)//call here instead