Skip to content

beat_track

beat_track(y, sr?, opts?): object

Defined in: packages/pleco-xa/src/scripts/xa-beat-tracker.js:602

Dynamic programming beat tracker.

Pipeline (Ellis 2007):

  1. onset_strength(y, aggregate=‘median’) (skipped if onsetEnvelope given)
  2. tempo(onsetEnvelope) with the log-normal prior (skipped if bpm given)
  3. DP peak picking consistent with the estimated tempo

any[] | Float32Array<ArrayBufferLike>

audio time series (may be null when opts.onsetEnvelope is provided)

number = 22050

sample rate

number | number[] | Float64Array<ArrayBufferLike>

known tempo (skips estimation). A scalar tracks a static tempo; an ARRAY of per-frame BPM values (length 1 or one per onset-envelope frame, e.g. the output of tempo(…, {aggregate: null})) tracks time-varying tempo.

number

any[] | Float32Array<ArrayBufferLike>

pre-computed onset envelope

boolean

sparse indices vs dense boolean array

number

prior center for tempo estimation

number

beat distribution tightness

boolean

trim weak leading/trailing beats

string

‘frames’ | ‘samples’ | ‘time’ (default is ‘frames’)

object

tempo echoes a caller-provided bpm as given; when estimated it is a scalar

beats: number[] | boolean[]

tempo: number | number[] | Float64Array<ArrayBufferLike>

on missing/empty input or invalid parameters