Cuesheet

From DOSBoxWiki
Revision as of 12:43, 13 April 2010 by WikiSysop (talk | contribs) (Reverted edits by 91.214.45.95 (Talk) to last revision by WikiSysop)
Jump to navigationJump to search

Cuesheet

Cuesheet is a file format that specifies track structures of mixed mode compact discs. It can be used with DOSBox, when a game needs to access audio tracks of its CD that is stored as an image file. The prevalent ISO format can only store data tracks.

The CUE/BIN format for CD images

Cuesheets usually come as a CUE/BIN pair. The cuesheet, e.g. image.cue, is an ASCII text file that stores the access information for the “disc at once” binary dump, e.g. image.bin, of the CD's contents. (For more info on the cuesheet file format see here.)

Mounting a CUE/BIN pair is done in the usual way with

Z:\>IMGMOUNT E C:\Images\MyImage.cue -t iso

An exemplary cuesheet is:

FILE "image.bin" BINARY
  TRACK 01 MODE1/2352
    INDEX 01 00:00:00
  TRACK 02 AUDIO
    PREGAP 00:02:00
    INDEX 01 35:17:41
  TRACK 03 AUDIO
    INDEX 01 37:37:70
  TRACK 04 AUDIO
    INDEX 01 39:02:74
  TRACK 05 AUDIO
    INDEX 01 41:34:17
  TRACK 06 AUDIO
    INDEX 01 43:43:29
  TRACK 07 AUDIO
    INDEX 01 46:35:11
  TRACK 08 AUDIO
    INDEX 01 48:47:52
  TRACK 09 AUDIO
    INDEX 01 51:29:30
  TRACK 10 AUDIO
    INDEX 01 53:43:54
  TRACK 11 AUDIO
    INDEX 01 56:28:53
  TRACK 12 AUDIO
    INDEX 01 58:53:44
  TRACK 13 AUDIO
    INDEX 01 60:53:66

Windows

Use a CD burning application like CDRWIN that can write image files in cuesheet format. (An alternative to mounting the CUE/BIN images directly with DOSBox is to load it with the Daemon Tools or similar virtual drives and mount that volume instead like a normal CD-ROM.)

Linux

In order to produce a CUE/BIN pair with Linux use the commands

> cdrdao read-cd --datafile image.bin --driver generic-mmc:0x20000 --device /dev/cdrom --read-raw image.toc
> toc2cue image.toc image.cue

The option --driver generic-mmc:0x20000 takes care of the correct byte order. Omitting it would lead to noise instead of music.

Mac OS X

Producing a CUE/BIN pair under Mac OS X is similar to Linux, but with a couple of modifications. First, you need to install the "cdrdao" package from either MacPorts (recommended), Fink, or from source. Then, insert your CD. It will mount automatically, and you'll need to unmount it with a command like:

bash$ disktool -u disk3
disk3 device will be unmounted ...
***Notifications Complete for type 1
***Responding yes to unmount - disk3s0
***Disk Unmounted('disk3s0')
***Responding yes to unmount - disk3
***Disk Unmounted('disk3')

Substitute the appropriate disk for "disk3". You can find out which diskX block device corresponds to your CD or DVD drive by using the "mount" command.

After unmounting, the instructions are similar to Linux, except with a different device:

cdrdao read-cd --datafile image.bin --driver generic-mmc:0x20000 --device IODVDServices/0 --read-raw image.toc
toc2cue image.toc image.cue

Compressed audio tracks

Another advantage of cuesheets is the possibility to compress audio tracks. The image of a CD's contents can split into an ISO image of the data track and one or more compressed files in OGG or MP3 format for the audio tracks. This method can drastically reduce the image's size without a substantial loss of audio quality.

First you have to rip and encode the audio tracks. The the cuesheet will have to be edited. Mind the changes for the first TRACK and the INDEX tags.

FILE "image.iso" BINARY
  TRACK 01 MODE1/2048
    INDEX 01 00:00:00
FILE "track02.ogg" MP3
  TRACK 02 AUDIO
    PREGAP 00:02:00
    INDEX 01 00:00:00
FILE "track03.ogg" MP3
  TRACK 03 AUDIO
    INDEX 01 00:00:00
FILE "track04.ogg" MP3
  TRACK 04 AUDIO
    INDEX 01 00:00:00
FILE "track05.ogg" MP3
  TRACK 05 AUDIO
    INDEX 01 00:00:00
FILE "track06.ogg" MP3
  TRACK 06 AUDIO
    INDEX 01 00:00:00
FILE "track07.ogg" MP3
 TRACK 07 AUDIO
    INDEX 01 00:00:00
FILE "track08.ogg" MP3
  TRACK 08 AUDIO
    INDEX 01 00:00:00
FILE "track09.ogg" MP3
  TRACK 09 AUDIO
    INDEX 01 00:00:00
FILE "track10.ogg" MP3
  TRACK 10 AUDIO
    INDEX 01 00:00:00
FILE "track11.ogg" MP3
  TRACK 11 AUDIO
    INDEX 01 00:00:00
FILE "track12.ogg" MP3
  TRACK 12 AUDIO
    INDEX 01 00:00:00
FILE "track13.ogg" MP3
  TRACK 13 AUDIO
    INDEX 01 00:00:00

Warning: The length for the compressed audio tracks will never exactly match the original play length. It will deviate some frames (1 frame = 1/75 sec) from the correct values.

The ISO-image of the data track can be mastered with any CD Burning application.

Linux

In order to rip and encode the audio tracks you can use the commands

> cdparanoia -B "2-"
> oggenc *.wav

Warning: It may be that DOSBox does not support encoded tracks out of the box, depending on your distro. (The official release for Windows normally does.) If not, you will have to compile it by yourself: After unpacking the sources and doing ./configure, check that #define C_SDL_SOUND 1 has been set in config.h. (For example, the package SDL_sound-devel has to be present for Suse Linux 11.0 in order to set the flag.) Then proceed as usual (see README and INSTALL for reference).