2016-05-09 1 views
0

誰でも音声合成装置のスピードを決定する方法を知っていますか?今は本当に速いですね。AVSpeechSynthesizerのスピードを決定する方法Swift?

import UIKit 
import AVFoundation 

class ViewController: UIViewController { 
var voice = AVSpeechSynthesizer() 

override func viewDidLoad() { 
    super.viewDidLoad() 
} 

override func didReceiveMemoryWarning() { 
    super.didReceiveMemoryWarning() 
} 

@IBAction func buttonPushed(sender: UIButton) { 
    var utterance = AVSpeechUtterance(string:"This is a test") 
    voice.speakUtterance(utterance) 
} 
} 

答えて

0

発話速度を低減するために、AVSpeechUtteranceクラスのレートプロパティを使用

let speechUtterance: AVSpeechUtterance = AVSpeechUtterance(string: "Sample text for speech") 
    speechUtterance.voice = AVSpeechSynthesisVoice(language: "en-US") 

    print("Default Speech Rate: " + String(speechUtterance.rate)) 

    speechUtterance.rate = 0.3 

    let speechSynthesizer = AVSpeechSynthesizer() 
    speechSynthesizer.speakUtterance(speechUtterance) 
関連する問題