如果我想录制到iOS上的“caf”音频文件,推荐的音频编码是什么?我认为kAudioFormatMPEGLayer2是正确的,但我似乎无法使用谷歌找到明确的答案。如果这有用的话,这是我的代码。
NSString *audioFilePath = [[self applicationDocumentsDirectory] stringByAppendingPathComponent:path];
_audioFileURL = [NSURL fileURLWithPath:audioFilePath];
_audioQuality = [NSNumber numberWithInt:AVAudioQualityHigh];
_audioEncoding = [NSNumber numberWithInt:kAudioFormatMPEGLayer2];
_audioChannels = [NSNumber numberWithInt:2];
_audioSampleRate = [NSNumber numberWithFloat:44100.0];
NSDictionary *recordSettings = [NSDictionary dictionaryWithObjectsAndKeys:
_audioQuality, AVEncoderAudioQualityKey,
_audioEncoding, AVFormatIDKey,
_audioChannels, AVNumberOfChannelsKey,
_audioSampleRate, AVSampleRateKey,
nil];
NSError *error = nil;
_audioRecorder = [[AVAudioRecorder alloc]
initWithURL:_audioFileURL
settings:recordSettings
error:&error];
_audioRecorder.delegate = self;