0

i'm working on an iPhone project and wants to save mp3 files instead of car, i wrote this code to save record files in .caf extensions:

NSMutableDictionary* recordSetting = [[NSMutableDictionary alloc] init];
    [recordSetting setValue :[NSNumber numberWithInt:kAudioFormatAppleIMA4] forKey:AVFormatIDKey];
    [recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey]; 
    [recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];
    NSString *recorderFilePath =[NSString stringWithFormat:@"%@/%@.caf",  DOCUMENTS_FOLDER,fileName];

i tried this:

[recordSetting setValue :[NSNumber numberWithInt:kAudioFormatMPEGLayer3] forKey:AVFormatIDKey];
 NSString *recorderFilePath =[NSString stringWithFormat:@"%@/%@.mp3", DOCUMENTS_FOLDER,fileName];

but it didn't save in mp3 format! is it available in objective c or there's any third party code that makes that, i see that method in AudioToolbox.framework:

OSStatus AudioConverterConvertBuffer (
AudioConverterRef  inAudioConverter,
UInt32             inInputDataSize,

const void         *inInputData,

UInt32             *ioOutputDataSize,

void               *outOutputData

);

any help is welcomed,thanks.

chostDevil
  • 1,041
  • 5
  • 17
  • 24
  • 1
    possible duplicate of [Convert .caf to .mp3 on the iPhone](http://stackoverflow.com/questions/859151/convert-caf-to-mp3-on-the-iphone) – Alex Terente May 07 '12 at 14:27

1 Answers1

0

There is a open source project lame . The challenge would be making it work for iphone. This would give a direction towards cross compiling for ios.

Also note it is GPL.

Vignesh
  • 10,205
  • 2
  • 35
  • 73