← Gallery Onset detection — clicks found on time

Onset detection — clicks found on time

xa-onset — onset envelope + detected onsets vs known click positions

Play 20 evenly spaced clicks and a good onset detector should find all 20, each at the moment it actually happened. This page generates that click track, runs the detector, and marks every detected onset as an orange tick on the energy curve below the waveform. Technically: a synthetic 10s click train at 120 BPM (20 clicks every 0.5s, sr=22050) is analyzed with onset_strength() and onsetDetect(). Proofs: the envelope has exactly ceil(len/hop) frames, 19–20 of the 20 clicks are recovered, the median inter-onset interval is within one hop (23.2ms) of 0.500s, and every detected onset lands within 100ms (one uncentered n_fft window) of a true click. Same asserts as examples/node/xa-onset.mjs.