librosax.feature.tempogram_ratio¶
- tempogram_ratio(*, y: ndarray | None = None, sr: float = 22050, onset_envelope: ndarray | None = None, tg: ndarray | None = None, bpm: ndarray | None = None, hop_length: int = 512, win_length: int = 384, start_bpm: float = 120, std_bpm: float = 1.0, max_tempo: float | None = 320.0, freqs: ndarray | None = None, factors: ndarray | None = None, aggregate: Callable | None = None, prior: Callable | None = None, center: bool = True, window: str = 'hann', kind: str = 'linear', fill_value: float = 0, norm: float | Callable | None = inf) ndarray[source]¶
Compute tempogram ratio: the ratio of absolute energy in tempo harmonics.
This is a wrapper around librosa.feature.tempogram_ratio.
Parameters¶
- ynp.ndarray [shape=(…, n)] or None
Audio time series (if tempogram not provided)
- srfloat > 0
Sampling rate of the audio time series
- onset_envelopenp.ndarray [shape=(n,)] or None
Pre-computed onset strength envelope (if tempogram not provided)
- tgnp.ndarray [shape=(…, win_length, n)] or None
Pre-computed tempogram. If not provided, it will be computed from y or onset_envelope.
- bpmnp.ndarray or None
Optional BPM values to evaluate
- hop_lengthint > 0
Number of audio samples between successive onset measurements
- win_lengthint > 0
Length of the tempogram window
- start_bpmfloat > 0
Initial guess of the BPM
- std_bpmfloat > 0
Standard deviation of tempo distribution
- max_tempofloat > 0 or None
Maximum tempo to consider (in BPM)
- freqsnp.ndarray or None
Optional frequency values
- factorsnp.ndarray or None
Optional factors for ratio computation
- aggregatecallable or None
Aggregation function
- priorcallable or None
Prior distribution over tempo
- centerbool
If True, tempogram windows are centered.
- windowstr, tuple, number, callable, or list-like
A window specification
- kindstr
Interpolation kind
- fill_valuefloat
Fill value for interpolation
- norm{np.inf, float > 0, None, callable}
Normalization mode
Returns¶
- rationp.ndarray
Tempogram ratio features
See Also¶
tempogram librosa.feature.tempogram_ratio