How do I use afconvert to convert all the files in a directory from wav to caf?

后端 未结 7 2100
无人共我
无人共我 2021-01-31 00:24

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).

Her

7条回答
  •  再見小時候
    2021-01-31 00:48

    found this:

    ##
    ## 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 converttocaf.sh'
    ## Any comments to 'support@ezone.com'
    ##
     
    for f in *; do
        if  [ "$f" != "converttocaf.sh" ]
        then
            /usr/bin/afconvert -f caff -d LEI16 "$f"
            echo "$f converted"
        fi
    done
    

    Customize the afconvert 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.

提交回复
热议问题