Skip to content

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.

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

boolean

center tempogram windows

number[]

tempo multiples to sample; defaults to the Prockup’15 13-factor table

number

value for out-of-range harmonics

any[] | Float64Array<ArrayBufferLike>

BPM per tempogram lag bin; defaults to tempo_frequencies(n_lags, hop_length, sr)

number

string

interpolation kind (only ‘linear’ is validated against the reference fixtures; others throw rather than silently approximate)

number

mask tempi at/above this

number

tempogram normalization

any[] | Float32Array<ArrayBufferLike>

pre-computed onset strength envelope

number

sample rate

number

center of the log-normal prior

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

number

tempogram autocorrelation window

string

tempogram window

any[] | Float32Array<ArrayBufferLike>

audio time series (used only when neither tg nor onset_envelope is supplied)

Float64Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>[]

tempogram ratio [n_factors][n_frames], or [n_factors] when aggregate is provided

on invalid parameters or shape mismatches — never fabricates