AVSpeechUtterance 最大音量非常安静且速率非常快

2024-05-08

我正在考虑向我的应用程序添加语音提示,并在 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.")   
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

AVSpeechUtterance 最大音量非常安静且速率非常快 的相关文章

随机推荐