【问题标题】:My AVSpeechSynthesizer (text to speech) is talking at a very fast rate and I can't figure out how to slow it down我的 AVSpeechSynthesizer(文本到语音)正在以非常快的速度说话,我不知道如何减慢它
【发布时间】:2016-02-28 15:13:42
【问题描述】:

所以我在 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
 }
}

【问题讨论】:

  • 您是在设备上还是在 SIM 卡上?设置应用中的语速设置有影响吗? i.imgur.com/BImbqfJ.png
  • @MattLong,设置中的语速设置在哪里?我找不到它。
  • 常规 > 辅助功能 > 语音

标签: ios xcode swift avspeechsynthesizer


【解决方案1】:

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

【讨论】:

  • 我现在在 TilteSpeakingText.rate = 0.00003 大声笑并且仍然很快
  • 那就有问题了。我刚刚做了一个快速测试,0.5 的默认率似乎相当合理。 0.1 的比率使讲话听起来像是说话者半睡半醒或喝醉了。
  • 嗯。那是在sim卡上。当我在装有 iOS 8.4 的设备上运行时,我明白你的意思。默认速率 0.5 有点快。我刚刚尝试了 0.01,这很慢。 0.1 的速率在设备上似乎很自然。
【解决方案2】:

在设置速率、音高和音量属性后说出话语:

//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

【讨论】:

    【解决方案3】:

    试试这个 -:

    let speechUtterance: AVSpeechUtterance = AVSpeechUtterance(string: text)
    speechUtterance.rate = AVSpeechUtteranceMaximumSpeechRate / 2.0
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多