How to get a bunch of MP3s onto an audio CD

The reason for my writing this little how-to is because, well, I'm awaiting the last MP3 of the LP: Spectres, from Blue Oyster Cult to download on my modem from alt.binaries.sounds.mp3.1970s. I have nothing better to do; so I'll write a little how-to on what I am doing.

Note: These directions apply to FreeBSD being run on a regular PC (i386) with an atapi CDRW hooked up at /dev/acd0c. If your configuration is slightly different, you should be able to make a simple adjustment. If you have a "sczy" CDRW, you'll probably use a different application for writing your CD. I'll be using "burncd" since it runs well on an isa CDRW.

Directions:

Slap all your MP3s into a single directory.

Using the Borne shell, type the following sequence:

mkdir cd
ls *.mp3 |
> while read file
> do madplay "$file" "--output=wav:$file.wav"
> done

"madplay" is a part of the mad toolkit: /usr/ports/audio/mad.

Then, in the same directory:

normalize -b *.wav

"normalize" is also a port: /usr/ports/audio/normalize. It normalizes the volume on a wav file. When the -b switch is used, it normalizes the volume on a collection of files. This step is optional; so if you prefer to skip it, the line above that reads   > do madplay "$file" "--output=wav:$file.wav" can be altered to read   > do madplay "$file" "--output=raw:cd/$file.raw" and the next step skipped. The reason is because it is best to burn raw files to an audio CD. "normalize" works only on WAVs. If you skip the "normalize" step, then you can also skip the WAV step.

Next, execute the following sequence:

ls *.wav |
> while read file
> do sox "$file" "cd/$file.raw"
> done

"sox" is a utility that can change an audio file of one audio format into another audio format. Find it under (you guessed it): /usr/ports/audio/sox. It doesn't support mp3, so we used "madplay" to convert the MP3s to WAVs.

For the next step, I need to "su" to root. I could change that requirement in a few minutes. I just haven't gotten around to it. Anyway, with a blank CD in the drive, execute...

cd cd
burncd -f /dev/acd0c -s [burn speed] audio *.raw fixate

That's about it.


Footnote: Sometimes your MP3 files are not in stereo or are otherwise in a format that results in your final product sounding like chipmonks. If this happens, modify your conversion from WAV to RAW thusly:

ls *.wav |
> while read file
> do sox "$file" -r 44100 -c 2 -w "cd/$file.raw"
> done

Another footnote: It seems that the "sox" program has been improved such that it is able to convert directly from mp3 to raw. If this be the case with your installation, you can handle the whole conversion like this:

ls *.mp3 |
> while read file
> do sox "$file" -r 44100 -c 2 -w "cd/$file.raw"
> done