I have a directory with about 50 wav files that I need to convert to caf, because AudioServicesCreateSystemSoundID() returns an error for some of them (but not all).
Here's an example of the command I've used successfully for a single file:
afconvert -f caff -d LEI16@44100 -c 1 whistle.wav whistle.caf
How do I do this quickly - not one-by-one for each file?
Hit the Return key directly after
done
.Simple :)
For the people who are using OSX and are a bit afraid of Terminal scripts I created a little application with Automator, this application converts the files you select.
Download here
On Windows, use the
%~ni
syntax.Similar approach for bash:
for i in *.wav; do afconvert -f caff -d LEI16@44100 -c 1 $i ${i%.wav}.caf; done
Python script on OSX. Default data format of the
.caf
isima4
. Default directory is'.'
Make a file called
wav2caf.py
, put it in your path, make it executable, fill it with:Converts all .wav to .caf in current directory:
Converts all .wav to .caf in specified directory:
Converts all .wav to .caf with data type 'aac ':
found this:
Customize the aconvert options then save it as a text file called 'converttocaf.sh', place it in the directory of files you want to convert and run it from Terminal.
It works with files with spaces in their names.