librosax.feature.spectral_rolloff¶
- spectral_rolloff(*, y: Array | None = None, sr: float = 22050, S: Array | None = None, n_fft: int = 2048, hop_length: int = 512, win_length: int | None = None, window: str = 'hann', center: bool = True, pad_mode: str = 'constant', freq: Array | None = None, roll_percent: float = 0.85) Array[source]¶
Compute roll-off frequency.
The roll-off frequency is defined for each frame as the center frequency for a spectrogram bin such that at least roll_percent (0.85 by default) of the energy of the spectrum in this frame is contained in this bin and the bins below. Users should ensure S is real-valued and non-negative.
- Parameters:
y – Audio time series. Multichannel is supported.
sr – Audio sampling rate
S – (optional) Pre-computed spectrogram magnitude
n_fft – FFT window size
hop_length – Hop length for STFT
win_length – Window length
window – Window function
center – If True, pad the signal
pad_mode – Padding mode
freq – Center frequencies for spectrogram bins. If None, FFT bin center frequencies are used. Assumed to be sorted in increasing order.
roll_percent – Roll-off percentage (0 < roll_percent < 1)
- Returns:
Roll-off frequency for each frame [shape=(…, 1, t)]
- Return type:
jnp.ndarray