The most recent iteration of ripping a book-on-CD to bits suitable for a small MP3 player begins by defining the metadata:
author="Whoever Wrote It"
title="Whatever It May Be About"
Set up a suitable directory for the MP3 files, with a subdirectory for the WAV files direct from the CD:
mkdir "$author - $title"
cd "$author - $title"
mkdir waves
Then unleash cdparanoia
on each disk, but with its error checking dialed back to a minimum because most errors don’t produce much audible damage:
d=01 ; cdparanoia -v -Y --never-skip=1 -B "1-" waves/D$d.wav ; eject cdrom
In some cases, however, a nasty gouge (the previous owners being careless, alas) can jam cdparanoia
midway through a track, so I fetch all the remaining tracks:
d=10 ; cdparanoia -v -Y --never-skip=1 -B "6-" waves/D$d.wav
Sometimes re-cleaning the disc and re-reading the offending track produces a better outcome:
d=10 ; cdparanoia -v -Y --never-skip=1 -B "5-5" waves/D$d.wav
With all the WAV files collected, I now know how to unleash multiple lame
conversions for all the tracks on each disc:
for d in {01..12} ; do for t in {01..19} ; do if [[ -f waves/track$t.D$d.wav ]] ; then lame --silent --preset tape --tt "D${d}:T${t}" --ta "$author" --tl "$title" --tn $t --tg "Audio Book" --add-id3v2 waves/track${t}.D${d}.wav D${d}-T${t}.mp3 & fi ; done ; wait ; done
The disc and track ranges correspond to notes written on paper while ripping the CDs, there being no automagic way to collect the information.
That may be easier to read with the control structures spread out:
for d in {01..12}
do for t in {01..19}
do if [[ -f waves/track$t.D$d.wav ]]
then
lame --silent --preset tape --tt "D${d}:T${t}" --ta "$author" --tl "$title" --tn $t --tg "Audio Book" --add-id3v2 waves/track${t}.D${d}.wav D${d}-T${t}.mp3 &
fi
done
wait
done
Affixing an ampersand (&
) to the lame
command drops it into the background, where it runs as CPU time becomes available. The wait
after the first loop stalls until all of the lame
instances for each CD finish.
The kernel scheduler manages to keep the GUI responsive while a four-core CPU makes short work of the entire CD.
When it’s all done, transfer the MP3 files to the player:
cd ..
sudo mount -o uid=ed /dev/sde1 /mnt/part
rsync -vrtu --progress --exclude="waves" "$author - $title" /mnt/part/Music
sync
sudo umount /mnt/part
Fetching commands from history eliminates the need to remember all that, but now it’s written down where I can find it for the next desktop box.
Life is good!