what are the formats supported in AVAudioRecorder for recording sound?
As per apple docs Apple Core Audio Format Specification 1.0 it should now support mp3 although I haven't tested it, this is the current enumeration they support:
enum {
kAudioFormatLinearPCM = 'lpcm',
kAudioFormatAppleIMA4 = 'ima4',
kAudioFormatMPEG4AAC = 'aac ',
kAudioFormatMACE3 = 'MAC3',
kAudioFormatMACE6 = 'MAC6',
kAudioFormatULaw = 'ulaw',
kAudioFormatALaw = 'alaw',
kAudioFormatMPEGLayer1 = '.mp1',
kAudioFormatMPEGLayer2 = '.mp2',
kAudioFormatMPEGLayer3 = '.mp3',
kAudioFormatAppleLossless = 'alac'
};
List above just
currently defined values for the mFormatID field
not supported for recording.
There are tested with AVAudioRecorder formats (with sample rates):
"MPEG4AAC (8000, 11025, 22050, 32000, 44100, 48000)",
"AppleLossless (8000, 11025, 22050, 32000, 44100, 48000)",
"MPEG4AAC_HE (32000, 44100, 48000)",
"MPEG4AAC_LD (22050, 32000, 44100, 48000)",
"MPEG4AAC_ELD (22050, 32000, 44100, 48000)",
"MPEG4AAC_ELD_SBR (22050, 32000, 44100, 48000)",
"MPEG4AAC_ELD_V2 (22050, 32000, 44100, 48000)"
Example:
[[AVAudioRecorder alloc] initWithURL:outputFileURL
settings:@{
AVFormatIDKey : @(kAudioFormatMPEG4AAC),
AVSampleRateKey : @(44100.0),
AVNumberOfChannelsKey : @(2)
}
error:&error];
also Supported Audio file formats