librosax.stft

stft(waveform: Array, n_fft: int, hop_length: int = None, win_length: int = None, window: str = 'hann', center: bool = True, pad_mode: str = 'constant')[source]

Compute the Short-Time Fourier Transform (STFT) of a waveform.

This function computes the STFT of the given waveform using JAX’s scipy.signal.stft implementation.

Note

For JAX JIT compilation, the following arguments should be marked as static: n_fft, hop_length, win_length, window, center, pad_mode

Parameters:
  • waveform – Input signal waveform.

  • n_fft – FFT size.

  • hop_length – Number of samples between successive frames. Default is win_length // 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. Must be one of ["constant", "reflect"]. Default is "constant".

Returns:

Complex STFT matrix.

Return type:

jnp.ndarray

Raises:

AssertionError – If pad_mode is not one of ["constant", "reflect"].