Bulk converting .flac files to .wav in mac?

This script might help some people

#!/bin/bash
if [ $# -gt 0 ]; then f_path=$1; else f_path=.; fi
if [ $# -gt 1 ]; then f_files=("$f_path"/*.$2); else f_files=("$f_path"/*.(wav|flac)); fi
if [ $# -gt 2 ]; then f_ext_out=$3; else f_ext_out=mp3; fi

cd "$f_path"

for fw in $f_files; do
    f_name=$(basename "$fw")
    f_ext_in="${f_name##*.}"
    f_base="${f_name%.*}"
    # echo $f_base . $f_ext_in
    ffmpeg -i "$fw" -y -c:v copy -q:a 0 "$f_path/$f_base.$f_ext_out"
    # sleep 1
done

If you haven’t already, install homebrew on your mac and brew install ffmpeg

/usr/local/minebeing on my $PATH, I saved the script above in a file

# /usr/local/mine/all2mp3 execution_path input_extension output_extension
all2mp3 . flac wav

When I hit all2mp3, it defaults to converting all wav and flac in the folder into mp3

7 Likes