2

I'm using Remote.IO to get the audio buffer from PCM, but the raw data is too big to send to remote-side by cellular network (3G network). I did reference some articles, but most of them suggest converting file to the other format file.

Is there any way to convert the audio buffer to AAC encoding data in real-time?

Bijoy Thangaraj
  • 5,434
  • 4
  • 43
  • 70
PatrickSCLin
  • 1,419
  • 3
  • 17
  • 45

1 Answers1

1

You can indeed save the audio buffer directly into AAC format.

While setting the ASBD, set it like this

AudioStreamBasicDescription audioFormat;
audioFormat.mFormatID = kAudioFormatMPEG4AAC;

Specify kAudioFileM4AType while calling ExtAudioFileCreateWithURL like this:

err = ExtAudioFileCreateWithURL((CFURLRef)audioFileURL,
                             kAudioFileM4AType,
                             &audioFormat, 
                             NULL,
                             kAudioFileFlags_EraseFile,
                             &outFile);

You also need to set the codec like this.

UInt32 codecManf = kAppleSoftwareAudioCodecManufacturer;
ExtAudioFileSetProperty(outFile, kExtAudioFileProperty_CodecManufacturer, sizeof(UInt32), &codecManf);

This should help you get your AAC encoding working.

Bijoy Thangaraj
  • 5,434
  • 4
  • 43
  • 70
  • I think this is not the solution which I expected. whatever I just resovled this problem, I using iLBC encoding and Audio Convert Service. – PatrickSCLin Jan 03 '13 at 12:30
  • @PatrickSCLin, did you do the conversion using an AudioConvert audio unit with `AudioConverterFillComplexBuffer`? – kevlar Mar 13 '13 at 02:47
  • Hi, do you have any example that show how to use iLBC encoding and Audio Convert service? – Wei Wen Hsiao Apr 26 '16 at 07:21