S/PDIFS/PDIF, for Sony/Philips Digital Interconnect Format, is a system for carrying stereo digital audio signals between various devices and stereo components. S/PDIF is primarily used with CD players (and DVDs playing CDs), and it is becoming common on other audio components like MiniDiscs and modern computer audio cards. It is also popular in car audio, where the former mess of wiring can be replaced with a single fibre optic cable, which is immune to noise.
S/PDIF was developed from a standard used in the professional audio field, known as AES/EBU which is commonly used in DAT systems. S/PDIF remained identical at the protocol level, but changed the physical connectors from XLR to either electrical RCA jacks or optical TOSlink, both of which cost less and are easier to use. S/PDIF is, for all intents, a consumer version of the AES-EBU format.
S/PDIF is used to transmit digital signals of a number of formats, the most common being the 48ksps (kilo-samples-per-second) format used in DAT, and the 44.1ksps format used in CD audio. In order to support both systems, as well as others that might be needed, the format has no defined data rate. Instead the data is sent using biphase-mark-code, which has two transitions for every bit, this allows the original clock to be extracted from the signal itself.
The data format conisists of a stream of 32-bit data words sent in blocks of 192 words for each channel of audio data. For normal stereo audio, a series of 384 words would be sent, a series of words for channel A (left), then B (right), then A again. A set of words for one sample for every channel is known as a frame, in this case 64-bits for a set of words for A and B. A word for any particular channel in a frame is a subframe.
Within each frame multiple types of data can be sent, identified by a code in the first four bits of each word. Although this allows for up to 16 different codes, only three are defined:
- B - Start of block, data is always for channel A (left)
- M - additional data for channel A
- W - data for channel B (right)
Bits 8 to 27 carry 24 bits of audio signal. If the signal source uses less than 24 bits per sample, the lower-order bits are filled with zeros. For instance, CD's use 16-bit samples, so when carrying a CD signal bits 4 to 12 are set to zero and the sample is sent in the rest of the bits.
The last four bits are various status and error checking codes. Bit 28 is the "Validity" bit, if this is not set that particular word is not played. This is used by CD players to indicate that they had problems reading that sample. Bits 29 and 30 are used to send additional data at a low rate, the Subcode and Channel-status info. Bit 31 is a parity of the word, excluding bits 0 through 3.
The Channel-status bits of any particular frame are extracted into a single 192-bit control word. Bit 0 indicates 2 or 4 channel audio, bit 2, if set, stops copying of the signal, and bits 9 to 15 are used to indicate the data type. The rest are currently unused.
Subcode is used to carry data for the SCMS system, indicating if the signal is an original or a copy. This is used by DAT systems to control copying.