librosax.feature

Feature extraction

Spectral features

spectral_centroid(*[, y, sr, S, n_fft, ...])

Compute the spectral centroid.

spectral_bandwidth(*[, y, sr, S, n_fft, ...])

Compute p'th-order spectral bandwidth.

spectral_rolloff(*[, y, sr, S, n_fft, ...])

Compute roll-off frequency.

spectral_flatness(*[, y, S, n_fft, ...])

Compute spectral flatness.

spectral_contrast(*[, y, sr, S, n_fft, ...])

Compute spectral contrast.

rms(*, y, S, frame_length, hop_length, ...)

Compute root-mean-square (RMS) value for each frame.

zero_crossing_rate(y, *[, frame_length, ...])

Compute the zero-crossing rate of an audio time series.

Mel-frequency representations

melspectrogram(*, y, sr, S, n_fft, ...)

Compute a mel-scaled spectrogram.

mfcc(*[, y, sr, S, n_mfcc, dct_type, norm, ...])

Compute Mel-frequency cepstral coefficients (MFCCs).

Chromagram

chroma_stft(*[, y, sr, S, norm, n_fft, ...])

Compute a chromagram from a power spectrogram or waveform.

chroma_cqt(*[, y, sr, C, hop_length, fmin, ...])

Chromagram from a constant-Q transform.

chroma_filter(*, sr, n_fft[, n_chroma, ...])

Create a chroma filter bank.

Constant-Q transform

cqt(y, *, sr, hop_length, fmin, n_bins, ...)

Compute the constant-Q transform following nnAudio's CQT1992v2 implementation.

cqt2010(y, *, sr, hop_length, fmin, fmax, ...)

Compute constant-Q transform using the 2010 algorithm with multi-resolution.

cqt_frequencies(*[, n_bins, ...])

Compute the center frequencies of Constant-Q bins.

Rhythm features

tempogram(*[, y, sr, onset_envelope, ...])

Compute the tempogram: local autocorrelation of the onset strength envelope.

fourier_tempogram(*[, y, sr, ...])

Compute the Fourier tempogram: Fourier transform of the onset strength envelope.

hybrid_tempogram(*[, y, sr, onset_envelope, ...])

Compute a hybrid tempogram.

metrogram(*, tg, freqs, factors, aggregate, ...)

Summarize the presence of rhythmic ratios in a tempogram.

tempogram_ratio(*[, y, sr, onset_envelope, ...])

Compute tempogram ratio: the ratio of absolute energy in tempo harmonics.

tempo(*[, y, sr, onset_envelope, ...])

Estimate the tempo (beats per minute) from an audio signal.

Tonal features

tonnetz(*[, y, sr, chroma])

Compute the tonal centroid features (tonnetz).

Pitch and frequency

hz_to_octs(frequencies, *[, tuning, ...])

Convert frequencies (Hz) to octave numbers.

note_to_hz(...)

Convert one or more note names to frequency (Hz).