Friday, April 29, 2005

The Proof is in the Bi-Phase Coding

Well, I figured it might be helpful to figure out what my speakers expected to see if they were ever to play AC-3 files over S/PDIF. So back to Google. Ah, some company called Audio Precision puts out a series of technotes on audio electronics. Technote 26 is on "The Digital Interface," and it lays out what my speakers expect to see. (You need to register to get the full technote.)

Of non-practical interest to me, the signal sent over the TOS-Link uses Bi-Phase Coding which is a clever encoding scheme which insures that regardless of the data (all binary 1's, all binary 0's or any mixture) the receiver gets a constant stream of regularly spaced signal transitions with which to sync itself.

Of practical import is a little history. The S/P DIF standard did indeed only expect to transport PCM encoded, uncompressed, two channel data, and then at some point, someone asked whether it would be possible to transport multi-channel compressed audio over the same connection, using the same protocol. Would the wires, encoders circuitry, decoder circuitry, etc. care if instead of PCM style data, there were the bytes from a compressed audio stream? Well no, especially if a bit was set in every data frame saying that it was "invalid" audio, and if periodically a channel status block was sent out saying that the channel was sending out "non-audio". Bytes is bytes. A receiver which didn't know about compressed formats would see such a stream and go into mute mode awaiting valid audio. A receiver designed to play raw AC-3 files, would know to see if the stream being sent appeared to be an AC-3 stream. Newer receivers might even look for Microsoft audio streams, and future receivers might know to look for some futuristic format. The only requirement being that the compressed audio fit in a bandwidth adequate for uncompressed stereo, and that your receiver know about it. This extension (hack) to S/P DIF is called IEC61937.

So the question still remains, how do you set the invalid audio bit of the PCM frame, and the channel status packet?