Reputation: 41510
I would like to get your recommendation on what settings to use for audio recording using AVAudioRecorder. Below is the settings I am using currently. Also, what file extension should I save it as so users on Mac or Windows can play it without difficulties? Right now I am saving the file out as .caf
[settings setValue:[NSNumber numberWithInt: kAudioFormatAppleLossless] forKey:AVFormatIDKey]; [settings setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey]; [settings setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey]; //Linear PCM Format Settings [settings setValue:[NSNumber numberWithInt: 32] forKey:AVLinearPCMBitDepthKey]; [settings setValue:[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsBigEndianKey]; [settings setValue:[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsFloatKey]; //Encoder Settings [settings setValue:[NSNumber numberWithInt:AVAudioQualityMin] forKey:AVEncoderAudioQualityKey]; [settings setValue:[NSNumber numberWithInt:96] forKey:AVEncoderBitRateKey]; [settings setValue:[NSNumber numberWithInt:16] forKey:AVEncoderBitDepthHintKey];
Upvotes: 1
Views: 2860
Reputation: 33602
What are you recording audio for? Local playback? Uploading to a server? Streaming over the internet?
A few notes:
Upvotes: 1
Reputation: 3185
CAF is a very flexible format, but not widely supported outside of Core Audio-dom.
Since you're recording big-endian PCM, you probably need to use AIFF. If you're keen on being more Windows-friendly, you can use WAV, but you'll have to go little-endian.
Upvotes: 0