diff --git a/docs/renders/aqua-feel-native-diff-2026-11-10.md b/docs/renders/aqua-feel-native-diff-2026-11-10.md index b3c6040..e227cb0 100644 --- a/docs/renders/aqua-feel-native-diff-2026-11-10.md +++ b/docs/renders/aqua-feel-native-diff-2026-11-10.md @@ -97,7 +97,7 @@ What the data says: ## Tolerance in `native-diff.mjs` -Added, because the data shows a gap. Across all 13 sources and the 3 conditions the metric deltas stay under |LUFS| 0.017 dB, |true peak| 0.152 dB, centroid 0.3 %. A deliberate +1 dB gain on the native buffer moves LUFS and true peak by 1.0 dB. The limits sit between: 0.1 dB, 0.5 dB, 1 %. Sample-level error has no limit with the library smoother (the waveforms legitimately diverge), but with `--smoother imp3` it has one at -60 dB (the worst row is -75.4 dB; a one-sample shift reads about -4 dB). +The limits (`LIMITS`) and the comparison now live in `tools/aqua-feel/native-compare.js`; `native-diff.test.mjs` trips each one. Added, because the data shows a gap. Across all 13 sources and the 3 conditions the metric deltas stay under |LUFS| 0.017 dB, |true peak| 0.152 dB, centroid 0.3 %. A deliberate +1 dB gain on the native buffer moves LUFS and true peak by 1.0 dB. The limits sit between: 0.1 dB, 0.5 dB, 1 %. Sample-level error has no limit with the library smoother (the waveforms legitimately diverge), but with `--smoother imp3` it has one at -60 dB (the worst row is -75.4 dB; a one-sample shift reads about -4 dB). Mutation check on the tool, `--items smoother --smoother imp3`: unmutated, 12 of 12 clean, exit 0; +1 dB native gain, 12 of 12 flagged (`loudnessLufs`, `truePeakDb`, `relRmsErrDb`), exit 1; one-sample native shift, 12 of 12 flagged (`relRmsErrDb`), exit 1. A one-sample shift is not detectable with the library smoother; `loudnessLufs`, `truePeakDb` and centroid also cannot see it. The limits are tripwires fit to these 13 sources, not taste. diff --git a/tools/aqua-feel/native-diff.test.mjs b/tools/aqua-feel/native-diff.test.mjs index 41d68e2..98c968d 100644 --- a/tools/aqua-feel/native-diff.test.mjs +++ b/tools/aqua-feel/native-diff.test.mjs @@ -45,6 +45,12 @@ t("a spectral change (a two-point low-pass) trips the centroid limit", () => { assert.ok(violationsOf(row, "library").includes("centroidMedianHz")); }); +t("centroid edge, in literal numbers: 1000 Hz vs 1009 Hz (0.9 %) passes, vs 1011 Hz (1.1 %) trips, in both directions", () => { + const base = compareRenders("probe", sig, sig), at = (w, nat) => ({ ...base, wasm: { ...base.wasm, centroidMedianHz: w }, native: { ...base.native, centroidMedianHz: nat } }); + for (const [w, nat] of [[1000, 1009], [1000, 991], [1000, 1000]]) assert.deepEqual(violationsOf(at(w, nat), "library"), [], `${w} vs ${nat}`); + for (const [w, nat] of [[1000, 1011], [1000, 989]]) assert.deepEqual(violationsOf(at(w, nat), "library"), ["centroidMedianHz"], `${w} vs ${nat}`); +}); + t("a one-sample shift trips only the sample bound, and only under imp3 (library mode has no sample bound)", () => { const sh = shift(sig, 1), row = compareRenders("probe", sig, sh); assert.ok(row.relRmsErrDb > LIMITS.relRmsErrDbImp3, `relRmsErrDb ${row.relRmsErrDb}`);