I'm making an iPhone app and I have a ton of .wav
files I need to convert to .caf
I can use this for each file:
afconvert -f caff -d LEI8@22050 walking.wav walking.caf
But that would take ages, so I'm trying to convert all files with:
for i in *.wav; do afconvert -f -caff -d LEI16@44100 -c 1 $i ${i%.wav}.caf; done
But I get this error:
Error: ExtAudioFileCreateWithURL failed ('typ?')
EDIT:The error will actually occur because of a typo in the for loop shown above. It should be caff
not -caff
. The correct code snippet would then be.
for i in *.wav; do afconvert -f caff -d LEI16@44100 -c 1 $i ${i%.wav}.caf; done
There may be other issues and the accepted answer is valid, just wanted to help out with making the question clear. /EDIT
WAV's own time limit is somewhere between 40 minutes and 13 hours, and CAF's is unlimited. Apple Loops use the CAF format. Generally speaking, you will no problems recording in AIFF format, which is Logic Pro X's default.
This is the script i have been using, slightly modified from another source, which kindly deserves all credit:
##
## Shell script to batch convert all files in a directory to caf sound format for iPhone
## Place this shell script a directory with sound files and run it: 'sh afconvert_wavtocaf.sh'
## Any comments to '[email protected]'
##
for f in *.wav; do
if [ "$f" != "afconvert_wavtocaf.sh" ]
then
afconvert -f caff -d ima4 $f
echo "$f converted"
fi
done
Save this in a file named 'afconvert_wavtocaf.sh'. See if that does the trick.
Try adding echo $i;
before afconvert
in your script to get the name of sound file your command fails on. Then try to convert it manually, it will probably fail too.
I suspect one of your files is not an actual wav, but is in format not recognizable by afconvert
.
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