Close Γ-W1-T7 re-review: pitch-sync cadence math, floor-model regression check, evidence-count fix, one-home comments

New cadence-collapse-band test at P=1470 shows PSOLA eliminates the corner rather than regressing it (18.52% -> 0.00%).
This commit is contained in:
2026-08-02 05:34:43 -04:00
parent ef59265e7a
commit f1168e16eb
9 changed files with 249 additions and 40 deletions
+13 -2
View File
@@ -394,10 +394,21 @@ static void testTheLoopStandsInForTheSourceOnlyWhenItCostsNoSearchBand() {
periodAnalysisSpan(frames, 60000, 60000 + static_cast<std::int64_t>(minimum), true, rate);
CHECK(atMinimum.from == 60000 && atMinimum.count == minimum);
// And the too-short loop still DETECTS through the wider span — refusing there would be a
// regression against analysing the whole source, and a short sustain loop is common.
const double p = static_cast<double>(rate) / 30.0;
const std::vector<AudioSample> src = sineOfPeriod(frames, p);
// The span IS taken at the minimum, but that alone doesn't say detection BEHAVES there: at
// exactly one probe block, detectPeriod takes the lone-probe carve-out (no agreement check
// at all) — the span choice and the accept rule meet at this exact boundary, and that
// meeting point is what needs to actually detect, not just be selected.
const PeriodEstimate atMin = detectPeriod(src, rate, atMinimum.from, atMinimum.count);
std::printf(" loop at the minimum span -> %s (%.3f, want %.3f)\n",
atMin.valid() ? "detected" : "NONE", atMin.frames, p);
CHECK(atMin.valid());
if (atMin.valid()) CHECK(std::fabs(atMin.frames - p) < 0.5);
// And the too-short loop still DETECTS through the wider span — refusing there would be a
// regression against analysing the whole source, and a short sustain loop is common.
const PeriodEstimate est = detectPeriod(src, rate, shortLoop.from, shortLoop.count);
std::printf(" short loop -> whole source: %s (%.3f)\n", est.valid() ? "detected" : "NONE",
est.frames);