tempogram_ratio
tempogram_ratio(
options?):Float64Array<ArrayBufferLike> |Float64Array<ArrayBufferLike>[]
Defined in: packages/pleco-xa/src/scripts/xa-tempogram.js:460
Tempogram ratio features (a.k.a. spectral rhythm patterns). Summarizes tempogram energy at metrically important multiples of the estimated tempo by sampling the tempogram at harmonic/subharmonic ratios of the per-frame BPM:
tg = tempogram(…) # [win_length][n] freqs= tempo_frequencies(n_bins=win_length, …) # BPM per lag bin bpm = tempo(tg=tg, aggregate=None, …) # per-frame BPM tgr = f0_harmonics(tg, freqs=freqs, f0=bpm, harmonics=factors)
Options use a keyword-only signature.
Parameters
Section titled “Parameters”options?
Section titled “options?”aggregate?
Section titled “aggregate?”Function
if given, called on each harmonic’s per-frame Float64Array to collapse the time axis (aggregate(tgr, axis=-1)); null keeps the per-frame matrix
any[] | Float64Array<ArrayBufferLike>
pre-computed per-frame tempo (length n_frames); estimated from tg when null
center?
Section titled “center?”boolean
center tempogram windows
factors?
Section titled “factors?”number[]
tempo multiples to sample; defaults to the Prockup’15 13-factor table
fill_value?
Section titled “fill_value?”number
value for out-of-range harmonics
freqs?
Section titled “freqs?”any[] | Float64Array<ArrayBufferLike>
BPM per tempogram lag bin; defaults to tempo_frequencies(n_lags, hop_length, sr)
hop_length?
Section titled “hop_length?”number
string
interpolation kind (only ‘linear’ is validated against the reference fixtures; others throw rather than silently approximate)
max_tempo?
Section titled “max_tempo?”number
mask tempi at/above this
number
tempogram normalization
onset_envelope?
Section titled “onset_envelope?”any[] | Float32Array<ArrayBufferLike>
pre-computed onset strength envelope
number
sample rate
start_bpm?
Section titled “start_bpm?”number
center of the log-normal prior
std_bpm?
Section titled “std_bpm?”number
prior std (log2 space)
(any[] | Float64Array<ArrayBufferLike>)[]
pre-computed tempogram [n_lags][n_frames]; if given, y/onset_envelope are ignored and win_length is inferred from n_lags
win_length?
Section titled “win_length?”number
tempogram autocorrelation window
window?
Section titled “window?”string
tempogram window
any[] | Float32Array<ArrayBufferLike>
audio time series (used only when neither tg nor onset_envelope is supplied)
Returns
Section titled “Returns”Float64Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>[]
tempogram ratio [n_factors][n_frames], or [n_factors] when aggregate is provided
Throws
Section titled “Throws”on invalid parameters or shape mismatches — never fabricates