ExtAudioConverter is an implementation of the afconvert command on OS X,
so this readme file uses some hints of afconvert help documentation. For example, LEI16 means little-endian signed int with 16 bit depth.
How to use:
Link Binary with Library "AudioToolbox.framework";
Add "ExtAudioConverter.h" and "ExtAudioConverter.m" to your project;
ExtAudioConverter* converter = [[ExtAudioConverter alloc] init]; converter.inputFile = @"/Users/lixing/Desktop/input.caf"; converter.outputFile = @"/Users/lixing/Desktop/output.wav"; [converter convert];
The following parameters are optional:
Set the sample rate:
converter.outputSampleRate = 44100;
Set channel count:
converter.outputNumberChannels = 2;
Set bit depth:
converter.outputBitDepth = BitDepth_16;
Set data format:
converter.outputFormatID = kAudioFormatLinearPCM;
Set file format:
converter.outputFileType = kAudioFileWAVEType;
Some parameter combinations is impossible, like mp3 file format together with wav data format.
The valid file type/data format pair is described on the Apple documentation
For mp3 format conversion
Apple doesn't include the MP3 encode algorithm in its APIs, but include the decode algorithm.
So we can now convert from mp3 file to other formats, but can't convert to mp3 format.
We will use other open source mp3 codec, like lame, to convert to mp3 format.
We have now supported conversion to mp3 format, using the famous lame mp3 codec.
If you have any questions, please commit an issue, or mail me:firstname.lastname@example.org.