librosax.layers.Spectrogram

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

A module that computes a spectrogram from a waveform using JAX.

This module transforms audio time-domain signals into time-frequency representation.

Variables:
  • n_fft – FFT size. Default is 2048.

  • hop_length – Step between successive frames. Default is n_fft // 4.

  • win_length – Window size. Default is n_fft.

  • window – Window function type. Default is "hann".

  • center – If True, the waveform is padded so that frames are centered. Default is True.

  • pad_mode – Padding mode for the waveform. Default is "reflect".

  • power – Exponent for the magnitude (2.0 means power spectrogram). Default is 2.0.

  • freeze_parameters – If True, parameters are not updated during training. Default is True.

__init__(n_fft: int = 2048, hop_length: int = None, win_length: int = None, window: str = 'hann', center: bool = True, pad_mode: str = 'reflect', power: float = 2.0, freeze_parameters: bool = True)[source]

Methods

__init__([n_fft, hop_length, win_length, ...])

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.