Monday, October 6, 2008

Ripping and encoding music with EAC, LAME, and Zsh

This is my current ripping+encoding scheme (on Windows, but LAME part is relevant for *nix as well):

  • Use the Hydrogenaudio wiki as an authoritative information source
  • Rip to WAV with Exact Audio Copy for best ripping precision - configure EAC with the configuration guide from Hydrogenaudio
  • Encode to MP3 with the latest LAME (Windows binaries here)
  • Encode high-quality (-V 2) MP3s for the home computer, low-quality (-V 6) MP3s for the portable player

Once the ripping is done, I use this shell-script magic to encode all the WAVs in high quality (low quality left as an exercise):

for x in **/*.wav; do
  mkdir -p ../high/"$(dirname $x)"
  /cygdrive/c/lame3.98/lame.exe -V 2 "$x" ../high/"${x/.wav/.mp3}"
done

This lets me get the attention-intensive need-to-change-the-CD-in-the-drive ripping out of the way quickly. I don't even need to be around later when its encoding.

This requires Zsh with extended globbing turned on (I use it on Windows through Cygwin). Non-zsh note: you can probably use 'find' with or without 'xargs' instead of the '**/*.wav' recursive globbing, but which one is cooler? :-)