Florian octo Forster's Homepage

octo's guide to create CD-Extra with cdrdao

There are three methods of uniting audio and computer data on one compact disc (CD). The earliest (and most compatible) method is called "Mixed Mode": The first track of an CD contains the computer data, the following tracks contain the audio data. It is impractical, because audio CD-players can "see" the computer data and will try to start playing it ("track one problem"). Later on, some bright minds had the idea of using the first track's "pre-gap" space for the computer data. That works much more smoothly, since (audio) CD-players will skip this area when a CD is played. However, this area is still accessable by the CD-player. The newest and most elegant version has many names. Some of them being "CD-Extra" (prefered in this paper), "CD-Plus" (an old name) or "Enhanced CD". The structure of such CDs is defined in the so called "Blue Book" which is, again, property of Philips and Sony. The technic used here is that the computer data is burned in a second session, which is totally invisible for audio CD players (but - obviously - not for computer CDROM drives).

Mastering the audio tracks

Being a two-sessioned-CD the creation process is two-stepped as well. First, we have to get the audio data onto the blank which is trivial for anybody who ever used cdrdao to burn an audio CD. For this task you need to create a TOC-file first. The format of those files is described in the cdrdao manpage. For a simple example see below:

// audio.toc
CD_ROM_XA

// first track, copy permitted
TRACK AUDIO
COPY
AUDIOFILE "01.wav" 0

// second track, one second pregap
TRACK AUDIO
PREGAP 00:01:00
AUDIOFILE "02.wav" 0

// third track, no pregap
TRACK AUDIO
AUDIOFILE "03.wav" 0

Once you created this file you can test it and, if no error were found, burn it on the blank using the multi-session mode (--multi):

octo@leeloo:~/burn $ cdrdao show-toc audio.toc
# Lots of output follows

octo@leeloo:~/burn $ cdrdao write --multi audio.toc
# Computer should start burning the blank now

Once the recorder is done burning the audio part of the CD-Extra is finished. You may delete the wav-files now if you want to, but you should not remove the blank from the recorder just now. (Unless you are a workaholic and need some more action ;)

Adding the data session

Ok, now the real magic happens. For you that have burned multi session CDs before: What follows now is basically the very same procedure. At first we need to create an image, then a TOC-file (again.. ;) and then, at last, we'll burn it all onto the blank, receiving a very fine, home-brew CD-Extra. To the image-creation part: You now need to know where your first session ended. There is a cdrdao command which will tell you just this:

octo@leeloo:~/burn $ cdrdao msinfo
# Some copyleft information and stuff
# Some information about your drive and used drivers
# And at last:
0,33245

Now we're going to feed these numbers to mkisofs to create an ISO-image of your data session:

octo@leeloo:~/burn $ mkisofs -o data.iso -C 0,33245 ~/files_i_want_to_burn/*

Ok, since we have the image now we can create a TOC-file which is a lot easier this time. There is only one track and the parameters hardly ever change, since there are very few:

// data.toc
CD_ROM_XA

TRACK MODE2_FORM1
DATAFILE "data.iso"

Burning this image is basically just the same as burning the audio tracks. You should note that the --multi parameter is missing this time and cdrdao will close the disk.

octo@leeloo:~/burn $ cdrdao write data.toc
# Computer should start burning the blank now

Congratulations ;) You can go to your favorite audio CD-player and the the CD or you might as well try to mount it first. The choice is yours now :)

Usefull links