Skip to content

estimateConstrainedTempo

estimateConstrainedTempo(window, sr, globalTempo): Promise<{ bpm: any; confidence: number; }>

Defined in: packages/pleco-xa/src/scripts/xa-bpm-algorithm.js:289

Estimate tempo within constrained range

REPAIR (2026-07-02 proof-of-work): the original reduced a 4s window to an ~15-point energy downsample (8 sub-buckets, half-bucket hop) while the BPM search needed lags >= ~17, so the autocorrelation loop never executed and every window silently returned globalTempo — the window-by-window “tempo stability” output was constant regardless of actual tempo changes. Now the raw onset-envelope window is mean-centered and autocorrelated directly (normalized correlation, same estimator as estimateGlobalTempo) over the constrained lag range. Confidence is the best normalized correlation (measured, in [0, 0.95]); if the window is too short to search any lag the global tempo is returned with confidence 0 — never a fabricated confidence.

any

any

any

Promise<{ bpm: any; confidence: number; }>