From: andrew@alice.att.com (Andrew Hume)
Newsgroups: rec.audio
Subject: AES/EBU
Date: 4 Sep 92 21:00:14 GMT
Article-I.D.: alice.23632
Organization: AT&T Bell Laboratories, Murray Hill NJ


	Philip Greenspun is having trouble with his news server so he asked
me to post this description of the AES/EBU stuff. It is partially in
response to the discussion on the TAS article on digital stuff.
Please, if you wish to respond, don't respond to me; philip's email
is martigny.ai.mit.edu!philg

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

Well, you really need to buy The Art of Digital Audio by Watkinson
(Focal Press, 1988) as a starting point.  I also recommend getting a
copy of the AES/EBU standards document (I looked for mine but couldn't
find it) from either AES or EBU.

As far as voltages go, for AES/EBU you are talking about a balanced
line and XLR connectors.  According to Watkinson, receiver impedance
should be 250 ohms so that several receivers can be driven by a single
transmitter.  I thought that everything was supposed to work with old
600 ohm lines and termination so I'm obviously confused.  However, the
standard is so loose that I'm sure it works no matter how you
terminate.  Voltages are supposed to be between 3 and 10V p-p.
However, the receiver is supposed to be able to detect a signal when
there is only 200mV p-p.

SPDIF uses exactly the same bit patterns, but different connectors,
cables, voltages and impedances.  In this case, a direct connection is
envisioned via video-type RCA phono plug cables (i.e. what you use to
hook up two VCRs).  Like video we are talking about a signal that is
1V p-p unterminated and 0.5V p-p when terminated with the expected 75
ohm resistor.

I had the standard for optical interconnection but couldn't find it.
It talks about optical power per square mm and other confusing
matters.

The encoding scheme is called biphase marking and falls into a loose
group of techniques commonly called Manchester coding (the AES/EBU
standard does not refer to "Manchester coding" per se however).

----------------------------------
Each sample is transmitted in the following 32 bit word:

0-4 preamble (violates the biphase coding scheme so you know where to
sync up, and does so in a distinctive manner so you know if it is a
Right sample, a Left sample, or a Left sample that happens to begin a
channel status word block of 192 samples)

4-7 auxiliary data bits for either moby samples (24 bits) or an extra
voice-grade track (e.g. DCC or MD!)

8-27 the 20 bit audio sample itself, LSB in bit 8 

28 Valid flag (deassert if data is garbage from interpolator or
something)

29 User data (part of 192 bit string in channel status block -- CD
players stuff this with subcode data)

30 channel status data (part of a separate 192 bit string that
includes info such as SCMS, sampling rate, what kind of machine is
transmitting, etc.)

31 word parity

Bit 0 is transmitted first.
----------------------------------

Manchester coding is a way of transmitting both clock and data using
only a single voltage (i.e. one wire).

Here is how it works:

Divide time up into bit cells, in the case of 44.1 KHz digital audio,
there will be about 2.8 million of these per second (44100 X 2
(stereo) X 32 (bits/sample in the bloated word)).  At the beginning of
each bit cell, ALWAYS insert a transition.  In other words, if we had
a 1 at the end of the last bit cell, drag the voltage down to a 0
level.  If we were at 0 before, pull up to 1.  In the middle of the
bit cell, if the bit to be transmitted is a 0, do not insert a
transition (leave at 1 if 1, leave at 0 if 0).  If the bit to be
transmitted is a 1, insert a transition in the middle of the cell.

Thus, approximately half the cells will contain transitions and half
will not.  However, the beginning of every single cell will have a
transition.

There are many ways of building circuits that recover the frequency
and phase of the clock signal here, i.e. that can find the beginning
of each bit cell and set a voltage-controlled oscillator to hum away
at the right frequency.  Given the clock, it is easy to recover the
data by sampling 1/4 of the way into the bit cell and then sampling
again 3/4 of the way in (if the values are the same, declare a 0,
otherwise, declare a 1).

All this sounds great until one realizes that there is now way to
realize where words start.  There are inefficient schemes such as that
used on CDs themselves to, say encode every 8 bits in a 14 bit word,
but the standard chooses to violate the Manchester code sometime
during the first four bit cells of each word to make the beginning of
words.

Some friends of mine and I designed a decoder that gets clock and data
with just three cheapo PALs.  The basic idea is a high frequency state
machine that watches the incoming data (something like 8 states per
bit cell) and kicks the VCO up or down depending on what it sees.  You
can't prove mathematically that it will sync, but it always worked for
us (mathematical confidence is unattainable for most phase-locked
loops so that doesn't mean ours was inferior in any way).

I hope this helps.

Philip Greenspun
MIT Department of EE
Newsgroups: rec.audio