2010年11月2日星期二

Converting audio file format on Mac by "afConvert"

"afConvert" is a command which could be directly used in the Terminal (I am using Mac OS X 10.6.4).

I used to convert audio file of format .m4a to .caf, which is a file format for iPhone and is actually a wrapper for a number of data formats like .mp3, LEI, acc, etc...

To make my sound file playable by my OpenAL class in iPhone SDK, I tried to change it to LEI16
"afConvert -f caff -d LEI16@44100 inputname outputname"

In order to make the files smaller, I tried using LEI8 and acc but the sounds played are weird.
I am still working on it.

Here is a shellScript for batch conversion, name the script as converttocaf.sh and all the file in that directory will be converted to the .caf format:
for f in *; do
if  [ "$f" != "converttocaf.sh" ]  then
    /usr/bin/afconvert -f caff -d LEI16@44100 $f
    echo "$f converted"
fi
done

沒有留言:

發佈留言