# Compact Disc subcode

Subcode or subchannel data (called control bytes in the CD-ROM specification) refers to data contained in a compact disc (CD) in addition to digital audio or user data, which is used for control and playback of the CD. The original specification was defined in the Red Book standard for Compact Disc Digital Audio, though further specifications have extended their use (including the CD-ROM, CD Text and CD+G specifications).

## Structure

Subchannel data is multiplexed with the digital audio or user digital data. The data in a CD are arranged in frames. A frame comprises 33 bytes, of which 24 bytes are audio or user data, eight bytes are error correction (CIRC-generated), and one byte is for subcode. Frames are arranged in sectors, which contain 98 frames each. The subcode bytes of the first two frames of a sector are used as two synchronization words. The subcode bytes of the remaining 96 frames of a sector are split into eight 96-bit long subcode channels (also called subchannels or simply channels) by putting together the nth bit of each subcode byte. Each channel has a bit rate of 7.35 kbit/s.
Each subcode bit/subchannel is designated by a letter from P to W. The following diagram illustrates how the channels are laid out:
Subcode / control byte :
| Bit | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
| Channel | P | Q | R | S | T | U | V | W |
| Frame 1 | Sync word 1 | Sync word 1 | Sync word 1 | Sync word 1 | Sync word 1 | Sync word 1 | Sync word 1 | Sync word 1 |
| Frame 2 | Sync word 2 | Sync word 2 | Sync word 2 | Sync word 2 | Sync word 2 | Sync word 2 | Sync word 2 | Sync word 2 |
| Frame 3 | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data |
| Frame .. | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data |
| Frame .. | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data |
| Frame .. | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data |
| Frame 98 | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data | Channel data |

## Channels

Both the P and Q channels on a regular audio CD are used for timing information. They assist the CD player in tracking the current location on the disc, and to provide the timing information for the time display on the CD player. The rest are not used in the Red Book specification.
* Channel P is a simple "pause music" flag, which can be used for low-cost search systems. Many players ignore it in favor of the Q Channel. It indicates a start of a new track by at least two consecutive seconds (150 sectors) of all 1s, and the last block with all 1s is the first block of the new track.
* Channel Q is used for control purposes of more sophisticated players. It has three different modes, but with a common structure for all of them.
** Control bits: The first four bits are used for control, each being a flag for a different feature:
*** Four-channel Compact Disc digital audio flag: indicates that the track uses four-channel audio (applies only to CD-DA). This is very rarely used on Compact Discs.
*** Data flag: Indicates that this track contains data (rather than audio). Can be used for muting in audio CD players. Not used in the original CD-DA standard, added in the CD-ROM specifications.
*** Digital copy permission flag: Used by the Serial Copy Management System to indicate permission to digitally copy the track.
*** Pre-emphasis flag: The audio track was recorded with pre-emphasis (applies only to CD-DA). Used very rarely on Compact Discs.
** Mode bits: The next four bits indicate the mode of the Q channel, which can vary from 1 to 3, and define the structure and contents of the next bits.
** Data bits: The next 72 bits contain Q-channel data, and their structure depends on the mode defined in the previous bits.
*** Q Mode 1: In this mode, the data bits contain the Table of Contents of the session (if the Q channel is in the lead-in area), or timing information for the current track (if the Q channel is in the program and lead-out areas of a session).
*** Q Mode 2: In this mode, the data bits contain the Media Catalog Number (MCN) of the disc.
*** Q Mode 3: In this mode, the data bits contain an International Standard Recording Code (ISRC) for each track (applicable to CD-DA only). The ISRC is used by the media industry, and contains information about the country of origin, the year of publication, owner of the rights, as well as a serial number.
** Cyclic redundancy check bits: The last 16 bits contain an error detection code computed over the previous bits of the channel.
* Channels R through W are unused by Red Book compliant CDs and Yellow Book compliant CD-ROMs, and have been used for extensions to the standard:
** CD-Text is an extension to the Red Book standard for audio CDs. It allows for storage of additional information (e.g. album name, song name, and artist) on the R through W subcode channels on the disc (either in the lead-in area or in the program or main area).
** The CD+G or "karaoke" extension also uses the R through W subcode channels to store low resolution graphics.
** Several copy protection systems made use of the fact that some disk copying utilities neglect to copy subcode data due to the obscurity of it. CloneCD can read subcode data and save it to a CloneCD Control File.

## Jack on CD players

Some older CD players, such as the Pioneer PD-5010, have a socket for an eight-pin mini-DIN connector on the back labeled "Subcode Out".