我正在尝试向我的应用程序添加语音提示,并在 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/