This article is from the CD-Recordable FAQ, by Andy McFadden (email@example.com) with numerous contributions by others.
The pits and lands on a CD do not directly correspond to 1s and 0s.
The start and end of a pit (i.e. the pit edges) each correspond to 1s,
and all other areas -- both in pits and on lands -- correspond to 0s.
The number of zeroes between pit edges is determined through careful timing.
This is an efficient approach that produces an easy to handle electrical
signal (it's NRZI -- NonReturn to Zero Inverted -- which converts easily
to NRZ where 1s are high voltage and 0s are low voltage).
The careful timing is possible because CDs are essentially self-clocking.
Suppose you have a clock that ticks once per second. Plug your ears and
count seconds to yourself, trying to keep the same pace as the clock.
After ten seconds, unplug your ears. If you've drifted slightly, you can
readjust to the clock without worrying that you've too far off. You might
be missing the beat by a quarter of a second, but you can adjust forward
or backward a fraction of a second and still be sure that both you and
the clock got to 10 seconds at about the same time. Now try the same
experiment for 10 minutes. When you unplug your ears you can get back
in sync with the clock's timing, but unless you have a very good internal
timer it's unlikely you will reach 10 minutes on the same tick. With your
ears plugged for so long, you are likely to be off by several seconds.
CDs work the same way. Every pit edge represents an audible clock tick,
while the insides of pits and lands represent inaudible ticks. If a pit
or land is too long, the drive's clock will drift too far and possibly
get out of sync. (This is why "blank" recordable discs aren't entirely
blank: they have a pre-cut spiral groove with a "wobble" that the recorder
can use as a timing signal. A clock accurate enough to produce a stable,
reliable signal at these frequencies is too expensive to incorporate into
a cheap consumer product. The 22.05KHz wobble is frequency-modulated by
+/-1KHz to create the ATIP signal that, in the lead-in area, holds some
bits of information about the disc.)
To guarantee pits of specific lengths, the CD standard requires that
there are at least 2 and at most 10 zeroes between every 1. This is
achieved by converting every 8-bit byte into a 14-bit value, a process
called Eight to Fourteen Modulation (EFM).
The shortest possible pit (or land) thus represents 3 EFM bits (100),
and the longest 11 EFM bits (10000000000). If a single bit requires time
T to pass under the read head, then pits of these lengths can be referred
to as 3T pits and 11T pits. If after seeking to a new location, the drive
sees a pit shorter than 3T or longer than 11T, then it immediately knows
that the disc is not spinning at the rate it was expecting, and can make
Between each 14-bit EFM word there are 3 "merging bits". Because CDs aren't
allowed to have runs shorter than 3T or longer than 11T, it is sometimes
necessary to follow an EFM code with a 1 or 0. Suppose, for example, that
an EFM code ending in 1 were immediately followed by an EFM code starting
with 1. The merging bits also serve to prevent the frame synchronization
pattern from appearing where it isn't supposed to (see next section).
If there is more than one possible arrangement of merging bits that satisfy
the restrictions for run length and sync pattern, then a pattern is chosen
that minimizes the low-frequency components of the signal. This is done by
minimizing the Digital Sum Value (DSV), computed by adding one to a counter
for every T after a transition to a land, and subtracting one for every
T after a transition to a pit. Adding a 1 to the merging bits inverts
the signal by causing a transition from a pit to a land or vice-versa.
Minimizing the DSV is important because low-frequency signals can interfere
with the operation of tracking and focusing servos.
With EFM there are more bits to encode, but the highest frequency
possible in the output signal is decreased. The ratio of the number
of bits transmitted to the number of transitions on the medium is high,
making this an efficient way to store the data while still being able to
recover the clock. It's also worth noting that a 3T pit is 0.833um long,
while the laser spot is just over twice that length at 1.7um. If 2T or
1T pits were allowed, the laser would have a hard time detecting them.
This is why it's important that transitions not occur too frequently:
the laser is good at computing the time between transitions, but isn't
so good at noticing transitions if they follow each other too quickly.
Making the transitions more obvious requires making the pits and lands
longer, which reduces the amount of data that will fit on the disc.
(See the description of AMQ in section (2-41).)