Wednesday, March 17, 2010

Sound Format Conversion in iPhone

Since iPhone supports only following data formats for audion files:

* linear PCM
* MA4 (IMA/ADPCM)
* µLaw
* aLaw

You may use the afconvert tool to convert sounds. For example, to convert the 16-bit linear PCM system sound Submarine.aiff to IMA4 audio in a CAF file, use the following command in the Terminal application:

afconvert /System/Library/Sounds/Submarine.aiff ~/Desktop/sub.caf -d ima4 -f caff -v

You can inspect a sound to determine its data format by opening it in QuickTime Player and choosing Show Movie Inspector from the Movie menu.