AVSpeechUtterance最大音量真的很安静,速度真快

tet*_*ive 7 text-to-speech ios ios7

我正在为我的应用程序添加语音提示并在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];
Run Code Online (Sandbox Code Playgroud)

Gur*_*i S 5

这对我有用(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.")   
}
Run Code Online (Sandbox Code Playgroud)


Ada*_*evy -2

该比率只是一个浮点值,为了方便起见提供了常数。尝试使用 [utterance setRate:AVSpeechUtteranceMaximumSpeechRate*.25];