[sci.electronics] CD Digital Output

clldomps@cs.ruu.nl (Louis van Dompselaar) (05/30/91)

A short while ago, there was a question on the digital output
on a CD-player.
I've looked up an article in Elektuur, March 1988 and translated
it into English. Any ommisions are therefore not my fault.
The article didn't say much about the hardware-side of the matter,
so if anyone can enlighten this a bit, I would be pleased to hear.

Louis van Dompselaar
clldomps@praxis.cs.ruu.nl

-----------------------------------------------------------------

The interface
-------------


The interface is a 'consumer' version of the AES/EBU-interface.
The most significant difference is the choice of connections.
Originally, the AES/EBU-interface uses the well known
symmetrical connections with impedancetransformers and an output
impedance of 110 ohm. The signal-level of this interface is
reasoably higher than in the consumer version (3...10 volts).
There are no real differences in the signals that are used and
the format in which the data is encoded.

The signal on the digital output of, for instance, a CD-player
is an almost perfect sine-wave, with an amplitude of 500 mVtt
and a frequency of almost 3 MHz.

For each sample, two 32-bit words are transmitted, which results
in a bit-rate of:

    2.8224 Mbit/s  (44.1 kHz samplingrate, CD, DAT)
    3.072  Mbit/s  (48 kHz sampling rate, DAT)
    2.048  Mbit/s  (32 kHz sampling rate, for satellite
		    purposes)

The output impedance is standard 75 ohm, so ordinary coax
can be used. In fact, the minimal input level is 200 mVtt, so
there is no real need for special quality cable.


The Coding Format
-----------------

The digital signal is coded using the 'biphase-mark-code' (BMC), which
is a kind of phase-modulation.
In this system, two zero-crossings of the signal mean a logical
1 and one zero-crossing means a logical 0.




		_   _   _   _   _   _   _   _   _   _   _   _
               | | | | | | | | | | | | | | | | | | | | | | | |
clock   0 ___ _| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_


		___         _______     ___         ___
               |   |       |       |   |   |       |   |
data    0 ___ _|   |_______|       |___|   |_______|   |___
signal           1   0   0   1   1   0   1   0   0   1   0


		_   ___     _   _   ___   _     ___   _
Biphase        | | |   |   | | | | |   | | |   |   | | |
Mark    0 ___  | | |   |   | | | | |   | | |   |   | | |
signal         | | |   |   | | | | |   | | |   |   | | |
	      _| |_|   |___| |_| |_|   |_| |___|   |_| |___

cells           1 0 1 1 0 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 0


The frequency of the clock if twice the bitrate.
Every bit of the original data is represented as two logical
states, which, together, form a cell.
The length of a cel ('time-slot') is equal to the length of
a databit. The logical level at the start of a bit is always
inverted to the level at the end of the previous bit.
The level at the end of a bit is equal (a 0 transmitted) or
inverted (a 1 transmitted) to the start of that bit.

The first 4 bits of a 32-bit word (bits 0 through 3) form a
preamble which takes care of synchronisation.
This sync-pattern doesn't actually carry any data, but only
equals four databits in length. It also doesn't use the
BMC, so bit patterns which include more than two 0's or 1's
in a row can occur (in fact, they always do).

There are 3 different sync-patterns, but they can appear in
different forms, depending on the last cell of the previous
32-bit word (parity):

   Preamble    cell-order         cell-order
	       (last cell "0")    (last cell "1")
   ----------------------------------------------
   "B"         11101000           00010111
   "M"         11100010           00011101
   "W"         11100100           00011011

Preamble B: Marks a word containing data for channel A (left)
	    at the start of the data-block.

Preamble M: Marks a word with data for channel A that isn't
	    at the start of the data-block.

Preamble W: Marks a word containing data for channel B.
	    (right, for stereo). When using more than 2
	    channels, this could also be any other channel
	    (except for A).


Word and Block Formats
----------------------

Every sample is transmitted as a 32-bit word (subframe).
These bits are used as follows:

   bits           meaning
   ----------------------------------------------------------
   0-3            Preamble (see above; special structure)

   4-7            Auxillary-audio-databits

   8-27           Sample
		  (A 24-bit sample can be used (using bits 4-27).
		   A CD-player uses only 16 bits, so only bits
		   13 (LSB) to 27 (MSB) are used. Bits 4-12 are
		   set to 0).

   28             Validity
		  (When this bit is set, the sample should not 
		   be used by the receiver. A CD-player uses
		   the 'error-flag' to set this bit).

   29             Subcode-data

   30             Channel-status-information

   31             Parity (bit 0-3 are not included)


The number of subframes that are used depends on the number of
channels that is transmitted. A CD-player uses Channels A and B
(left/right) and so each frame contains two subframes.
A block contains 192 frames and starts with a preamble "B":


"M" Ch.1 "W" Ch.2 "B" Ch.1 "W" Ch.2 "M" Ch.1 "W" Ch.2 "M" ...

|                ||_ sub __|_ sub _||                |
|                ||                ||                |
|__ Frame 191 ___||__ Frame   0 ___||__ Frame  1 ____|

		  |
             block-start


Channelstatus and subcode information
-------------------------------------

In each block, 384 bits of channelstatus and subcode info are
transmitted.
The Channel-status bits are equal for both subframes, so
actually only 192 useful bits are transmitted:

   bit            meaning
   -------------------------------------------------------------
   0-3            controlbits:

		  bit 0: is set during 4 channel transmission.
		  bit 1: 0 (reserved)
		  bit 2: copy-protection. Copying is allowed
			 when this bit is set.
                  bit 3: is set when pre-emphasis is used.

   4-7            0 (reserved)

   9-15           catagory-code:

		  0 = common 2-channel format
		  1 = 2-channel CD-format
		      (set by a CD-player when a subcode is
		       transmitted)
                  2 = 2-channel PCM-encoder-decoder format
		      
                  others are not used

   19-191         0 (reserved)


The subcode-bits can be used by the manufacturer at will.
They are used in blocks of 1176 bits before which a
sync-word of 16 "0"-bits is transmitted

-----------------------------------------------------------------