Converting Audio Files Using Mac OS X Terminal

I just figured out Mac OS X has a nice command line utility to convert audio files called afconvert . This is a great way to do batch audio conversion with total control over what you’re converting. The basic syntax is:

afconvert -d DATAFORMAT -f FILEFORMAT INPUTFILE OUTPUTFILE

To list the data and file formats supported, simply type:

afconvert -hf

The following script lists all the AIFF file on a directory and converts them to WAV.

ls *.aiff | while read file
do
afconvert -d LEI16 -f 'WAVE' $file `echo $file | sed 's/.aiff/.wav/'`
done
Advertisement