Advertisements

Archive for December 29th, 2015

Command-line CD Ripping & Encoding

A recent and rather battered book-on-CD posed more than the usual problems for Asunder, so I finally broke down and fiddled around with cdparanoia and lame. This has obviously been done many times before, but breaking it into two simple steps per CD makes the inevitable errors easier to find and work around.

Invoke cdparanoia thusly to rip an entire CD into separate tracks:

cdparanoia -B -v

The files popĀ out sporting names like track01.cdda.wav, but they won’t be around long enough for you to develop a deep emotional attachment.

Throw a handful of parameters at lame to convert the WAV files into tagged MP3 files:

d=7
for t in {01..18} ; do lame --preset tape --tt "D${d}:T${t}" --ta "Author Name" --tl "Book title" --tn "${t}/18" --tg "Audio Book" --add-id3v2 track${t}.cdda.wav D${d}-${t}.mp3 ; done
rm track*

There’s surely a way to make a double substitution work in the track sequence, but the syntax, ah, escapes me at the moment.

You might want to not delete the WAV files until you’re happy with the MP3 results.

In any event, that producesĀ a sequence of MP3 files imaginatively named along the lines of D1-01.mp3, which fits neatly into the cramped LCD space available on an MP3 player.

Your quality preferences may differ…

Advertisements

3 Comments