AN22 Application Note OVERVIEW OF DIGITAL AUDIO INTERFACE DATA STRUCTURES Clif Sanchez & Roger Taylor The following information is provided for convenience, but by no means constitutes the entire specification. Also included is information from the IEC958 and the new AES3-199x and TC84 documents. The AES3-199x and TC84 documents have not received approval as of the printing of this data sheet. To guarantee conformance, a copy of the actual specification should be obtained from the Audio Engineering Society or ANSI (ANSI S4.40-1985) for the AES3 document, and the International Electrotechnical Commission for the IEC958 document. The AES/EBU interface is a means for serially communicating digital audio data through a single transmission line. It provides two channels for audio data, a method for communicating control information, and some error detection capabilities. Cirrus Logic, Inc. Crystal Semiconductor Products Division P.O. Box 17847, Austin, Texas 78760 (512) 445 7222 FAX: (512) 445 7581 http://www.crystal.com The control information is transmitted as one bit per sample and accumulates in a block structure. The data is biphase encoded, which enables the receiver to extract a clock from the data. Coding violations, defined as preambles, are used to identify sample and block boundaries. Frames Sub-frames and Blocks An audio sample is placed in a structure known as a sub-frame. The sub-frame, shown in Figure 1, consists of 4 bits of preamble, 4 bits of auxiliary data, 20 bits of audio data, 3 bits called validity, user, and channel status, and a parity bit. The preamble contains biphase coding violations and identifies the start of a sub-frame. The audio sample word length can vary up to 24 bits and is transmitted LSB first. If the word length is greater than 20 bits, the sample occupies both the audio and Copyright Cirrus Logic, Inc. 1998 (All Rights Reserved) FEB ‘98 AN22REV2 1 AN22 Sub-frame bit 0 3 4 Preamble 7 8 Aux Data LSB 27 28 29 30 31 Audio Data MSB V U C P Validity User Data Channel Status Data Parity Bit Figure 1. Sub-frame Format Preambles X Channel A Y Channel B Z Channel A Y Channel B Sub-frame Frame 191 X Channel A Y Channel B X Sub-frame Frame 1 Frame 0 Start of Channel Status Block Figure 2. Frame/Block Format auxiliary data fields. If it is 20 bits or less, the auxiliary field can be used for other applications such as voice. The parity bit generates even parity and can detect an odd number of transmission errors in the sub-frame. The validity bit, when low, indicates the audio sample is fit for conversion to analog. The user and channel status bits are sent once per sample and, when accumulated over a number of samples, define a block of data. The user bit channel is undefined and available to the user for any purpose. The channel status bit conveys, over an entire block, important information about the audio data and transmission link. Each of the two audio channels has its own channel status data with a block structure that repeats every 192 samples. As shown in Figure 2, two consecutive sub-frames are defined as a frame, containing channels A and B, and 192 frames define a block. The preambles that identify the start of a sub-frame are different for each of the two channels with another unique one identifying the beginning of a channel status block. Modulation and Preambles The data is transmitted with biphase-mark encoding to minimize the DC component and to allow clock recovery from the data. As illustrated in Figure 3, the 1’s in the data have transitions in the center, and the 0’s do not, after biphase-mark encoding. Also, the biphase-mark data switches polarity at every data bit boundary. Since the value of the data bit is determined by whether there is a transition in the center of the bit, the actual polarity of the signal is irrelevant. Each sub-frame starts with a preamble. This allows a receiver to lock on to the data within one sub-frame. There are three defined preambles: one Clock (2 times bit rate) 1 0 0 0 1 1 Data Biphase-Mark Data 1 0 1 1 0 0 1 1 0 1 0 1 Figure 3. Biphase-Mark Encoding 2 AN22REV2 AN22 1 1 1 0 0 0 1 0 X Y Z Biphase Patterns Channel 11100010 or 00011101 Ch. A 11100100 or 00011011 Ch. B 11101000 or 00010111 Ch. A & C.S. Block Start Preamble X 1 1 1 0 0 1 0 0 Table 1. Preambles Preamble Y for each channel and one to indicate the beginning of a channel status block (which is also channelA). To distinguish the preambles from arbitrary data patterns, the preambles contain two biphase-mark violations. Biphase-mark data is required to transition at every bit period, but each preamble violates that requirement twice. In Figure 3 each bit boundary, indicated by the dashed lines, contains a transition in the biphase data. Each preamble shown in 1 1 1 0 1 0 0 0 Preamble Z Figure 4. Preamble Forms Figure 4 has two bit boundaries with no transition, which enables the receiver to recognize the data as a preamble. byte/bit 0 1 2 3 4 5 0 PRO=1 1 2 Audio Channel Mode AUX Use 3 Emphasis 4 5 6 Fs Lock User Bit Management Word Length Reserved Reserved Reference Reserved Reserved 7 15 23 31 39 47 55 6 7 7 block bit Alphanumeric channel origin data 8 9 87 10 11 12 Alphanumeric channel destination data 13 14 119 Local sample address code 15 16 (32-bit binary) 17 18 19 Time of day code 20 (32-bit binary) 151 21 22 23 Reserved Reliability flags Cyclic redundancy check character 183 191 Figure 5. Professional Channel Status Block Structure AN22REV2 3 AN22 Table 1 lists the preamble biphase-mark data patterns and what each designates. Since biphase-mark encoding is not polarity conscious, both phases are shown in the table. Preambles "X" and "Y" indicate a sub-frame containing channels A and B respectively. Preamble "Z" replaces preamble "X" once every 192 frames to indicate the start of a channel status block. There are two channel status blocks, one for channel A and one for channel B. Since there are 192 frames in a block, each channel has a channel status block 192 bits long. These 192 channel status bits in a block can be arranged as 24 bytes. The blocks have one of two formats, professional or consumer. The first bit of the channel status block defines the format with 0 indicating consumer and 1 indicating professional. bit 0 0 1 bit 1 0 1 bits 2 3 4 0 0 0 1 1 1 X bit 5 0 1 bits 6 0 0 1 1 X 7 0 0 1 1 0 1 1 0 0 1 X BYTE 0 PRO = 1 Consumer use of channel status block Professional use of channel status block Audio Normal Audio Non-Audio Encoded audio signal emphasis Emphasis not indicated. Receiver defaults to no emphasis with manual override enabled None. Rec. manual override disabled 50/15 µS. Rec. manual override disabled CCITT J.17 . Rec. man. override disabled All other states of bits 2-4 are reserved Lock: Source Sample Frequency Locked - default Unlocked Fs: Sample Frequency Not indicated. Receiver default to 48 kHz and manual override or auto set enabled 48 kHz. Man. override or auto disabled 44.1 kHz. Man. override or auto disabled 32 kHz. Man. override or auto disabled Channel Status Block - Professional Format Setting the first bit of channel status high designates the professional or broadcast format. The channel status block structure for the professional format is illustrated in Figure 5 and shows bit 0 of byte 0, PRO, to contain a one. Tables 2 and 3 list the bits in each byte and their meaning. The areas designated "reserved" in the figures and tables, are currently not specified and must be set to 0 when transmitting. Most of the professional format data was obtained from the AES3-1985 document, and information from AES3-199x. Since the AES specification is currently being updated, the accuracy of this data is not guaranteed. BYTE 1 bits 0 1 2 3 Channel Mode 0 0 0 0 Mode not indicated. Receiver default to 2-channel mode. Manual override enabled 0 0 0 1 Two-channels. Man. override disabled 0 0 1 0 Single channel. Man. override disabled 0 0 1 1 Primary/Secondary (Ch. A is primary) Manual override disabled 0 1 0 0 Stereophonic. (Ch. A is left) Manual override disabled. 0 1 0 1 Reserved for user defined application 0 1 1 0 Reserved for user defined application 1 1 1 1 Vector to byte 3. Reserved X X X X All other states of bits 0-3 are reserved. bits 4 5 6 7 User bits management 0 0 0 0 Default, no user info indicated 0 0 0 1 192 bit block structure Preamble ‘Z’ starts block 0 0 1 0 Reserved 0 0 1 1 User defined application X X X X All other states of bits 4-7 are reserved. Table 2. Professional Channel Status bytes 0-1. 4 AN22REV2 AN22 bits 0 1 2 0 0 0 0 0 1 0 1 0 0 1 1 XX X bits 3 4 5 0 0 0 0 0 0 1 X bits 6 X bits 0 1 1 0 X 7 X 1 0 1 1 X 0-7 XXXXXX bits 0 1 0 0 0 1 1 0 1 1 bits 2 7 XXXXXX BYTE 2 AUX: Use of auxiliary sample bits Not defined. Maximum audio word length is 20 bits Used for main audio. Maximum audio word length is 24 bits Single coordination signal. Max. audio word length is 20 bits User defined application All other states of bits 4-7 are reserved. Source word length Max. audio based on bits 0-2 above Max audio 24 bits Max audio 20 bits Not Indicated Not Indicated (default) 23 bits 19 bits 22 bits 18 bits 20 bits 16 bits 24 bits 20 bits All other states of bits 3-5 are reserved Reserved BYTE 3 Vectored target byte Reserved BYTE 4 Digital audio reference signal per AES11-1990 Not reference signal (default) Grade 1 reference signal Grade 2 reference signal Reserved 0-7 XXXXXX BYTE 10-13 Alphanumeric channel destination data 7-bit ISO 646 (ASCII) data with odd parity bit. First character in message is byte 10. LSB’s are transmitted first. BYTE 14-17 Local sample address code (32-bit binary) Value is of first sample of current block. LSBs are transmitted first. BYTE 18-21 Time-of-day sample address code (32-bit binary) Value is of first sample of current block. LSBs are transmitted first. BYTE 22 bits 0 1 2 3 X X X Reserved bit 4 Channel status bytes 0 to 5 0 Reliable 1 Unreliable bit 5 Channel status bytes 6 to 13 0 Reliable 1 Unreliable bit 6 Channel status bytes 14-17 0 Reliable 1 Unreliable bit 7 Channel status bytes 18 to 21 0 Reliable 1 Unreliable Reserved BYTE 5 bits BYTE 6-9 Alphanumeric channel origin data 7-bit ISO 646 (ASCII) data with odd parity bit. First character in message is byte 6. LSB’s are transmitted first. Reserved BYTE 23 CRCC: Cyclic redundancy check character CRCC for channel status data block that uses bytes 0 to22 inclusive. Generating polynomial is G(x) = X8 + X4 + X3 + X2 + 1 with an initial state of all ones Table 3. Professional Channel Status Bytes 2-23. AN22REV2 5 AN22 Channel Status Block - Consumer Format Setting the first bit of channel status low designates the consumer format. The channel status block structure for the consumer format is illustrated in Figure 6 with the bit descriptions in Tables 4 and 5. All areas listed as "reserved" must be transmitted as a 0. The data for this format was obtained from the EIAJ CP-340 and the IEC958 with some information from TC84 which is a proposed amendment to IEC958 and has not received approval yet. As with the professional format, since this format is currently changing, the accuracy of the data listed cannot be guaranteed. In the consumer format, bit 0 must be 0. If bit 1 is set to 1 defining the data as non-audio, then bits 3-5 are redefined (see Table 4, byte 0). Bits 6 and 7 of byte 0 define the mode, and only one mode is presently defined, mode = 00. This mode defines the next three bytes as listed in Figure 6. Most of byte 1 defines the category code. The first 3 to 5 bits define the general category. Under the laser-optical category is compact disk (cat. code 1000000). This format defines some of the Uchannel bits and the CD subcode port. More information can be obtained from the CP-340 or IEC958 documents. byte/bit 0 0 PRO=0 1 2 Audio Copy 1 2 3 3 4 5 6 Emphasis 7 Mode Category Code L Source Num. Fs 7 Channel Num. Clock Acc. 4 block bit Reserved 15 23 31 39 5 6 Reserved 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 191 Figure 6. Consumer Channel Status Block Structure 6 AN22REV2 AN22 bit bit bits bits bits bits bits * * * * 0 0 1 1 0 1 2 0 1 3 0 1 0 1 X 3 0 X 6 0 X 4 0 0 1 1 X 4 0 X 6 0 X 5 0 0 0 0 1 5 0 X 3 0 0 1 0 X 4 0 0 0 0 X 5 0 1 0 0 X bits 3 4 5 0 0 0 * 1 0 0 X X X BYTE 0 PRO = 0 (consumer) Consumer use of channel status block Professional use of channel status block Audio Digital Audio Non-Audio Copy / Copyright Copy inhibited / copyright asserted Copy permitted / copyright not asserted Pre-emphasis - if bit 1 is 0 (dig. audio) None - 2 channel audio 50/15 µs - 2 channel audio Reserved - 2 channel audio Reserved - 2 channel audio Reserved - 4 channel audio if bit 1 is 1 (non-audio) Digital data All other states of bits 3-5 are reserved Mode Mode 0 (defines bytes 1-3) All other states of bits 6-7 are reserved BYTE 1 - Category Code 001 6 Broadcast reception of digital audio 0 Japan 1 United States 0 Europe 1 Electronic software delivery X All other states are reserved BYTE 1 - Category Code 100 6 Laser Optical 0 CD - compatible with IEC-908 0 CD - not comp. with IEC-908 (magneto-optical) X All other states are reserved BYTE 1 Category Code General Experimental Reserved Solid state memory Broadcast recep. of digital audio Digital/digital converters A/D converters w/o copyright A/D converters w/ copyright (using Copy and L bits) * 0 1 1 1 X X X Broadcast recep. of digital audio 1 0 0 X X X X Laser-optical * 1 0 1 X X X X Musical Instruments, mics, etc. 1 1 0 X X X X Magnetic tape or disk 1 1 1 X X X X Reserved bit 7 L: Generation Status. Only category codes:001XXXX, 0111XXX,100XXXX * 0 Original/Commercially pre-recorded data * 1 No indication or 1st generation or higher All other category codes * 0 No indication or 1st generation or higher * 1 Original/Commercially pre-recorded data The subgroups under the category code groups listed above are described in tables below. Those not listed are reserved. The Copy and L bits form a copy protection scheme for original works. Further explanations can be found in the proposed amendment (TC84) to IEC-958. bits 0 1 2 3 4 5 0 0 0 0 0 0 * 0 0 X X * 0 0 0 1 X X * 0 0 1 X X X 0 1 0 X X X * 0 1 1 0 0 X * 1 X bits 3 0 * 0 * 0 * 1 X 4 0 0 1 1 X 5 0 1 0 0 X 6 0 1 X X X X X X BYTE 1 - Category Code 010 6 Digital/digital conv. & signal processing 0 PCM encoder/decoder 0 Digital sound sampler 0 Digital signal mixer 0 Sample-rate converter X All other states are reserved Table 4. Consumer Channel Status Bytes 0 and 1. Currently the standards committees are trying to define a minimum implementation as well as levels of implementation of channel status data. A scheme for providing copy protection is also currently being developed. It includes knowing the category code and then utilizing the Copy and L bits to determine if a copy should be allowed. DigAN22REV2 ital processing of data should pass through the copy and L bits as defined by their particular category code. If mixing inputs, the highest level of protection of any one of the sources should be passed through. If the copy bit indicates no copy protection (copy = 1), then multiple copies can be made. If recording audio data to tape or disk, and any 7 AN22 source has copy protection asserted, then the L bit must be used to determine whether the data can be recorded. meaning of the L bit can only be determined by looking at the category code since certain category codes reverse the meaning. The L bit determines whether the source is an original (or prerecorded) work, or is a copy of an original work (first generation or higher). The actual If the category code is CD (1000000) and the copy bit alternates at a 4 to 10Hz rate, the CD is a copy of an original work that has copy protection asserted and no recording is permitted. bits 3 4 5 * 0 0 0 * 1 0 0 X X X bits 0 0 1 0 1 0 0 1 bit 4 0 1 0 1 0 1 1 0 0 1 1 0 1 1 5 0 0 1 1 1 1 2 0 0 0 0 1 1 1 6 0 0 0 0 1 1 BYTE 1 - Category Code 101 6 Musical Instruments, mics, etc. 0 Synthesizer 0 Microphone X All other states are reserved 3 0 0 0 0 0 1 1 7 0 0 0 0 1 1 BYTE 2 Source Number Unspecified 1 2 3 4 to 14 (binary - 0 is LSB, 3 is MSB) 15 Channel Number Unspecified A (Left in 2 channel format) B (Right in 2 channel format) C to N (binary - 4 is LSB, 7 is MSB) O bits 3 0 * 1 X bits 0 0 0 1 1 X bits 4 0 0 1 1 bits 6 X 4 0 0 X 1 0 1 1 1 X 5 0 1 0 1 7 X 5 0 0 X 2 0 0 0 0 X BYTE 1 - Category Code 110 6 Magnetic tape or disk 0 DAT 0 Digital audio sound VCR X All other states are reserved 3 0 0 0 0 X BYTE 3 Fs: Sample Frequency 44.1 kHz 48 kHzr 32 kHz Sample-rate converter All other states are reserved Clock Accuracy Level II, ±1000 ppm (default) Level III, variable pitch Level I, ±50 ppm - high accuracy Reserved Reserved BYTE 4 - 23 Reserved * Data from draft of IEC 958 proposed amendment (from TC84). Has not recieved approval yet. Table 5. Consumer Channel Status Bytes 1-23 8 AN22REV2 • Notes •