LAES, “LAE Lossless”, is the lossless tier of the Layered Audio Extension family. A FLAC
file carries an LAES payload in its LAE2
APPLICATION blocks: the FLAC audio frames are the core, an ordinary
two-channel recording that every FLAC player plays unchanged, and the payload adds one to
sixteen masters, higher-rate or longer-word-length versions of the same
recording, each restored bit for bit. This page follows the specification section by
section.
Source. LAE
Lossless (LAES): File Format and Decoding Specification, Version 1 (spec/lossless/SPEC.md,
repository tag v5-2026-10-30, licence CC BY 4.0, © 2026 mtq0605). The
specification itself is marked a draft for public review. Section numbers in brackets
below are its own. The specification says the reference implementation is normative where
the text is silent or ambiguous; this page follows the text. The application ID
LAE2 is registered with IANA. The repository publishes no test vectors.
What the payload holds
- The core [1.1]: two-channel integer PCM at a base rate of 44,100 or 48,000 Hz, 16, 24 or 32 bits. In the FLAC form this is the audio frames.
- Masters [1.1]: one to sixteen two-channel integer signals of 16, 24 or 32 bits, each at the base rate × 1, 2, 4 or 8. They are independent: each may come from a different production.
- Rate levels [1.1, 3.2]: from each master the decoder also obtains the master at its rate ÷ 2, ÷ 4 and ÷ 8 down to the base rate, by the lifting below. They are exact integer signals and are not stored separately.
- Storage [1.1, 6.4]: a master is stored as the difference to a signal already in the file (the core or an earlier master), or in full, whichever the encoder finds smaller. Nothing is approximated.
Other properties [1.5]: the payload has no index, seek table or table of layer offsets; it is stored as one whole block, not interleaved with the core; each master has exactly one storage choice and one tier for its whole length, with no weights or gains; and the two channels are always coded separately, the left from left-channel signals only.
Carriers
| Carrier | Core | Payload | Core mode |
|---|---|---|---|
| WAV form [7] | the data chunk | a chunk LAE (trailing space) in the same file | 0 |
| FLAC form [8] | the audio frames | one or more APPLICATION blocks, ID LAE2 | 1 |
| CD-Extra [9] | the audio tracks of session 1 (16-bit, 44,100 Hz) | one .LAX extension file per track in the data session | 0 |
All three carry the same payload. Only the place of the core differs. This site
describes the FLAC form; the other two are summarised under
other carriers. In a WAV file the first four bytes of the
chunk name the format: LAE1 is LAE Lossy (LAEY), LAE2 is LAES
[7].
Terms
| Term | Meaning [1.4] |
|---|---|
| base rate | 44,100 Hz (CD family) or 48,000 Hz (DVD family) |
| core | the signal an ordinary player plays; in the FLAC form it may be 16, 24 or 32 bits |
| stages S | for a master at rate base × 2S, the number S, 0 to 3 |
| level k | for a master with S stages, the signal at rate base × 2k, 0 ≤ k ≤ S. Level S is the master itself (after removing unused low bits); level 0 is its base level |
| octave layer k | the detail signal produced when level k is split into level k − 1 |
| tier | the signal a master is stored against: the core, or an earlier master |
| T | the time position of a master relative to its tier, in base-rate samples: an integer part and a fraction in units of 2−32 sample |
| w | the number of low bits that are zero in every sample of a master; w = 0 if every sample is 0 |
Notation and arithmetic
[2.1] All multi-byte quantities in the payload are little-endian. (FLAC’s
own structures stay big-endian.) a >> s on a signed value is an
arithmetic shift, floor division by 2s.
- Exact sums. A sum of products is formed exactly; a 128-bit two’s-complement accumulator is enough for every sum in the lifting and the reference.
- Wrap-around. Every value that the lifting, the reference, the
layer coder’s prediction and the reconstruction produce (a prediction, a reconstructed
sample, a lifting output, a reference value,
x << w) is taken modulo 264 as an int64. A correct payload never needs a wider value; one that would can only fail its SHA-256. - Rounding. For an exact integer A and s ≥ 1,
round_s(A) = (A + 2^(s−1)) >> s, on the exact value: A ÷ 2s to the nearest integer, ties towards +∞. - Symmetric extension. For a signal x of length n ≥ 1 and any integer
index i:
m(i, n) = 0if n = 1; otherwise, with p = 2(n − 1),j = i mod p(0 ≤ j < p) andm(i, n) = jif j < n, elsep − j.x[m(i, n)]is x at index i extended by whole-sample mirroring. Indices are 64-bit. - levLen(n, k): n halved k times, rounding up each time
(
n = (n + 1) / 2, k times).
[2.2] Only the reference taps use floating point. They are computed in IEEE-754
binary64 with every + − × ÷ and sqrt rounded individually (to
nearest, ties to even) in the order written. Fused multiply-add, extended-precision
intermediates and re-ordering must not be used, and no library function other than
sqrt and floor may be used.
Header (64 bytes)
[6, 6.1] The payload is a byte string followed by its CRC-32 (below). It starts with this header.
| Offset | Size | Field | Value |
|---|---|---|---|
| 0 | 4 | magic | LAE2 |
| 4 | 2 | version | 1 |
| 6 | 2 | header size | 64 |
| 8 | 4 | base rate | 44100 or 48000 |
| 12 | 1 | core bits | 16, 24 or 32 |
| 13 | 1 | channels | 2 |
| 14 | 1 | number of masters M | 1 to 16 |
| 15 | 1 | core mode | 0 = core in a WAV data chunk or on CD audio tracks; 1 = core in FLAC audio frames |
| 16 | 8 | core frames | number of core samples per channel (uint64) |
| 24 | 32 | core SHA-256 | see hashes |
| 56 | 8 | reserved | 0 |
In the FLAC form the core mode is 1, but a reader does not compare it with the carrier [6.7].
Master record (72 bytes)
[6.2] After the header come the masters one after another in payload order: the record of master 1, its layers, the record of master 2, its layers, and so on. After the last master’s layers comes the CRC-32. A master’s tier must be the core or a master earlier in the payload.
| Offset | Size | Field | Value |
|---|---|---|---|
| 0 | 1 | bits | 16, 24 or 32 |
| 1 | 1 | stages S | 0 to 3 (rate = base × 2S) |
| 2 | 1 | w | unused low bits, w < bits |
| 3 | 1 | storage | 0, 1 or 2 (see below) |
| 4 | 1 | reference tier | 0 = the core; k = the k-th master of this payload (1-based) |
| 5 | 3 | reserved | 0 |
| 8 | 4 | rate | base × 2S |
| 12 | 4 | reserved | 0 |
| 16 | 8 | frames F | samples per channel, ≥ 1 (uint64) |
| 24 | 8 | T whole | int64, integer part of T (base-rate samples, relative to the tier) |
| 32 | 4 | T fraction | uint32, units of 2−32 base-rate sample |
| 36 | 4 | reserved | 0 |
| 40 | 32 | master SHA-256 | see hashes |
Writers must write reserved fields as 0; readers ignore them [6.7].
Storage values [6.4]
| Storage | Reference tier | Stored at level | Meaning |
|---|---|---|---|
| 0 | the core or any earlier master | j = 0 | difference to the tier at the base level |
| 1 | 0 (none) | j = 0 | base level stored in full |
| 2 | an earlier master | j = min(S, St) | difference to the tier master at the highest level both have; only the octave layers above j are stored |
St is the number of stages of the tier master. The unused low bits are
removed before anything is coded: the samples of a master are taken as
x = sample >> w, and the levels and octave layers are computed from x
[6.3].
Layers of a master
[6.3] Let j = 0 for storage 0 and 1, and j = min(S, St) for storage 2. For each channel, left first, then right:
- a
uint32byte length, then the layer coding of- storage 0 or 2: the difference at level j,
levLen(F, S − j)values: the master’s level j minus the reference; - storage 1: the master’s base level itself,
levLen(F, S)values;
- storage 0 or 2: the difference at level j,
- for each k = j + 1 … S: a
uint32byte length and the layer coding of octave layer k.
Level k of a master has levLen(F, S − k) samples per channel, and octave
layer k has ⌊levLen(F, S − k) / 2⌋ [3.2]. Bytes of the stored length after
the last block are ignored [5.4].
Block lengths [5.3]
| Signal | Block length B |
|---|---|
| base level (storage 1) and base-level difference (storage 0) | 4096 |
| level-j difference (storage 2) | 4096 · 2j |
| octave layer k | 4096 · 2k−1 |
The layer coder
[5] Every stored signal (base level, level difference or octave layer, one channel at a time) is coded into a byte string. Bits are written most significant first. A layer of n samples is a sequence of blocks of length B (the last takes the remainder), written back to back with no byte alignment between blocks; the layer ends with zero bits up to the next byte boundary.
Block [5.1]
| Field | Bits | Meaning |
|---|---|---|
| type | 2 | 0 = constant, 1 = verbatim, 2 = fixed predictor, 3 = LPC |
| W | 6 | width of the stored constant, verbatim and warm-up values (W-bit two’s complement); 1 ≤ W ≤ 62. A decoder does not check decoded samples against W |
Then, by type, for a block of n samples x[0 … n − 1]:
| Type | Fields after W | Limits |
|---|---|---|
| 0, constant | one W-bit value v; x[i] = v | |
| 1, verbatim | n W-bit values | |
| 2, fixed | order o (3 bits); o warm-up samples (W bits each); a residual of n − o values | 0 ≤ o ≤ 4, o < n; W ≤ 58 |
| 3, LPC | order − 1 (5 bits); precision − 1 (4 bits); shift (5 bits); o coefficients c[0 … o−1] (p-bit two’s complement each); o warm-up samples (W bits each); a residual of n − o values | o = 1 … 32, o < n; p = 1 … 16; shift 0 … 31; W ≤ 44 |
The fixed predictor is FLAC’s: order 0 predicts 0; order 1, x[i−1]; order 2,
2x[i−1] − x[i−2]; order 3, 3x[i−1] − 3x[i−2] + x[i−3]; order 4,
4x[i−1] − 6x[i−2] + 4x[i−3] − x[i−4]. The LPC prediction is
pred_i = floor( Σj=0..o−1 c[j] · x[i−1−j] / 2^shift ) with the sum
exact (for shift 0, the sum itself). Reconstruction: x[i] = residual[i] + pred_i
for i ≥ o.
Residual [5.2]
| Field | Bits | Meaning |
|---|---|---|
| partition order po | 4 | 0 ≤ po ≤ 8, and 2po ≤ m, where m is the number of residual values |
The m values are split into 2po partitions: partitions 0 … 2po − 2 have ⌊m / 2po⌋ values each; the last has the rest. Each partition has a 6-bit parameter k:
- k = 0 … 62: Rice-coded. A value v maps to u = 2v for v ≥ 0 and u = −2v − 1 for v < 0. The quotient q = u >> k is written as q zero bits then a one bit, then the k low bits of u. The value u must fit in 64 bits.
- k = 63: escape. A 6-bit width r (1 … 63) follows, then every value of the partition as r-bit two’s complement.
All side information is fixed-length. This is the shape of FLAC’s residual coding, but with its own limits (partition order up to 8, 6-bit parameters, a 64-bit value range), so a FLAC decoder cannot read it.
Checks on a layer [5.4]
A decoder must reject a layer when a field is outside the ranges above, when a predictor type is used with a W above its limit, when the order is not smaller than the block length, or when the data ends early. It ignores bytes of the stored length after the last block, and the padding bits.
Rate levels: the lifting
[3.1] One stage splits a signal x of length n into a low part s (length ⌈n/2⌉, the next lower level) and a detail d (length ⌊n/2⌋, the octave layer):
xe[i] = x[2i] 0 ≤ i < ⌈n/2⌉
xo[i] = x[2i + 1] 0 ≤ i < ⌊n/2⌋
d[i] = xo[i] − P(xe, i)
s[i] = xe[i] + U(d, i)
P(xe, i) = round_30( Σ t=0..39 H0[t] · ( xe[m(i − t, ne)] + xe[m(i + 1 + t, ne)] ) ) ne = ⌈n/2⌉
U(d, i) = round_31( Σ t=0..59 U0[t] · ( d[m(i − 1 − t, no)] + d[m(i + t, no)] ) ) no = ⌊n/2⌋; U = 0 if no = 0
H0 (the table kHalf0, shared with LAE Lossy) and U0 (kU0) are
listed in the tables. Each product is formed separately; the sum is
exact. The inverse stage, given s, d and n, is:
xe[i] = s[i] − U(d, i)
x[2i] = xe[i]
x[2i + 1] = d[i] + P(xe, i)
It reproduces x exactly.
[3.2] For a master with S stages, after removing the unused low bits, level S is the master. For k = S down to 1, one stage applied to level k gives level k − 1 and octave layer k.
The reference: time position and word length
[4] A master, or one of its levels, is stored as the difference to a reference: a tier signal moved to the master’s time position and scaled to the master’s word length.
Reference taps [4.1]
For a fraction f ∈ [0, 1) of a sample, given as an unsigned 32-bit value F with f = F / 232, the 256 taps h[q], q = −127 … 128, are computed in binary64 (see notation):
PI = 3.141592653589793115997963468544185161590576171875 (the binary64 value nearest to π)
sin(x) for |x| ≤ π/2: y = x·x; s = 1; for k = 15 down to 1: s = 1 − s·y / ((2k)·(2k + 1)); result x·s
I0(x): y = x·x / 4; term = 1; s = 1; for k = 1 to 80: term = term·y / (k·k); s = s + term; result s
g = f if f ≤ 0.5, else 1 − f
sf = sin(PI·g)
i0b = I0(14)
for q = −127 … 128:
u = f − q
sinc = 1 if u = 0, else (q even ? +1 : −1) · sf / (PI·u)
r = u / 128
w = I0(14 · sqrt(1 − r·r)) / i0b if −1 < r < 1, else 0
h[q] = floor(sinc · w · 2^31 + 0.5) (as int64)
c = the smallest q with the smallest |u| (q scanned upwards, strict comparison; matters for f = 0.5)
h[c] = h[c] + 2^31 − Σ q h[q]
The taps are integers whose sum is exactly 231. For f = 0, h[0] = 231 and every other tap is 0. The correction on the nearest tap means that for f = 0.5, where q = 0 and q = 1 tie, the taps are symmetric except for that pair.
Reference values [4.2]
Let src be the tier signal at the relevant level (length n), W the integer
part of the time position and F its fraction, both in samples of that level, and
up the grid difference (see reconstruction).
The reference has the length of the master’s signal at that level (nOut values):
A_i = Σ q=−127..128 h[q] · src[m(i + W + q, n)] exact
ref[i] = round_(31−up)(A_i) if 31 − up > 0
ref[i] = A_i · 2^(up−31) if 31 − up ≤ 0 (modulo 2^64 as int64)
Informatively, up is the number of extra significant bits the master has over
the tier. It is negative when the master has fewer bits; the reference then rounds the
tier down to the master’s word length.
Time position at level j [4.3]
A time position T = W + F / 232 base-rate samples is, at level j (rate base × 2j), T · 2j samples of that level:
W_j = W · 2^j + (F >> (32 − j)) for j ≥ 1; W_0 = W
F_j = (F · 2^j) mod 2^32
Reconstruction
[6.6] For each master m in payload order, and each channel separately:
j = 0 (storage 0, 1) or min(S, S_t) (storage 2)
x_j = decoded first layer (levLen(F, S − j) values)
if storage ≠ 1:
src = the core channel (tier 0), or level j of tier master t (tier t ≥ 1)
up = (bits − w) − (core bits) for tier 0
(bits − w) − (bits_t − w_t) for a tier master t
(W_j, F_j) = T at level j
x_j = x_j + reference(src, W_j, F_j, up) (nOut = levLen(F, S − j))
for k = j + 1 … S:
x_k = inverse stage(x_{k−1}, octave layer k, levLen(F, S − k))
master sample = x_S << w
Level j of a tier master t comes from its reconstructed samples: xt = sample >> wt is its level St, and one stage per step gives the lower levels.
Hashes
[6.5]
- Master SHA-256: over the master’s samples in file order L, R, L, R, …, each sample as its int32 two’s-complement value in 4 bytes, little-endian.
- Core SHA-256: for a 16-bit core, over the samples as int16
little-endian, L, R, L, R, … (the byte content of a 16-bit
datachunk). For a 24- or 32-bit core, as for a master (int32 little-endian).
CRC-32
[6] Four bytes at the end of the payload: the IEEE 802.3 CRC-32 (reflected polynomial
0xEDB88320, initial value and final XOR 0xFFFFFFFF) over every
payload byte before it, stored little-endian like the rest. In the FLAC form the payload
“with its CRC-32” is what is cut into slices, so the CRC sits at the end of the last
LAE2 block.
Checks
[6.7] A decoder must reject the payload, and play the core only, if any of these holds:
- the CRC-32 does not match;
- the magic, version (1) or header size (64) differ; the base rate is not 44,100 or 48,000, or differs from the carrier’s core rate; the core bits differ from the carrier’s core; channels is not 2; core mode is above 1; M is not 1 to 16;
- the core frames differ from the carrier’s core length, or the core SHA-256 differs;
- for a master: bits not 16, 24 or 32; S above 3; w not below bits; storage above 2; rate
not base × 2S; F below 1;
levLen(F, S)more than core frames + 224; |T whole| of 240 or more. Core frames and F are uint64 and are compared without truncation; a decoder that cannot hold a master of F samples rejects the payload rather than truncate; - storage 0 or 2 with a tier that is not earlier in the payload; storage 2 with tier 0; storage 1 with a tier other than 0;
- a layer fails the layer checks, or the payload ends early;
- bytes remain between the last master’s layers and the CRC-32.
A master whose reconstruction does not match its SHA-256 must not be presented as that master, nor its rate levels. The core and the other masters are unaffected, except masters whose chain of tiers includes it, which then also fail. Reserved fields are written as 0 and ignored by readers; the core mode is not compared with the carrier.
Conformance [1.3]
A conforming decoder checks the payload and the carrier; reproduces every master exactly; compares each reconstructed master with its SHA-256; plays the core unchanged when the payload is missing, damaged or fails a check; and may produce any of the outputs.
The FLAC form
[8] An LAES FLAC file is a FLAC stream (RFC 9639):
"fLaC" | STREAMINFO | APPLICATION blocks with ID "LAE2" (k ≥ 1) | other metadata blocks (optional) | audio frames = the core
- STREAMINFO: 2 channels, the base rate, 16, 24 or 32 bits, the core’s sample count (which must not be 0) and the MD5 of the core (which must be given and correct). A decoder that finds the MD5 missing or wrong must not use the payload, because the core is not the one the payload was made for; whether it still plays the core is up to the player.
- The payload, with its CRC-32 and core mode 1, is split into pieces of at most
224 − 5 bytes (16,777,211). Each piece is the data of one
APPLICATION block whose 4-byte ID is
LAE2(0x4C 0x41 0x45 0x32). Writers put these blocks directly after STREAMINFO; a reader concatenates everyLAE2block in file order, wherever it stands among the metadata blocks. - The audio frames hold the core, in any valid FLAC coding.
- No SEEKTABLE and no CUESHEET block is written.
Every FLAC decoder plays the core and skips the APPLICATION blocks. The reference writer uses a fixed block size of 4096, two independently coded channels, LPC orders up to 12, precision up to 15 and Rice partition orders up to 8, which is FLAC’s streamable subset at 44.1 and 48 kHz; many older players do not play 32-bit FLAC, so it uses a 24-bit core unless asked otherwise; the reference reader decodes only cores with independently coded channels (informative, [8]).
Decoder outputs
[10]
| Output | Lossless | Definition |
|---|---|---|
| the core | yes | as stored |
| each master | yes | as reconstructed above |
| each rate level of a master | yes | level k, samples x_k << w, written at the master’s word length; a value outside that word length is limited to it on output |
| a derived 16-bit version | no | see below |
Derived 16-bit version [10.1]
For a rate at which the file offers no 16-bit output, a decoder may offer a 16-bit version derived from the output with the most bits at that rate (b bits, b > 16, s = b − 16). The outputs counted are the core, every master whose SHA-256 matched, and their rate levels (after limiting). On a tie the first in this order is used: the core; then, for each master in payload order, the master and its rate levels from high rate to low.
per channel, a xorshift64 generator with state st = 20261029 + 0x9E3779B97F4A7C15 · (channel + 1) (mod 2^64; channel 0 = left)
next(): st ^= st << 13; st ^= st >> 7; st ^= st << 17; return st >> (64 − s)
for each sample v in order: r1 = next(); r2 = next(); y = clamp((v + r1 − r2 + 2^(s−1)) >> s, −32768, 32767)
The result is a new 16-bit master with triangular dither of ±1 least significant bit. It is lossy against its source, a decoder must label it as derived and lossy wherever it offers it, and it is the same on every run and platform.
Other carriers
[7, 9] WAV form: a RIFF/WAVE file with fmt (integer PCM,
format tag 1 or 0xFFFE with the PCM sub-format; 2 channels, the base rate, 16, 24 or 32
bits), exactly one data chunk (the core) and at most one LAE
chunk holding the payload and its CRC-32 with core mode 0. A data chunk over 4
GiB is outside version 1. CD-Extra: each track’s .LAX
extension file is the payload with its CRC-32 (core mode 0) followed by an 80-byte trailer
record of the LAE CD-Extra specification, with extension block type 2; the first four bytes
of the extension block must be LAE2 for type 2 (LAE1 for type 1),
or the extension is rejected and the CD track plays alone. The CD-Extra specification
itself is not described on this site.
Encoder choices (informative)
[11] The specification leaves these to the encoder, and a decoder does not depend on them.
The core is given or derived from a master’s base level; the reference encoder uses 16 bits
for the WAV form and, for the FLAC form, the highest master word length up to 24 bits. For
each master it tries storage 1, storage 0 against the core and every earlier master, and
storage 2 against every earlier master when both have a level above the base, and keeps the
smallest. It writes the masters in the smaller of two orders (longer word lengths first then
higher rates first, or the master the core was derived from first). A master derived from
the same production as the core has T = 0; for an independently produced core, the tool
measures the position and stores it as T, fraction included, and the master itself is never
moved. The specification’s measurements on 10-second excerpts, against flac -8:
one 24-bit master with all its rate levels takes 93.5 to 98.4 % of a FLAC of that master
alone; twelve versions (16-, 24- and 32-bit masters at 352.8 kHz with their four rate
levels) take 99.6 to 99.8 % of a FLAC of the 32-bit master alone, and about 30 % of twelve
separate FLAC files [11.4].
Tables
[Appendix A] H0 (kHalf0), 40 values, Q31:
682938002, -225979149, 133607419, -93347908, 70491357, -55579122, 44978765, -36999032, 30747123, -25707634,
21562088, -18102637, 15187220, -12714693, 10610315, -8816912, 7289329, -5990851, 4890848, -3963205,
3185274, -2537151, 2001191, -1561677, 1204578, -917388, 688994, -509581, 370536, -264370,
184638, -125854, 83405, -53473, 32940, -19306, 10605, -5322, 2321, -771
U0 (kU0), 60 values, Q31:
683270116, -226970762, 135242270, -95599562, 73323768, -58947533, 48830814, -41276037, 35385490, -30640348,
26720250, -23416981, 20589580, -18139377, 15995343, -14105100, 12429177, -10937236, 9605506, -8415006,
7350282, -6398504, 5548802, -4791782, 4119170, -3523546, 2998153, -2536758, 2133556, -1783104,
1480274, -1220234, 998431, -810587, 652702, -521052, 412202, -322998, 250575, -192354,
146076, -109516, 81159, -59401, 42896, -30529, 21386, -14723, 9943, -6573,
4241, -2663, 1619, -948, 531, -281, 138, -61, 23, -6