librosax.feature.metrogram¶
- metrogram(*, tg: ndarray, freqs: ndarray, factors: ndarray | None = None, aggregate: Callable | None = <function sum>, kind: str = 'linear', fill_value: float = 0) ndarray[source]¶
Summarize the presence of rhythmic ratios in a tempogram.
A tempogram with simultaneous energy at 90 BPM and 30 BPM has a strong 1/3 ratio, which makes meter estimation possible by looking for the ratio between the beat and downbeat frequencies. The default factors 1/3, 1/4, 1/5 and 1/7 correspond to 3/4, 4/4, 5/4 and 7/4 time.
This is a wrapper around librosa.feature.metrogram.
Parameters¶
- tgnp.ndarray [shape=(…, n_freqs, n)]
Tempogram, as produced by tempogram or fourier_tempogram
- freqsnp.ndarray [shape=(n_freqs,)]
Frequencies (in BPM) of the tempogram rows
- factorsnp.ndarray or None
Rhythmic ratios to evaluate. Defaults to [1/3, 1/4, 1/5, 1/7].
- aggregatecallable or None
Aggregation over the ratio axis. If None, the un-aggregated product is returned with the ratio axis at -3.
- kindstr
Interpolation kind, as in scipy.interpolate.interp1d
- fill_valuefloat
Value used outside the interpolation range
Returns¶
- metrogramnp.ndarray
Ratio energies with shape (…, n_factors, n). If aggregate is None the un-aggregated product is returned instead, with the tempo axis retained: (…, n_factors, n_freqs, n).
See Also¶
tempogram fourier_tempogram librosa.feature.metrogram