我的 AVSpeechSynthesizer(文本到语音)正在以非常快的速度说话,我不知道如何减慢它的速度
My AVSpeechSynthesizer (text to speech) is talking at a very fast rate and I can't figure out how to slow it down
所以我在 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
}
}
AVSpeechUtterance
的比率为 属性。尝试降低速率。
设置速率、音高和音量属性后说出话语:
//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
试试这个 -:
let speechUtterance: AVSpeechUtterance = AVSpeechUtterance(string: text)
speechUtterance.rate = AVSpeechUtteranceMaximumSpeechRate / 2.0
所以我在 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
}
}
AVSpeechUtterance
的比率为 属性。尝试降低速率。
设置速率、音高和音量属性后说出话语:
//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
试试这个 -:
let speechUtterance: AVSpeechUtterance = AVSpeechUtterance(string: text)
speechUtterance.rate = AVSpeechUtteranceMaximumSpeechRate / 2.0