librosax.layers.MFCC

class MFCC(*args: Any, **kwargs: Any)[source]

A module that computes Mel-Frequency Cepstral Coefficients (MFCCs).

This module extends LogMelFilterBank to compute MFCCs by applying a Discrete Cosine Transform (DCT) to the log-mel spectrogram.

Variables:
  • n_mfcc – Number of MFCCs to return. Default is 20.

  • dct_type – Type of DCT (1-4). Default is 2.

  • norm – Normalization mode for DCT. Default is “ortho”.

  • lifter – Liftering coefficient. 0 means no liftering. Default is 0.

  • is_log – If True, convert to log scale (must be True for MFCCs). Default is True.

  • LogMelFilterBank. (Inherits all attributes from)

__init__(sr: int = 22050, n_fft: int = 2048, n_mels: int = 64, fmin: float = 0.0, fmax: float = None, ref: float = 1.0, amin: float = 1e-10, top_db: float | None = 80.0, freeze_parameters: bool = True, n_mfcc: int = 20, dct_type: int = 2, norm: str = 'ortho', lifter: int = 0)[source]

Methods

__init__([sr, n_fft, n_mels, fmin, fmax, ...])

eval(**attributes)

Sets the Module to evaluation mode.

iter_children()

Iterates over all children Module's of the current Module.

iter_modules()

Recursively iterates over all nested Module's of the current Module, including the current Module.

perturb(name, value[, variable_type])

Add an zero-value variable ("perturbation") to the intermediate value.

set_attributes(*filters[, raise_if_not_found])

Sets the attributes of nested Modules including the current Module.

sow(variable_type, name, value[, reduce_fn, ...])

sow() can be used to collect intermediate values without the overhead of explicitly passing a container through each Module call.

train(**attributes)

Sets the Module to training mode.