mlx.core.fft.stft

目录

mlx.core.fft.stft#

stft(x: array, n_fft: int = 2048, hop_length: int | None = None, win_length: int | None = None, window: array | None = None, center: bool = True, pad_mode: str = 'reflect', norm: str = 'backward', onesided: bool | None = None, stream: Stream | ThreadLocalStream | Device | mlx.core.DeviceType | None = None) → array#

Short-Time Fourier Transform.

Splits the last axis of x into overlapping frames of length n_fft, applies window, and takes the Fourier Transform of each frame. The output is always complex with shape (..., n_freq, n_frames).

参数:
  • x (array) -- The input array.

  • n_fft (int, optional) -- Size of the Fourier Transform. Default is 2048.

  • hop_length (int, optional) -- Samples between frames. Default is n_fft // 4.

  • win_length (int, optional) -- Window size. Default is n_fft.

  • window (array, optional) -- A one-dimensional window, centered and zero-padded to n_fft. Default is a rectangular window.

  • center (bool, optional) -- Pad both ends so frames are centered. Default is True.

  • pad_mode (str, optional) -- One of "reflect", "constant", or "edge", used when center is True. Default is "reflect".

  • norm (str, optional) -- One of "backward", "ortho", or "forward". Default is "backward".

  • onesided (bool, optional) -- Return only non-negative frequencies. Default is True for real input and False for complex input.

返回:

The STFT of x.

返回类型:

array