@audio/beat-track
v1.0.3
Published
Dynamic programming beat tracker
Readme
@audio/beat-track

Dynamic programming beat tracker
npm install @audio/beat-trackimport beatTrack from '@audio/beat-track'Dynamic programming beat tracker. Estimates tempo (via autocorrelation), then finds the globally optimal beat sequence by maximizing onset strength while penalizing tempo deviation. Each beat position is placed where the onset function is strongest, subject to staying near the expected tempo period.
import beatTrack from '@audio/beat-track'
let { beats, bpm, confidence } = beatTrack(samples, { fs: 44100 })
let result = beatTrack(samples, { fs: 44100, bpm: 120 }) // hint tempo| Param | Default | |
|---|---|---|
| bpm | auto-estimated | Target BPM (auto-estimated if omitted) |
| tightness | 680 | Tempo constraint weight (higher = stricter) |
| + all tempo params | | fs, frameSize, hopSize, minBpm, maxBpm, candidates |
Returns { beats: Float64Array, bpm, confidence }.
Use when: Irregular timing, live performance, rubato — adapts to where beats actually fall.
Not for: Perfectly metronomic material — detect is faster and sufficient.
Ref: Ellis, "Beat Tracking by Dynamic Programming" (JNMR 2007).
Part of @audio/beat — the beat family umbrella. This README is generated from the umbrella docs.
MIT © audiojs
