2
我有一段代碼無法工作,但也沒有給我一個運行時錯誤。發言者沒有發言。快速文本到語音
let synth = AVSpeechSynthesizer()
var myUtterance = AVSpeechUtterance(string: audioTextField.text)
myUtterance.rate = 0.3
synth.speak(myUtterance)
是否有任何代碼我錯過了或是其他東西?幫助將不勝感激。
編輯:這不是在任何@IBActions工作,而是工作在視圖中細做負載功能....
override func viewDidLoad() {
super.viewDidLoad()
speechRecognizer?.delegate = self
timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(tick), userInfo: nil, repeats: true)
tick()
requestSpeechAuth()
//WORKS HERE
}
@IBAction func audioButtonPressed(_ sender: Any) {
//DOESN"T WORK HERE
if isRecording {
stopRecording()
} else {
startRecording()
}
}
它支持ssml嗎? –
我的意思是ssml到語音(而不是文本到語音) –