Gamma-W1-T7: gate PSOLA's two untested wires, fix the cadence test's contradictory rationale, add a vacuity guard

This commit is contained in:
2026-08-02 03:01:15 -04:00
parent 93230208ff
commit 334022c0f1
5 changed files with 64 additions and 9 deletions
+17 -7
View File
@@ -780,10 +780,11 @@ static void testStretchCadenceCornerArtifactEnergyAtRate2ShiftQuarter() {
const std::size_t outFrames = 60000;
const std::size_t from = 20000, len = 32768;
// Below the safe floor (P > 315 frames): the cadence inequality predicts real damage,
// measured at 7-21% (see above). The threshold (5%) sits above the alignable control's
// near-zero floor and under the observed range, so it discriminates a genuine cadence hit
// from a clean render; the ceiling (30%) is a generous margin above the highest measured
// Below the safe floor (P > 315 frames): per the header's CORRECTED note, this raw reading
// is mostly the metric's own mainlobe-leakage floor, not cadence damage (the real excess is
// ~0.2-0.5%, asserted in testCadenceCornerIsUnmovedByAPitchSynchronousSplice). The bounds
// below are a RAW-READING STABILITY TRIPWIRE, not a discriminator — they catch a large swing
// in the raw measurement; the ceiling (30%) is a generous margin above the highest measured
// value, there to catch a much worse regression rather than to chase today's exact number.
for (double period : {500.0, 600.0, 700.0}) {
const double f0 = 1.0 / period;
@@ -918,7 +919,7 @@ static void testThirtyHertzSplicesAlignOnceTheSourcePeriodIsKnown() {
{"34 Hz +2 st, rate 1.0", 34.0, 1.0, 2.0}, // control: alignable without a period
{"34 Hz rate 2.0", 34.0, 2.0, 0.0},
};
double controlWorst = 0.0, subjectWorst = 0.0;
double controlWorst = 0.0, subjectWorst = 0.0, subjectOffWorst = 0.0;
for (const Row& r : rows) {
const double period = 44100.0 / r.freq;
std::vector<AudioSample> src(srcLen);
@@ -938,8 +939,12 @@ static void testThirtyHertzSplicesAlignOnceTheSourcePeriodIsKnown() {
std::printf(" [30 Hz] %-24s (want %6.1f fr, metric floor %.2f%%) excess energy: "
"fixed window %6.2f%% -> pitch-synchronous %6.2f%%\n", r.label, want, floor,
pctOff, pctOn);
if (r.freq == 34.0) controlWorst = std::max(controlWorst, pctOn);
else subjectWorst = std::max(subjectWorst, pctOn);
if (r.freq == 34.0) {
controlWorst = std::max(controlWorst, pctOn);
} else {
subjectWorst = std::max(subjectWorst, pctOn);
subjectOffWorst = std::max(subjectOffWorst, pctOff);
}
}
// 30 Hz stops being a special case: with the period known its excess over the metric's own
// floor is no worse than the alignable neighbour's, measured identically. Against the
@@ -949,6 +954,11 @@ static void testThirtyHertzSplicesAlignOnceTheSourcePeriodIsKnown() {
subjectWorst, controlWorst);
CHECK(subjectWorst < 0.10);
CHECK(subjectWorst <= controlWorst + 0.05); // 0.05 absorbs the floor subtraction's sign noise
// Vacuity guard, matching testTwentyNineHertzAtRateTwoKeepsItsPitch's sibling check: the
// FIXED-WINDOW (no period set) arm is asserted too, so a setSourcePeriod that silently did
// nothing would render both arms identically and fail here rather than passing on the
// absolute bound above by luck.
CHECK(subjectOffWorst > subjectWorst + 1.0);
}
// The sharpest single symptom of the geometry: at 29 Hz the nearest multiple misses the