Skip to content

tempo

tempo(y, opts?): number | Float64Array<ArrayBufferLike>

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

Estimate the global tempo (BPM) with aggregate=‘mean’.

The pseudo-log-normal prior formula: logprior = -0.5 * ((log2(bpms) - log2(start_bpm)) / std_bpm) ** 2 and the estimate is argmax(log1p(1e6 * tempogram_mean) + logprior) over lag bins, with all bins at or above max_tempo masked to -Infinity.

any[] | Float32Array<ArrayBufferLike>

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

any = {}

options object, or sr as a number (positional call: tempo(y, sr))

number | Float64Array<ArrayBufferLike>

estimated tempo in BPM (scalar for aggregate=‘mean’, one BPM per onset-envelope frame for aggregate=null)

on missing/empty input, invalid parameters, or an all-zero onset envelope (silent or constant input) — never returns a fabricated default such as the prior’s argmax