Introduction
After the header and the optional CRC, a Layer I frame holds, in this order, the bit allocation, the scalefactors, the samples and the ancillary data. All of it is read bit by bit, most significant bit first, with no padding between the parts. The audio always has 32 subbands, and all 32 are in use in every Layer I frame: there are no allocation tables, only one rule.
Bit allocation
Thirty-two 4-bit codes, one for each subband in subband order. In stereo, dual channel and single channel modes, and in joint stereo below the bound, each subband has one code for each channel, channel 0 first. In joint stereo from the bound up, each subband has a single code that serves both channels.
| Code | Meaning |
|---|---|
0000 | the subband is not used: it has no scalefactor and no samples and sounds as silence |
0001 to 1110 | each sample takes the code’s value plus 1 bits: 2 to 15 bits |
1111 | not allowed |
The number of bits a sample takes is written nb below, so nb is the code plus 1 for a code from 1 to 14. The bit allocation is always 128 bits in single channel mode, 256 bits in the other modes without a bound, and fewer in joint stereo: 4 × (2 × bound + (32 − bound)) bits.
Scalefactors
For each subband that has an allocation, in subband order and for each channel that has one, a 6-bit scalefactor index follows. The subband’s samples are multiplied by 2 × 2−index/3. The multiplier for an index i is the multiplier for i mod 3 divided by 2 for every 3 steps:
| i mod 3 | multiplier at index 0, 1 and 2 |
|---|---|
| 0 | 2.00000000 (index 0), 1.00000000 (index 3), 0.50000000 (index 6) and so on |
| 1 | 1.58740105 (index 1), 0.79370053 (index 4), 0.39685026 (index 7) and so on |
| 2 | 1.25992105 (index 2), 0.62996052 (index 5), 0.31498026 (index 8) and so on |
Index 62 gives 0.00000120. Index 63 is not used by the standard; the reference decoder’s table holds a placeholder there, and the viewer flags it. In joint stereo, a subband from the bound up has a scalefactor index for each channel, but one set of sample codes. A subband without an allocation has no scalefactor.
Samples
The samples come in 12 slots. In each slot, for each subband in subband order and then for each channel (channel 0 first), one sample code of nb bits follows if the subband has an allocation. Above the joint stereo bound only channel 0’s position holds a code, and both channels use it. A frame therefore holds 12 samples for each subband, and 12 × 32 = 384 samples for each channel after the synthesis filter.
The code is turned into a number between −1 and 1 and scaled by the scalefactor multiplier. The formula is on the decoding page. The code with every bit set is not forbidden by the draft standard; decoders treat it as the largest value.
Intensity stereo
In joint stereo, a subband from the bound up has one sample code for both channels and a scalefactor for each. The decoder requantises the one code, then multiplies it by channel 0’s scalefactor multiplier for the left channel and by channel 1’s for the right. The two scalefactor indices follow each other in the scalefactor part, channel 0 first.
Free format
Bit rate index 0 means the file uses a bit rate outside the table. The frame length is then not in the header: a reader finds the next frame by looking for the next sync word and header, and measures the length from there. The audio data is laid out as in any other frame. Some decoders do not read free format.
Ancillary data
Bits left after the last sample, up to the end of the frame, are ancillary data. The standard leaves their use to the application, and a decoder ignores them. The frame can end with unused bits when the encoder could not use the whole slot.