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?
Similar approach for bash: for i in *.wav; do afconvert -f caff -d LEI16@44100 -c 1 $i ${i%.wav}.caf; done
On Windows, use the %~ni
syntax.
for %i in (*.wav) do afconvert -f caff -d LEI16@44100 -c 1 %i %~ni.caf
for file in *.wav; do afconvert -f caff -d LEI16@44100 -c 1 "$file"; done
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With