ios - AVSpeechUtterance 最大音量非常安静,速度非常快

标签 ios ios7 text-to-speech

我正在尝试向我的应用程序添加语音提示,并在 iOS 7 中测试 AVSpeechUtterance,但默认语音速率非常快。最低语速就容易理解多了。但是1的最大音量值太安静了!我在我的 iPhone 4 上测试了它,音量一直调高。一定是出了什么问题,否则这怎么能用。

AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]init];
            NSString *mystring = [NSString stringWithFormat:@"Talk String Here %@",myObject.name];
            AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:mystring];
            [utterance setRate:AVSpeechUtteranceMinimumSpeechRate];
            [utterance setVolume:1];
            [synthesizer speakUtterance:utterance];

最佳答案

这对我有用(Swift 3.0)

let audioSession = AVAudioSession.sharedInstance()  
do {
  try audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with: AVAudioSessionCategoryOptions.defaultToSpeaker)  
} catch {   
  print("audioSession properties weren't set because of an error.")   
}

关于ios - AVSpeechUtterance 最大音量非常安静,速度非常快,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20461178/

相关文章:

javascript - 在 nodejs 中解析 Watson TTS HTTP 响应

iphone - 文字转语音:阅读列表并在标题之间播放音频文件

css - iOS 强制输入圆 Angular 和眩光

objective-c - NSAttributedString boundingRectWithSize 在 iOS 6 和 iOS 7 之间给出不同的高度

ios - 仅使用商店应用程序时应用程序崩溃 'NSInvalidArgumentException'

python - 可听错误 - Python 日志记录模块的自定义非阻塞文本到语音处理程序

ios - 使用 CallKit 切换扬声器和从扬声器切换

ios - 创建像 iOS 7 Safari 的共享/书签菜单一样的向上滑动菜单

ios - 如何防止用户从滑出设置菜单中连续两次调用同一 View Controller ?

ios - 如何在 applicationDidEnterBackground 中停止 UIDynamicAnimator