1

I want to record the sound in my iPhone app,but i can only record it in some specific formats.How to record in mp3 format I have searched lot,but could not find a solution

I found AVRecorder wont support mp3 recording,even though there are many apps in itunes which record in mp3 format

How can I achieve this,Please help me..thanks in advance

New Jango Tester
  • 561
  • 3
  • 5
  • 10
  • First Try searching Internet :http://stackoverflow.com/questions/10314510/how-to-record-audio-as-mp3-file-by-using-avaudiorecorder, http://stackoverflow.com/questions/10549023/iphone-app-recording-audio-in-mp3, http://stackoverflow.com/questions/4871940/how-to-record-an-audio-file-in-mp3-format, http://stackoverflow.com/questions/1005598/looking-for-a-way-to-encode-mp3-on-iphone – CRDave Apr 09 '13 at 10:45
  • 1
    The recorded file is in .caf file format. You have to convert .caf to.mp3 file format after recording. – Tirth Apr 09 '13 at 10:53
  • @iAmbitious How to convert .caf to .mp3 – New Jango Tester Apr 09 '13 at 11:27

2 Answers2

0

Here is the solution of your question.

This demo is developed by apple and usefull for audio recording in mp3 format. I have already developed one app(BRL App) using this demo.

This is very very helpfull demo developed by apple developers.

Nilesh Kikani
  • 2,628
  • 21
  • 37
-1

NSString *path = [[NSBundle mainBundle] pathForResource:@\"mp3Header\" ofType:@\"mp3\"];

NSMutableData *audioData = [[NSMutableData alloc] initWithContentsOfFile:path];

int samples = 22050;

uint8_t dataToRecord[samples];

int x;

for(x = 0; x < samples; x++) {

// populate the \"dataToRecord\" array with audio data. //

}

[audioData appendBytes:(const void *)dataToRecord length:samples];

// Get path to documents folder and set a file name  //

[audioData writeToFile:pathToFile atomically:YES];

Naresh
  • 433
  • 2
  • 15