Fix inverted splice-cadence test: assert artifact energy, not zero-crossing period

Zero-crossing counting was anti-correlated with the real defect (splice debris
fools it). Now asserts energy outside the fundamental, with an alignable control,
matching test_preserve_low_frequency.cpp's approach.
This commit is contained in:
2026-08-01 21:31:32 -04:00
parent ac653aa581
commit abace156a5
3 changed files with 108 additions and 19 deletions
+9 -5
View File
@@ -22,11 +22,15 @@ namespace reasampler::instrument::engine {
// has less than one period to align against. Measured at rate 4.0, shift 0.25 (-24 st):
// interval 2205/3.75 ~= 588 vs period ~4*P ~= 785 frames (P ~= 196) — matches the originally
// observed 539-vs-785 failure. This range's ceiling (2.0, not 4.0) raises the safe floor, it
// does not remove it: at rate 2.0, shift 0.25, interval = 2205/1.75 = 1260 still fails for
// any source period P > 315 frames (~140 Hz at 44.1k) — inside bass/low-vocal material, and
// -24 st is reachable from the Pitch knob alone. (The pre-stretch rate-1.0 engine's floor by
// the same inequality is P > 735, ~60 Hz — what this range raises the floor from, not what
// it removes.)
// does not remove it: at rate 2.0, shift 0.25, interval = 2205/1.75 = 1260 still produces
// measurable splice debris for any source period P > 315 frames (~140 Hz at 44.1k) — inside
// bass/low-vocal material, and -24 st is reachable from the Pitch knob alone. pitch_shift_tests
// (testStretchCadenceCornerArtifactEnergyAtRate2ShiftQuarter) asserts this corner directly at
// P=500/600/700: energy outside the fundamental runs 7-21% there against ~0% on an aligned
// control at the same rate/shift — zero-crossing period is NOT what it checks, since splice
// debris fools that estimator into reading the wrong period on a render whose fundamental is
// actually fine. (The pre-stretch rate-1.0 engine's floor by the same inequality is P > 735,
// ~60 Hz — what this range raises the floor from, not what it removes.)
//
// A SECOND, INDEPENDENT limit binds the same material, and no rate bound touches it. A splice
// relocates the tap by the nominal window refined by a search over +/- window/4, so the