"Look out honey, 'cause I'm using technology..."

2007-02-25

The Musical Gardener's Tools #1: Ripping your CDs

My number one source for music files is still plain old fashioned CDs, and I suspect it will be a while before anything changes that. I like browsing through the new stuff and the bargain bins, and I'll buy pretty much anything if it's cheap enough on the off chance that there's something worthwhile on there. Usually there isn't, but I did find a few gems over the years.

For ripping CDs to ogg vorbis files (my favorite, but mp3s work just the same) I use grip, a great little ripper for Linux, that does everything I must have:

  • rip to wav, usually even if the CD is 'protected' by some hare-brained DRM, although I make it a point not to consciously buy CDs with DRM, so I haven't tried with very many.
  • look up metadata over the net, so I don't have to type over the liner notes.
  • convert to ogg or mp3 with the quality settings of my choice. (Basically it calls the appropriate command line utilities, and you can specify the parameters.)
  • save the files in a place and with a filename that I can fully specify. (I use oggs/artist/album/artist-album-tracknumber-title, everything lower cased, spaces replaced by underscores. I realize there's some redundancy in there, and the filenames are a tad long, but it does make identifying individual files by their filename easy.)

For those still left on windows, I recommend CDex which I've used in the past and which has a nearly identical feature set. It's also open source.

The next step is volume gain: when you listen to large playlist as opposed to single CDs, large differences in volume quickly become annoying. What I do is normalize the (perceived) volume of all my files, to prevent nasty headphone surprises and constant twiddling of volume knobs.

On Linux there's the command line utilities vorbisgain (for oggs) and mp3gain, probably in your distribution already, I know they are in Ubuntu. I use the following two commands, depending on whether I'm dealing with oggs or mp3s:

find . -name "*.mp3" -print0 | xargs -0 mp3gain -k -r -f #recmp3gain
find . -name "*.ogg" -print0 | xargs -0 vorbisgain -fr #recvorbisgain

The find/xargs combo means that I process all files of the relevant type from the current directory and below. This works for huge numbers of files, where just calling find and the mp3gain or vorbisgain command would not.

The comments at the end, #recmp3gain and #recvorbisgain, are of course not necessary. I just use them so that I can use CTRL-R on the command line, type '#recv' or '#recm' and have the entire command. You can do the same with an alias of course, but somehow I'm always hesitant to pollute the global namespace, and this is a nice alternative.

The options mean find everything, skip the files that have already been adjusted, and check and adjust the rest. For large numbers of files, this can take a while and a lot of CPU. I use global gain rather than album gain, (which would keep the relative loudness of tracks from one album intact,) because then I would have to run the command on each album folder separately, and also it only really matters for classical albums, where the differences in loudness between tracks can be huge. I don't really listen to classical music much, but if you do, you probably want to use album gain.

The last thing I usually do, is check the tags against musicbrainz, with the picard tagger. The nice thing about that tagger is that it will recognize individual files, not just CDs, and the quality of the tag data is usually higher than that of freedb.org, which grip, and a lot of other CD rippers use. Also, it adds its own musicbrainz tags, which can be used by players or other software to look up the most current version of the tags in the musicbrainz database. For instance, the last.fm plugin for my favorite music player[1] uses that to submit information.

[1] More about that in another post.

No comments: