Skip to content

estimate_tempo

estimate_tempo(tgram, sr?, hop_length?, start_bpm?, std_bpm?, max_tempo?): object

Defined in: packages/pleco-xa/src/scripts/xa-tempogram.js:579

Estimate the global tempo from a (lag) tempogram using tempo scoring: time-mean of the tempogram, pseudo-log-normal prior logprior = -0.5 * ((log2(bpm) - log2(start_bpm)) / std_bpm)^2 and argmax of log1p(1e6 * mean) + logprior with tempi at/above max_tempo masked out. (The previous raw argmax had no prior and returned the 60 BPM subharmonic on a plain 120 BPM click train.)

(any[] | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>)[]

tempogram [n_lags][n_frames] as returned by tempogram()

number = 22050

sample rate

number = 512

hop length used for the onset envelope

number = 120

center of the log-normal prior

number = 1.0

prior standard deviation (log2 space)

number = 320.0

mask tempi at/above this value

object

tempo in BPM and the measured mean-tempogram value at the chosen lag (never a fabricated confidence)

strength: number

tempo: number

on empty input or when every lag is masked