← Gallery Loop detection — four-strategy shootout

Loop detection — four-strategy shootout

loop.detect()

Four different ways of finding a good loop — fast, precise, musical, and recurrence — all take a crack at the same drum track, Drive Through Beat.wav. Each result is painted as a colored region on the shared waveform; click a table row to audition that strategy's loop via LoopPlayer. Technically it's one buffer and one entry point: the WAV is decoded with the package's own decodeWav (no browser resampling), then loop.detect(buffer, {strategy}) runs each strategy. The fast row is asserted against tools/goldens/loop_goldens.json (±441 samples, bpm ±0.1) — the same golden lock as examples/node/loop-detect.mjs (node-verified: Δ ≤ 1 sample on all four golden WAVs). Recurrence must report NO bpm field: it is tempo-free by contract and never invents one.

strategyloopStart (s)loopEnd (s)confidencebpm
loading + decoding WAV…