HowTo: Create audio BIN/CUE
I know there are lots of tools out there that automatically create BIN/CUE files - but most of them only by ripping the CD.
But I wanted to create an exact digital master, generated out of the original WAV files.
It's not that difficult, because a BIN file is a plain PCM encoded audio stream with the following parameters:
- PCM encoding
- 44100 Hz
- 16 bits
- 2 channels
- little endian
The CUE sheet is a simple textfile.
Creating the BIN
For audio conversion, I've used SoX (the Swiss Army knife of sound processing programs).
Usually, you have a pause between your tracks. The default duration is 2 seconds. CD burning applications create a silence-audio with that duration for you, but we have to do it manually.
sox -t raw -c 2 -s $ENDIAN -2 -r 44100 /dev/zero $SILENCE trim 0 $DURATION
Converting the WAVs bin raw PCM
for WAV in $SOURCE; do
echo "File: $FILENAME"
sox $WAV -s -2 $ENDIAN -2 -r 44100 $FILENAME.raw
Putting it all together
Now we just have to 'glue' the audio files with silence in between together. Since raw PCM has no header, and 'cat' is byte-safe, we can simply copy it into the final BIN:
for RAW in $SOURCE; do
echo "RAW file: $FILENAME"
cat $RAW >> $BIN
cat $SILENCE >> $BIN
Creating the CUE
I've used cdrdao for verifying the resulting BIN/CUE combination.
- I've ripped other audio CDs to get reference BIN/CUE examples.
- I've burned my generated BIN/CUE with cdrdao
For some reason, cdrdao reads/writes BIN images in big endian. The CD burning tool at our production facility however, expected little endian!
So you might want to clear with your production facility if they expect little or big endian!