Tracks
A CD's program area is divided into tracks. This page covers what a track is, the kinds of track, how a track is marked out with indexes, the gaps around tracks (pregaps and postgaps), and the rules that govern them. The rules explain a lot of the odd behaviour in image formats, such as "the first 150 sectors aren't stored" or "this pregap is missing from the MDF".
DVD-ROMs have no tracks in this sense. A pressed DVD is a single run of sectors. Recordable DVDs have tracks within borders/sessions (see Sessions), but image formats treat a DVD as one track, as the MDS format does with its single "Point 1" data block.
1. What a track is #
A track (logical track, not a turn of the spiral) is a contiguous run of sectors in the program area that:
- has a number from 1 to 99, increasing along the disc. Numbers do not have to start at 1 in later sessions, but they must be consecutive across the disc;
- has one type: audio, or data in one mode (see section 2);
- has one set of CONTROL flags in its Q subchannel (data/audio, copy permitted, pre-emphasis, four-channel);
- is listed in the TOC by its starting address (the address of its index 1);
- is at least 4 seconds (300 sectors) long, not counting its pregap, per the Red Book. Some discs break this rule, and drives cope.
The end of a track is not stored anywhere. It is implied by the start of the next track or, for the last track of a session, by the lead-out (TOC pointer A2). A track's length is therefore:
length(track n) = start(track n+1) − start(track n) (includes track n+1's pregap!)
length(last) = start(lead-out) − start(last)
Note the subtlety in the first line. The TOC start of track n+1 is its index 1, so the difference also counts track n+1's pregap, which physically comes right after track n. Different tools disagree on whether those pregap sectors "belong" to track n or to track n+1. This is the root of the "gap appended to previous / next track" settings in rippers and of several quirks in CUE and MDS handling.
2. Track types #
| Type | CONTROL bit 2 | Sector format | Typical use |
|---|---|---|---|
| Audio (CD-DA) | 0 | 2352 bytes of PCM per sector | music; game soundtracks |
| Mode 1 data | 1 | sync + header + 2048 data + EDC/ECC | ordinary CD-ROMs (PC software) |
| Mode 2 formless | 1 | sync + header + 2336 data | rare |
| Mode 2 XA (Form 1 / Form 2 mixed) | 1 | sync + header + subheader + 2048 (F1) or 2324 (F2) | PlayStation, Video CD, CD-i, Photo CD, multisession CD-ROM XA |
| CD-i | 1 | Mode 2 XA sectors on a disc of type 10 |
Philips CD-i |
The track's type in the TOC is only "audio or data" (CONTROL bit 2). The data mode is not in the TOC. A drive finds it in each sector's header. The disc-wide disc type (CD-DA/CD-ROM 00, CD-i 10, CD-ROM XA 20) is in the PSEC field of TOC pointer A0. Image formats have to record the mode themselves: CUE in the TRACK line, MDS in its track-mode byte, CCD in [TRACK n] MODE=. Some readers ignore those fields and sniff the sector header, because they are sometimes wrong (libmirage does this for CCD).
Mixed Mode discs, common for 1990s games, have one data track (track 1) followed by audio tracks. Enhanced CD / CD Extra / CD Plus discs (the Blue Book) reverse this: audio tracks in session 1 and a data track in session 2, so audio players see only the music. See Sessions.
3. Indexes #
Each track can be subdivided by index numbers, carried in the Q subchannel's INDEX field (Subchannels §4.5):
| Index | Meaning |
|---|---|
| 00 | The pregap (pause) before the track's content. Optional, except for track 1. Q relative time counts down toward zero here, and P = 1. |
| 01 | The start of the track proper. This is the address recorded in the TOC. Required for every track. |
| 02–99 | Optional subdivisions within the track: movements of a symphony, points within a long recording. Players with an "index" button can jump to them. Rarely used. |
Indexes must increase within a track. Index 0 can only appear at the start of a track.
Index positions other than index 1 are not in the TOC. The only way to learn them is to scan the Q subchannel of the whole disc. That makes them easy for image formats to lose:
| Format | Indexes kept |
|---|---|
| CUE | all (INDEX 00 … INDEX 99) |
| CCD | INDEX 0, INDEX 1 per track, plus more in some versions; all of them, implicitly, in the .sub |
| MDS | only the lengths of index 0 and index 1 (8-byte index block). Index 2+ is lost unless subchannel is stored |
| ISO | none |
4. Pregaps #
A pregap is the index-0 area at the start of a track: the "pause" between songs, or the transition area before a data track.
4.1 Track 1's mandatory pregap #
Every disc's first track has a pregap of at least 2 seconds (150 sectors), from absolute time 00:00:00 to 00:01:74 (LBA −150 to −1). LBA 0 is defined as the first sector after it. Because it is always present and normally contains nothing (silence or zeroed sectors in track 1's mode), almost every image format omits it. Readers re-create it.
A longer pregap on track 1 sometimes contains a hidden track one audio (HTOA): a song placed before track 1's index 1, reachable only by rewinding from the start of track 1 on a CD player. Such discs have track 1 starting at, say, 03:30:00, with a 3.5-minute index 0. Formats that assume a 150-sector track 1 pregap (MDS, CCD) cannot store it. Aaru warns: "The disc this image represents contained a hidden track in the first pregap, that this image format cannot store." CUE can, with an INDEX 00 00:00:00 on track 1 and the audio stored in the file.
4.2 Pregaps between tracks #
- Audio after audio: a pregap is optional. Live and continuous albums often have none (gapless). Studio albums often have about 2 s of silence as index 0 (encoded as audio, P = 1).
- Changing track type (data → audio, audio → data, or one data mode → another): the rules require a gap, because a drive must be able to settle on the new format before the track proper begins:
- A data track must have a pregap of at least 2 seconds (150 sectors) in its own mode.
- When it follows a track of a different type, the pregap is extended by at least 1 more second. That second is encoded in the previous track's format (for audio, silence), so the transition sits in the gap rather than at the track start. That makes a minimum of 3 s (225 sectors).
- A data track followed by a track of a different type needs a postgap of at least 2 s (section 5).
- In practice, on pressed Mixed Mode discs, the first audio track after the data track usually has a 150-sector (2 s) pregap. The MDS samples on the MDS page show exactly this. Burners following the Orange Book often write the full 2 s data postgap + 2 s audio pregap.
4.3 What's physically in a pregap #
The pregap's main channel holds whatever the disc was mastered with:
- audio pregaps: usually digital silence, sometimes the tail end of a fade or a hidden song;
- data pregaps: usually Mode 1 or Mode 2 sectors with zero user data. Their headers carry correct addresses, and their mode can differ from the track's in the transition second.
A reader that re-creates a missing pregap has to guess these contents. For audio, silence is usually right. For data, generating sectors with correct sync, headers and EDC/ECC is better than raw zeros, because some software reads into the pregap.
5. Postgaps #
A postgap is a gap at the end of a track. It is not a separate index: the sectors still belong to the track (index 01 or higher), but contain no meaningful data. The rules require a 2-second postgap at the end of a data track that is followed by a track of a different type, such as a data track followed by an audio track. Track-at-once recording also adds a postgap to data tracks (see Sessions §5).
The CUE POSTGAP command adds such a gap without storing it in the file. Most pressed discs don't use one.
6. CONTROL flags per track #
(Bit details are on the Subchannels page.)
| Value | Meaning | CUE FLAGS |
Common where |
|---|---|---|---|
0 |
audio, no copy | (none) | most audio CDs |
1 |
audio with pre-emphasis | PRE |
some 1980s CDs |
2 |
audio, digital copy permitted | DCP |
CD-Rs, some pressed CDs |
8 |
four-channel audio | 4CH |
essentially never |
4 |
data | – (implied by data track type) | data tracks |
6 |
data, copy permitted | DCP |
CD-R data tracks |
5/7 |
data, recorded incrementally (packet writing) | – | UDF packet-written CD-RW |
The flags matter for playback: a player must apply de-emphasis to PRE tracks. Formats store them as follows:
- CUE: the
FLAGSline. - CCD:
Control=of each track's[Entry]. - MDS: the low nibble of the ADR/Control byte.
- ISO: nowhere.
7. Track-at-a-glance example #
A Mixed Mode game disc, track 1 data plus three audio tracks:
abs MSF LBA Q: TNO/INDEX contents
00:00:00 −150 01 / 00 track 1 pregap (Mode 1 zeros) ← not stored by most images
00:02:00 0 01 / 01 track 1 data (ISO 9660 volume, game files)
...
12:22:04 55,504 02 / 00 track 2 pregap: 150 sectors of silence ← sometimes not stored (MDF)
12:24:04 55,654 02 / 01 track 2 audio
...
16:01:50 71,975 03 / 01 track 3 audio (no pregap: gapless)
...
20:44:10 93,160 04 / 00 track 4 pregap (2 s)
20:46:10 93,310 04 / 01 track 4 audio
...
24:50:00 111,600 AA / 01 lead-out (TOC A2)
The TOC lists track starts 00:02:00, 12:24:04, 16:01:50, 20:46:10 and lead-out 24:50:00. Pregap lengths appear only in the subchannel, or in a descriptor that stored them (CUE INDEX 00, MDS index block, CCD INDEX 0).
Sources #
- ECMA-130, §22 and Annex C (tracks, indexes, pause encoding, minimum track length), and the rules on pre-gap/post-gap at changes of track type. https://ecma-international.org/publications-and-standards/standards/ecma-130/
- ECMA-394 (Orange Book equivalent): pregap/postgap rules for recorded discs. https://ecma-international.org/publications-and-standards/standards/ecma-394/
- Aaru
lib/Aaru/Aaru.Images/Alcohol120/Read.cs(hidden track warning),Write.cs("when track mode changes there's a mandatory gap, Alcohol needs it"). - libmirage
lib/cdemu/libmirage/images/image-ccd/parser.c(track mode sniffed from sector data, pregap from index differences). - Wikipedia, "Pregap": https://en.wikipedia.org/wiki/Pregap
- Wikipedia, "Hidden track" (HTOA): https://en.wikipedia.org/wiki/Hidden_track
- Hydrogenaudio Knowledgebase, "Gap" and "Cue sheet" (ripper gap handling): https://wiki.hydrogenaudio.org/index.php?title=Gap