Standards & algorithms
Which specification, and where the specification runs out.
Four bodies govern the metrics crête reports, and they do not cover everything it is asked to measure. Where a standard is silent — multichannel dynamic range, DSD decimation, LFE scoring — crête states its rule as a rule and reports companions alongside it, rather than presenting one figure as authoritative.
01 — The four authorities
K-weighted loudness, channel weighting, and the definition of true peak. Governs integrated loudness, momentary and short-term loudness, and the peak measurement.
Gating, meter rates and block grids; loudness range. crête passes the official 3341 and 3342 compliance vector suites.
Peak-to-short-term loudness ratio. Implemented as published, which is why it disagrees with the commercial reference — see below.
The Pleasurize Music Foundation procedure behind the DR number and the dr.loudness-war.info submission format. Defined for stereo only.
02 — TT Dynamic Range
The procedure, as implemented
- Split the audio into 3-second non-overlapping blocks. The trailing partial block is kept, normalised by its own length.
- Compute RMS and peak per block.
- Sort that channel's own block RMS values descending; take the loudest 20 %, a floor division of the block count.
- Combine them with the quadratic mean — averaging power, not amplitude.
- DR(channel) = 20·log₁₀( that channel's 2nd-highest block peak ÷ that channel's top-20 % RMS ).
- DR (PMF) = mean of the per-channel values, rounded to an integer once.
- Album DR = the mean of the raw per-track values, rounded once. Per-track values are never rounded before averaging. Since 0.20.0 a track under 10 s has no DR and is left out of the mean, as in MAAT DROffline.
Using the second-highest peak rather than the highest follows the foobar2000 DR Meter changelog. Step 6 taking the channel mean — rather than a separate joint measurement — is what removed a structural bias that could never let the joint figure fall below either channel.
Three A/B axes, each defaulting to the reference
Both switches exist so old numbers can be re-read and new ones attributed. Neither is a preference; each has a right answer and it is the default.
--dr-mean quadratic | arithmetic
How the loudest 20 % of blocks are averaged. quadratic is the PMF
procedure and the default; arithmetic reproduces ≤ 0.12.1 bit-for-bit.
Applies to every format, not just DSD.
--dr-blocks reference | legacy | foobar
Which blocks are ranked at all. reference is the PMF reference
implementation — trailing block kept, no gate — and the default since 0.14.0. legacy reproduces ≤ 0.13.1. foobar, since 0.20.0, puts the
reference grid 244 ms in, as measured on foobar2000's DR Meter; it is experimental
until a full weekly decides it.
--dr-short exclude | include
Whether a track under 10 s gets a DR. exclude is MAAT DROffline's own
limit, measured at exactly 10.000 s, and the default since 0.20.0; include reproduces ≤ 0.19.5.
In JSON, every result carries dr_rms_mean, dr_blocks and dr_short, and DSD
tracks additionally carry chain, filter and output rate — recording exactly how the numbers
were produced. An unlabelled DSD result is not interpretable.
03 — Loudness & peak
Integrated loudness
K-weighting per BS.1770-4 through hardcoded biquad coefficients, with absolute gating at −70 LUFS and relative gating at 10 LU below the ungated mean. Momentary blocks are 400 ms at 75 % overlap; short-term blocks are 3 s at 67 % overlap.
Cross-checked against an independent implementation on a 5.1 master: integrated −13.57 against −13.6 LUFS, LRA 8.22 against 8.2 LU.
True peak, and why it is clamped
A 4× polyphase FIR with 12 taps per phase, per channel; the joint result is the maximum
across the scored channels, so on a multichannel layout the LFE is excluded
exactly as it is from the joint sample peak, and --dr-lfe moves both together.
The result is clamped to be at least the sample peak, which BS.1770 requires by definition —
the reconstructed continuous waveform passes through every sample.
Up to 0.14.0 the joint true peak alone had no such guard, so the two joint peaks were measured over different channel sets. On a file whose LFE is its loudest channel that produced a true peak far above the sample peak for reasons that had nothing to do with inter-sample overshoot — a synthetic 5.1 with every channel at −20 dBFS and the LFE at −3 read −20.000 against −2.986 — and PLR inherited it. The 0.15.0 entry has the measurement.
The interpolation filter is designed for audio-band content and attenuates energy near
Nyquist, so without the clamp the oversampled peak can land below the sample peak
on signals with heavy ultrasonic content. This never happens on PCM or on DSD Direct; it
does happen on DSD Multistage, whose 80-tap fir1_8 stage leaves enough shaped
noise floor in place to trigger it — five violations on one album, worst −0.143 dB. The
clamp is a no-op wherever the true peak already exceeds the sample peak, so the official
true-peak compliance battery is unaffected.
One shared short-term grid
Max Short-Term, LRA and Min PSR share a single short-term block grid — a 3 s window at the EBU 3341 meter rate with a 0.1 s hop — computed once per track. Previously LRA and PSR sampled the same window on a private 1.0 s grid, which biased Min PSR high, because the true minimum window could fall between hops, and thinned the LRA percentile distribution on sparse material.
Every other metric is bit-identical across that change, and the official compliance vector suites pass on the new grid.
04 — Channel layouts
Mono through 7.1, on one shared table
Speaker names, LFE identification and BS.1770 weights live in one source file read by the CLI, the JSON writer and the GUI, so the three front-ends cannot describe a layout differently. Layouts outside this list are measured per channel but carry no speaker semantics: no LFE is assumed and every channel is scored at unity weight.
| ch | Layout | Order |
|---|---|---|
| 1 | mono | M |
| 2 | stereo | L R |
| 3 / 4 / 5 | 3.0 / quad / 5.0 | L R C · L R Ls Rs · L R C Ls Rs |
| 6 | 5.1 | L R C LFE Ls Rs |
| 8 | 7.1 | L R C LFE Lrs Rrs Lss Rss |
Loudness weighting follows BS.1770-4: front channels unity, surrounds +1.5 dB, LFE excluded. The standard tabulates weights only to 5.1, so the 7.1 rears take the same +1.5 dB as the sides, as broadcast meters do. Mono and stereo weights are all unity, which makes the weighted sum bit-identical to the unweighted code it replaced — the stereo corpus is untouched by construction, not by measurement.
When the file names its speakers
A channel count cannot tell an Auro-3D 8.0 file from a 7.1 one. Up to 0.20.0 crête called it
7.1, took its Rs for an LFE and left it out of DR and loudness; Auro 9.1 and
larger fell to a bare channel count, with the LFE scored and nothing weighted. Since 0.21.0
crête reads the speaker mask a file declares — dwChannelMask in an extensible
WAV, RF64 or Wave64, the channel-mask tag in FLAC, FFmpeg's native layout — and takes the
labels, the LFE and the weights from it when the mask names one speaker per channel and
describes a layout the table above does not.
A mask that agrees with the count, a mono or stereo file, a file with no mask and a mask
whose bit count differs from the channel count all take the table's path unchanged:
nine Blu-ray, Auro-3D and DTS:X carriers gave identical JSON, and every value in the
weekly corpus is bit-identical to 0.20.0. --channel-mask ignore reproduces
0.20.0.
The weights on a masked layout are a stated choice: ear-level surrounds, back centre
included, at +1.5 dB; front, front-of-centre and every height channel at unity, after
BS.1770-4 Table 4, which puts nothing above 30° elevation at +1.5 dB. FFmpeg's ebur128 weights the top-back pair +1.5 dB, so on height layouts crête reads
slightly lower than it. A masked layout is named floor.lfe.height, as FFmpeg names them.
Not read yet: the DSF channel-type field and the DFF channel chunk, so a
4-channel DSF declaring L R C LFE is still measured as quad. The weekly corpus holds no
masked file that disagrees with its count, so the new path is gated by scripts/check_channel_mask.sh instead — synthetic Auro 8.0 and 9.1 files,
one tone in every channel, whose loudness is arithmetic.
| mask | Layout | Order |
|---|---|---|
0x2D603 | 4.0.4 (Auro 8.0) | L R Ls Rs HL HR HLs HRs |
0x2D60F | 5.1.4 (Auro 9.1) | L R C LFE Ls Rs HL HR HLs HRs |
0x2FE3F | 7.1.6 (Auro 13.1) | L R C LFE Lrs Rrs Lss Rss T HL HC HR HLs HRs |
0xFF | 7.1 (wide) | L R C LFE Ls Rs Lc Rc |
0x107 | 4.0 | L R C Cs |
Dynamic range past stereo is a chosen rule
TT DR defines no procedure beyond two channels, so crête states its rule rather than implying one. DR (PMF) is the mean of the scored channels — whose two-channel case is the stereo rule — with the LFE excluded. A band-limited effects channel has a nearly flat crest factor and a mix-dependent level, so folding it in measures bass management rather than the music.
Two companions ship alongside it, never in place of it: Front L/R DR, the figure directly comparable with the stereo release of the same master, and the lowest scored channel, which is what a mastering check wants flagged, since a mean cannot fall below its worst member.
The LFE is measured in full — its own peak, RMS and DR are reported, bracketed in the detail output and marked unscored in JSON — and scored in nothing. Joint peak, overall RMS and the 3 s block gate likewise run over the scored channels only.
The other way is one flag away
foobar2000's DR Meter includes the LFE — measured 6–0 on discriminating tracks, with no
counter-examples. --dr-lfe include matches it so the two can be compared directly
instead of argued about.
And the flag now has an oracle, not just an argument. Against foobar's own logs for the
three 5.1 albums, include reproduces foobar's album DR exactly on all three, with per-channel DR agreeing to a mean of 0.036 dB over 264 values. The control
is a 4.0 album: with no LFE the two rules are the same rule, and there the flag changes
nothing byte for byte while every track's integer DR matches foobar's.
| DSOTM 5.1 96 kHz | DR raw | scored | lowest |
|---|---|---|---|
exclude (default) | 11.9772 | 5 | Ls |
include | 11.8606 | 6 | LFE |
It affects TT DR only. Integrated loudness, Max M/S, LRA and Min PSR do not move at all — BS.1770-4 weights the LFE at zero, which is a standard rather than a preference. Mono and stereo have no LFE, so no stereo measurement can change.
05 — The one deliberate divergence
Min PSR: crête follows the paper, the reference follows a peak-hold
Min PSR is the worst-agreeing metric in the entire suite — average |Δ| 0.574 dB, max 3.27, roughly ten times the next-worst, in weekly #106. It is also the one metric where that gap is fully explained and deliberately left alone.
The commercial reference's figure was reverse-engineered as a 0.5 dB/s decaying peak-hold against 3 s short-term loudness. crête implements the published AES eBrief 373 formula: the window's sample peak minus its BS.1770-4 short-term loudness, minimum over the track, with a −50 LUFS floor.
Three stacked causes were disentangled before that conclusion: an export sentinel value in the old reference rows, a too-coarse sampling grid in crête, and finally the formula difference itself. A bit-exact decode-versus-formula experiment confirmed the residual is not a decode artefact. No compatibility mode was added — crête stays spec-true and the harness tolerance reflects the documented variance.
06 — Determinism
Reproducibility is a specification too
Floating-point contraction is pinned off
The compiler's default fuses multiply-add on architectures that have an FMA instruction and
not on those that do not, which diverged the ARM binary from the x86 one inside the
K-weighting biquads. -ffp-contract=off is pinned for both C and C++. It is a
no-op on x86 and disciplines ARM to match — and it is gated weekly at exactly
zero.
Parallelism never changes a number
An album's files are analysed across a thread pool, order-preserving, with errors and
warnings replayed after the join. Verified bit-identical to a sequential run on FLAC, DSD
and cue albums. -j only changes wall-clock time.
Bit-identity is proven, not asserted
When the multichannel work touched shared loops, the guard was placed so that mono and stereo reduce to their old form exactly — multiplication by 1.0 is exact in IEEE 754 and the accumulation order was preserved verbatim. Measured: 115 DSD files across four rates, zero value differences.
One platform caveat, stated
Linux and macOS differ by one ULP on 20·log10(x), identically on both
architectures — libm rounding, not contraction. A macOS-produced JSON cannot be
equality-compared against a Linux one.