Sound formats for iOS

This link is useful for understanding sound formats.

For all the sounds that I record, I use .caf format. For pre-recorded sounds I converted them all from .aiff to .m4a using afconvert—a developer tool from the command line. You can also use iTunes.

Here’s the script I use for afconvert. I adopted if from one I found on Sparrow.org. afconvert will convert to lots of formats, but the Apple Lossless makes the smallest file size for me.


#!/bin/bash
# http://www.sparrow-framework.org/2010/06/sound-on-ios-best-practices/
# Reset the field separator to : instead of space so all of the file will be converted
IFS=:
for i in ~/Sounds/*; do
  
  # creates sound.aifc (IMA4 compression, MONO)
  #afconvert -f AIFC -d ima4 -c 1 $i

  # creates sound.m4a (Apple Lossless compression)
  afconvert -f m4af -d aac -q 127 -c 1 $i
done

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.