Skip to content

Feature reference

Generated by docs/gen_features.py from the extractor signatures and docstrings. Every feature is called as afx_audio.FEATURE_MAP[name](signal, sr, **parameters) and returns {name: array}; "rows" is the size of the first axis of that array (1 means one value per frame, shape (n_frames,)).

Time

zcr

Zero-crossing rate: sign changes between consecutive samples divided by the frame length.

Units: crossings per sample. Rows: 1. Function: afx_audio.extractors.time_domain.extract_zero_crossing_rate.

Torch: afx_audio.torch.functional.zero_crossing_rate, equal to NumPy within rtol 1e-09, atol 1e-12 (float64).

Parameters: frame_size=2048, hop_length=512, center=True, threshold=1e-10.

variance

Variance of the samples (population, ddof=0).

Units: amplitude^2. Rows: 1. Function: afx_audio.extractors.time_domain.extract_variance.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True.

entropy

Shannon entropy (bits) of the amplitude histogram with num_bins equal-width bins.

Units: bits. Rows: 1. Function: afx_audio.extractors.time_domain.extract_entropy.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True, num_bins=100.

crest_factor

Peak amplitude over RMS. NaN for an all-zero frame.

Units: ratio. Rows: 1. Function: afx_audio.extractors.time_domain.extract_crest_factor.

NaN for: all-zero frame.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True.

rms_energy

Root mean square of the samples.

Units: amplitude. Rows: 1. Function: afx_audio.extractors.time_domain.extract_rms_energy.

Torch: afx_audio.torch.functional.rms_energy, equal to NumPy within rtol 1e-09, atol 1e-12 (float64).

Parameters: frame_size=None, hop_length=None, center=True.

kurtosis

Sample kurtosis m4 / m2^2 (biased moments), minus 3 when fisher.

Units: dimensionless. Rows: 1. Function: afx_audio.extractors.time_domain.extract_kurtosis.

NaN for: constant frame (zero variance), including digital silence.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True, fisher=True.

short_time_energy

Sum of squared samples.

Units: amplitude^2. Rows: 1. Function: afx_audio.extractors.time_domain.extract_short_time_energy.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True.

energy_ratio

Energy before split (fraction of the frame length) over energy after it plus 1e-10. NaN for silence.

Units: ratio. Rows: 1. Function: afx_audio.extractors.time_domain.extract_energy_ratio.

NaN for: all-zero frame.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True, split=0.5.

sample_entropy

Sample entropy -ln(A/B) (Richman and Moorman, 2000, Am. J. Physiol. 278(6)).

Units: nats. Rows: 1. Function: afx_audio.extractors.time_domain.extract_sample_entropy.

NaN for: no template matches (A or B is 0), or fewer than m + 2 samples.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True, m=2, r=0.2, max_samples=20000.

mobility

