How to burn audio to mp3 file using AvAudiorecorder

how to write audio to mp3 file using AvAudiorecorder.im using the following code to configure the recorder

recordSetting1 = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:AVAudioQualityMin],AVEncoderAudioQualityKey, [NSNumber numberWithInt:16], AVEncoderBitRateKey, [NSNumber numberWithInt: 2], AVNumberOfChannelsKey, [NSNumber numberWithFloat:44100.0], AVSampleRateKey,nil]; 
+6
source share
2 answers

Add

 [NSNumber numberWithInt:kAudioFormatMPEGLayer3] forKey:AVFormatIDKey 

However, it is not possible to encode the mp3 format to the iPhone due to royalties.

+6
source

While you can play MP3 files using AVAudioPlayer , you cannot record MP3s using AVAudioRecorder (see this SO message and this SO message ). If you need a compressed format, but it does not have to be MP3, I suggest recording in AAC format.

+3
source

Source: https://habr.com/ru/post/914122/


All Articles