Some tech documentation and snippets, finally organized.

Burning a mixed-mode CD-R

It is possible to "enhance" an audio CD with arbitrary files as a bonus track. The following post shows how to create such a mixed-mode CD or enhanced CD on the command line.

Create suitable wav files with libav-tools

$ for i in $(ls); do avconv -i $i /path/to/outdir/$i.wav; done

Note: ffmpeg will work as well, with the same syntax and options: just /avconv/ffmpeg/.

Burn the audio-tracks

$ cd $WAVDIR
$ wodim -v dev=/dev/sr0 speed=4 -multi -audio *.wav

The -multi switch (for multi session) is necessary to prevent wodim from closing the disk after burning. Additionally, I use the slow speed=4 option to burn sharper delimited dots and thus enhance the disk's readability in older (or dusty) audio players.

Analyze the audio-session and prepare the "bonus track"

$ TRACKINFO=`cdrecord -msinfo dev=1,0,0`

In this case, the first session started at sector 0 and the following will start at sector 105248. This information can now be passed to mkisofs or the newer xorrisofs:

$ xorrisofs -J -r -C $TRACKINFO -V $16_CHAR_DISKLABEL -o /path/to/data.iso /path/to/data

Append the iso to the disk

$ wodim -v dev=/dev/sr0 -data /path/to/data.iso

The resulting CD will serve the first session to all common audio CD players, while the second (data) session can be accessed with a CD-ROM drive.

Note: Not all CD-ROM drives support mixed-mode media - some may fail to access the audio tracks from the first session.