A few tips and tricks, from a thread in the Fedora Users mailing list, on how to “to digitize several hundred music CDs” under any Gnu/Linux distribution (read below WHY I put this post together).

How to digitize a CD collection with Free Software /img/make-facebook-transparent-yeah-right.jpg

Original question (edited for brevity):

“one of my new year’s resolutions was to digitize several hundred music CDs in preparation… Regardless of how I decide to eventually play these CDs, I’m looking for recommendations for how to rip them to hard drive.”

“Given the cheapness of hard drives, I don’t really care about disk usage, so I figured on ripping all of those CDs using (lossless) FLAC format, and I can decide down the road whether to convert them to a different format to save on space.

“In short, any recommendations on simply ripping all these CDs to hard drive, while having no idea what i will eventually use to play them?

General issues

You can do theThe general consensus is that disk space is cheap enough that there is no reason to not rip music to a lossless format. And on Linux you can, of course, digitize as many CDs as you want with graphical interface programs like Grip or Amarok. But, and that is the real problem, “Ripping CDs is incredibly boring”: the only really efficient and flexible solutions are based on shell or similar scripts, that you launch from the command line.

Solution #1

First step: convert the CDs tracks to *wav files with wodim:

“To copy an audio CD in the most accurate way, first run

icedax dev=/dev/cdrom -vall cddb=0 -B -Owav

and then run

wodim dev=/dev/cdrw -v -dao -useinfo -text  *.wav"

Second step: convert the wav files resulting from step one to FLAC format, by typing this command in the folder containing the wav files:

for f in *.wav; do sox "$f" "${f%.wav}.flac"; done

I’d assume one can script/automate that last step in a way so that once all CD’s have been converted, this script simply needed to cd into every dir containing the wavs and then starts to convert the files via the “for f in *.wav …” line ..

Solution #2

Fred Smith suggested “a horrid little shell script I use for ripping audio off CDs. You may find some inspiration in it… Note that this whole operation assumes it can find your CD in the cddb database. If not, all bets are off.”

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#set -x
if [ -z $1 ]
        echo usage: $0 \


# read all the files from the CD and download album info from cddb.
# I note that on my system, cdda2wav is a link to icedax.
cdda2wav dev=/dev/sr0 -B -L 1

# now that we've read all the files,...
# use the audio_*.inf files to assign proper track filenames.

for i in audio_*.inf
    # get the track number from the .inf file's name
    track=`echo $i | sed -e "s:.*_::" | sed -e "s:.inf$::"`
    #echo $track

    # get the track title from the .inf file's contents
    title="`grep Tracktitle $i | sed -e "s:^Tracktitle=     *::"`"
    #echo  "$title"

    # next, clean up spaces in the title
    # (whoever the genius was who thought spaces in filenames was a good idea,
    #  should be taken out and shot.)
    title=`echo "$title" | tr ' ' '_'`
    #echo "$title"

    # add numeric suffix and file extension
    #echo full_title=$full_title

    # clean off the unneeded single quote marks, apostrophes, etc.
    full_title=`echo ${full_title} | tr -d "\'\"()[]{};:\t"`
    #echo full_title=$full_title

    # now, at last, do the rename
    wavname=`basename $i .inf`.wav
    mv ${wavname} ${full_title}

Notes on chosing formats:

One poster noted that: “I’ve found that folks have a tendency to overvalue lossless formats but in fact their ears aren’t up to the task.”

Another answered: That’s often true (but I frequently find MP3 encoding is noticeably awful). And the converse is often true, that people rip down to a really crappy bitrate, thinking that saving space is more important than it is (producing what sounds like compact cassette recordings from shortwave radio).

But if you rip to a lossless format that you use now (e.g. ogg vorbis), and later on change players to one that doesn’t support that lossless format (e.g. mp3-only, particularly when it comes to hardware devices), you have to re-encode from one lossy scheme to another, and that does introduce audible artefacts.

[That is why I’ve faced that situation. I generally compress to ogg vorbis, because it does the job well on almost everything I have, and I don’t hear disturbing audio artefacts that I continually hear with MP3 (direct uncompressed WAV to MP3, I might add, too). But, from time to time, find I want to play a file on something that doesn’t support it.

Given sufficient storage space, I’d rip to a lossless format, like flac. That gives you a good archive of the file. Then if you want to export to a hardware device, you have the choice of doing it any way that you like, without degradation.

Another issue that crops up with various audio formats is an inability to do gapless playback of albums. That can depend on the format and the player.

Why I put this post together

Certain Free Software tricks can save people a LOT of time and frustrations. Finding them quickly, in a quickly usable format may not be easy, especially for novice Freedom users. Sometimes the really important parts are scattered across a long discussions. When I find such discussions, I hope to make a public utility service by reformatting their most important parts in one post. Of course, all the credit for the solutions and explanation goes to their authors, in this case the Fedora list members who participated in the original discussion.