Hjorth mobility, RMS(x') / RMS(x) with x' the first difference.

Units: ratio. Rows: 1. Function: afx_audio.extractors.time_domain.extract_mobility.

NaN for: all-zero frame, or frame shorter than 2 samples.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True.

complexity

RMS(x'') / (RMS(x') + 1e-10), the mobility of x'. NaN for a constant frame, silence included.

Units: ratio. Rows: 1. Function: afx_audio.extractors.time_domain.extract_complexity.

NaN for: constant frame (zero first difference), including digital silence, or frame shorter than 3 samples.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True.

Autocorrelation

autocorr_variance

Variance of the raw autocorrelation over lags 0..max_lag-1.

Units: amplitude^4. Rows: 1. Function: afx_audio.extractors.time_domain.extract_autocorrelation_variance.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True, max_lag=100.

autocorr_snr

Peak over mean (plus 1e-10) of the autocorrelation over lags 0..max_lag-1. NaN for an all-zero frame.

Units: ratio. Rows: 1. Function: afx_audio.extractors.time_domain.extract_autocorr_snr.

NaN for: all-zero frame.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True, max_lag=100.

autocorr_zero_crossings

Number of sign changes of the autocorrelation over lags 0..max_lag-1.

Units: count. Rows: 1. Function: afx_audio.extractors.time_domain.extract_autocorr_zero_crossings.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True, max_lag=100.

autocorr_peak_width

Lags from the first to the last autocorrelation value at or above half the peak, inclusive.

Units: lags. Rows: 1. Function: afx_audio.extractors.time_domain.extract_autocorr_peak_width.

NaN for: all-zero frame.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True, max_lag=100.

autocorr_decay_rate

Negative least-squares slope of log(|acf| + 1e-10) over lags 1..max_lag-1.

Units: log units per lag. Rows: 1. Function: afx_audio.extractors.time_domain.extract_autocorr_decay_rate.

NaN for: all-zero frame, or fewer than 3 autocorrelation lags (max_lag or frame below 3).

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True, max_lag=100.

autocorr_coeffs_deviation

Standard deviation of the autocorrelation over lags 0..max_lag-1.

Units: amplitude^2. Rows: 1. Function: afx_audio.extractors.time_domain.extract_autocorr_coeffs_deviation.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True, max_lag=100.

max_peak_autocorr_envelope

Largest autocorrelation value over lags 1..max_lag-1. NaN when only lag 0 exists.

Units: amplitude^2. Rows: 1. Function: afx_audio.extractors.time_domain.extract_max_peak_autocorr_envelope.

NaN for: only lag 0 available (max_lag or frame of 1).

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True, max_lag=100.

Spectral

spectral_centroid

Magnitude-weighted mean frequency in Hz, as librosa.feature.spectral_centroid. 0 for a silent frame.

Units: Hz. Rows: 1. Function: afx_audio.extractors.frequency_domain.extract_spectral_centroid.

Torch: afx_audio.torch.functional.spectral_centroid, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: frame_size=2048, hop_length=512, center=True.

spectral_bandwidth

Magnitude-weighted standard deviation of frequency around the centroid, in Hz (librosa, p=2).

Units: Hz. Rows: 1. Function: afx_audio.extractors.frequency_domain.extract_spectral_bandwidth.

Torch: afx_audio.torch.functional.spectral_bandwidth, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: frame_size=2048, hop_length=512, center=True.

spectral_rolloff

Spectral rolloff: the lowest bin frequency at which the cumulative sum of |X|^power reaches roll_percent of the frame total.

Units: Hz. Rows: 1. Function: afx_audio.extractors.frequency_domain.extract_spectral_rolloff.

Torch: afx_audio.torch.functional.spectral_rolloff, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: frame_size=2048, hop_length=512, roll_percent=0.85, center=True, power=1.0.

spectral_contrast

Spectral contrast (Jiang et al., 2002, Proc. IEEE ICME), shape (n_bands + 1, n_frames).

Units: dB. Rows: n_bands + 1. Function: afx_audio.extractors.frequency_domain.extract_spectral_contrast.

Torch: afx_audio.torch.functional.spectral_contrast, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: frame_size=2048, hop_length=512, n_bands=6, fmin=200.0, quantile=0.02, center=True.

spectral_entropy

Shannon entropy in bits of the magnitude spectrum normalized to sum 1.

Units: bits. Rows: 1. Function: afx_audio.extractors.frequency_domain.extract_spectral_entropy.

NaN for: silent frame (magnitude sum at most 1e-10).

Torch: afx_audio.torch.functional.spectral_entropy, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: frame_size=2048, hop_length=512, center=True.

spectral_flatness

Geometric over arithmetic mean of the power spectrum (Wiener entropy).

Units: ratio. Rows: 1. Function: afx_audio.extractors.frequency_domain.extract_spectral_flatness.

Torch: afx_audio.torch.functional.spectral_flatness, equal to NumPy within rtol 1e-09, atol 1e-12 (float64).

Parameters: frame_size=2048, hop_length=512, center=True.

spectral_flux

Euclidean distance between consecutive magnitude spectra, shape (n_frames - 1,).

Units: magnitude. Rows: 1. Function: afx_audio.extractors.frequency_domain.extract_spectral_flux.

Torch: afx_audio.torch.functional.spectral_flux, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: frame_size=2048, hop_length=512, center=True.

spectral_skewness

Third standardized moment of frequency under the magnitude spectrum. NaN for a silent or single-bin frame.

Units: dimensionless. Rows: 1. Function: afx_audio.extractors.frequency_domain.extract_spectral_skewness.

NaN for: silent frame or zero spectral spread (single bin).

Torch: afx_audio.torch.functional.spectral_skewness, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: frame_size=2048, hop_length=512, center=True.

spectral_slope

Least-squares slope of 20 log10(|X| + 1e-10) against frequency, in dB per Hz.

Units: dB per Hz. Rows: 1. Function: afx_audio.extractors.frequency_domain.extract_spectral_slope.

NaN for: silent frame, or a single-bin spectrum.

Torch: afx_audio.torch.functional.spectral_slope, equal to NumPy within rtol 1e-09, atol 1e-12 (float64).

Parameters: frame_size=2048, hop_length=512, center=True.

spectral_kurtosis

Fourth standardized moment of frequency under the magnitude spectrum, minus 3 when fisher.

Units: dimensionless. Rows: 1. Function: afx_audio.extractors.frequency_domain.extract_spectral_kurtosis.

NaN for: silent frame or zero spectral variance (single bin).

Torch: afx_audio.torch.functional.spectral_kurtosis, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: frame_size=2048, hop_length=512, center=True, fisher=True.

spectral_crest

Largest over mean magnitude of the spectrum, per frame.

Units: ratio. Rows: 1. Function: afx_audio.extractors.frequency_domain.extract_spectral_crest.

NaN for: silent frame.

Torch: afx_audio.torch.functional.spectral_crest, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: frame_size=2048, hop_length=512, center=True.

spectral_decrease

Spectral decrease (Peeters, 2004): sum_k (a_k - a_1) / (k - 1) / sum_k a_k over bins k = 2..K.

Units: per bin. Rows: 1. Function: afx_audio.extractors.frequency_domain.extract_spectral_decrease.

NaN for: no magnitude above the DC bin (silence), or a single-bin spectrum.

Torch: afx_audio.torch.functional.spectral_decrease, equal to NumPy within rtol 1e-09, atol 1e-12 (float64).

Parameters: frame_size=2048, hop_length=512, center=True.

Spectrogram

chroma_stft

Chromagram from the STFT power spectrum, shape (12, n_frames), row 0 = C.

Units: normalized energy. Rows: 12. Function: afx_audio.extractors.cepstral_features.extract_chroma_stft.

Torch: afx_audio.torch.functional.chroma_stft, equal to NumPy within rtol 1e-09, atol 1e-12 (float64).

Parameters: frame_size=2048, hop_length=512, center=True, tuning=0.0, normalize=True.

chroma_cqt

Chromagram from the STFT-based CQT approximation, shape (12, n_frames).

Units: normalized magnitude. Rows: 12. Function: afx_audio.extractors.cepstral_features.extract_chroma_cqt.

Torch: none.

Parameters: frame_size=2048, hop_length=512, n_bins=84, bins_per_octave=12, fmin=32.70319566257483, center=True.

cqt

Constant-Q magnitude approximated from the STFT, shape (n_bins, n_frames).

Units: magnitude. Rows: n_bins. Function: afx_audio.extractors.cepstral_features.extract_cqt.

Torch: none.

Parameters: hop_length=512, n_bins=84, bins_per_octave=12, fmin=None, frame_size=2048, center=True, n_fft=None.

melspectrogram

Mel power spectrogram, shape (n_mels, n_frames).

Units: power. Rows: n_mels. Function: afx_audio.extractors.cepstral_features.extract_melspectrogram.

Torch: afx_audio.torch.functional.melspectrogram, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: n_mels=128, frame_size=2048, hop_length=512, fmin=0.0, fmax=None, center=True.

tonnetz

Tonal centroid features (Harte, Sandler and Gasser, 2006), shape (6, n_frames).

Units: dimensionless. Rows: 6. Function: afx_audio.extractors.cepstral_features.extract_tonnetz.

Torch: none.

Parameters: frame_size=2048, hop_length=512, center=True, tuning=0.0.

onset_strength

Spectral-flux onset strength, shape (n_frames,), as librosa.onset.onset_strength.

Units: dB. Rows: 1. Function: afx_audio.extractors.cepstral_features.extract_onset_strength.

Torch: none.

Parameters: frame_size=2048, hop_length=512, n_mels=128, fmin=0.0, fmax=None, lag=1, max_size=1.

Cepstral

mfcc

Mel-frequency cepstral coefficients, shape (n_mfcc, n_frames).

Units: dB (DCT of log-mel). Rows: n_mfcc. Function: afx_audio.extractors.cepstral_features.extract_mfcc.

Torch: afx_audio.torch.functional.mfcc, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: n_mfcc=13, frame_size=2048, hop_length=512, n_mels=128, fmin=0.0, fmax=None, center=True, top_db=80.0.

mfcc_delta

MFCC deltas, shape (n_mfcc, n_frames), key 'mfcc_delta'.

Units: dB per frame. Rows: n_mfcc. Function: afx_audio.extractors.cepstral_features.extract_mfcc_delta.

Torch: afx_audio.torch.functional.mfcc, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: n_mfcc=13, frame_size=2048, hop_length=512, n_mels=128, fmin=0.0, fmax=None, center=True, width=9, order=1.

mfcc_delta_delta

Second-order MFCC deltas (acceleration), see extract_mfcc_delta.

Units: dB per frame^2. Rows: n_mfcc. Function: afx_audio.extractors.cepstral_features.extract_mfcc_delta_delta.

Torch: afx_audio.torch.functional.mfcc, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: n_mfcc=13, frame_size=2048, hop_length=512, n_mels=128, fmin=0.0, fmax=None, center=True, width=9.

gfcc

Gammatone frequency cepstral coefficients, shape (n_gfcc, n_frames).

Units: dB (DCT of log-gammatone). Rows: n_gfcc. Function: afx_audio.extractors.cepstral_features.extract_gfcc.

Torch: afx_audio.torch.functional.gfcc, equal to NumPy within rtol 1e-09, atol 1e-09 (float64).

Parameters: n_gfcc=13, frame_size=2048, hop_length=512, n_gammatone=64, fmin=50.0, fmax=None, center=True.

Harmonic

pitch

Fundamental frequency in Hz per frame by YIN, NaN for unvoiced frames.

Units: Hz (NaN = unvoiced). Rows: 1. Function: afx_audio.extractors.harmonic_features.extract_pitch.

NaN for: unvoiced frames (no YIN dip below threshold and minimum not below 0.5) and f0 outside [fmin, fmax].

Torch: none.

Parameters: frame_size=2048, hop_length=512, center=True, fmin=50.0, fmax=2000.0, threshold=0.1.

thd

Total harmonic distortion sqrt(sum_h A_h^2) / A_1, as a ratio.

Units: ratio. Rows: 1. Function: afx_audio.extractors.harmonic_features.extract_thd.

NaN for: zero-energy frame or fewer than 2 FFT bins.

Torch: none.

Parameters: frame_size=None, hop_length=None, center=True, n_harmonics=4.

hnr

Harmonics-to-noise ratio in dB per frame, 10 log10(r / (1 - r)).

Units: dB. Rows: 1. Function: afx_audio.extractors.harmonic_features.extract_hnr.

NaN for: zero-energy frame; every frame when sr / fmax >= min(sr / fmin, frame_size // 2).

Torch: none.

Parameters: frame_size=2048, hop_length=512, center=True, fmin=50.0, fmax=2000.0.

Linear prediction

lpc

Linear prediction coefficients a_1..a_p per frame, shape (order, n_frames).

Units: dimensionless. Rows: order. Function: afx_audio.extractors.linear_prediction.extract_lpc.

NaN for: frame not longer than order.

Torch: none.

Parameters: order=12, frame_size=None, hop_length=None, center=True, window='hamming', pre_emphasis=0.0.

formants

Formant frequencies F1..Fn in Hz per frame from LPC roots, shape (n_formants, n_frames).

Units: Hz. Rows: n_formants. Function: afx_audio.extractors.linear_prediction.extract_formants.

NaN for: fewer than n_formants LPC resonances above fmin and narrower than max_bandwidth (silence, noise, unvoiced sounds), or frame not longer than order.

Torch: none.

Parameters: n_formants=3, frame_size=512, hop_length=128, center=True, order=None, pre_emphasis=0.97, fmin=90.0, max_bandwidth=400.0.

Parameter set

egemaps_lld

The 25 eGeMAPS v02 low-level descriptors per 10 ms frame, shape (25, n_frames).

Units: per row, see EGEMAPS_LLD_NAMES. Rows: 25. Function: afx_audio.extractors.egemaps.extract_egemaps_lld.

NaN for: voice-dependent rows (F0, jitter, shimmer, HNR, formants, H1-H2, H1-A3) on unvoiced frames.

Torch: none.

Parameters: none.

egemaps

The 88 eGeMAPS v02 functionals of the whole clip, shape (88, 1).

Units: per row, see EGEMAPS_NAMES. Rows: 88. Function: afx_audio.extractors.egemaps.extract_egemaps.

NaN for: statistics over voiced or unvoiced segments when the clip has none.

Torch: none.

Parameters: none.