Reputation: 1558
How to record audio as an mp3 file by using AvAudiorecorder? I am using the following code for the recorder setting
recordSetting = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:AVAudioQualityMin],AVEncoderAudioQualityKey,
[NSNumber numberWithInt:16],
AVEncoderBitRateKey,
[NSNumber numberWithInt: 2],
AVNumberOfChannelsKey,
[NSNumber numberWithFloat:44100.0],
AVSampleRateKey, nil];
Upvotes: 13
Views: 17140
Reputation:
Whilst you can play MP3 files using AVAudioPlayer
, you can't record in MP3 format with AVAudioRecorder
(see this SO post and this SO post). If you need a compressed format, but it doesn't have to be MP3, I suggest recording in AAC format.
Upvotes: 6
Reputation: 146
Add
[NSNumber numberWithInt:kAudioFormatMPEGLayer3] forKey:AVFormatIDKey
However it's impossible to encode mp3 format at IPhone because of royalty.
Upvotes: 13