pub fn stft(
y: &[f32],
n_fft: Option<usize>,
hop_length: Option<usize>,
win_length: Option<usize>,
) -> Result<Array2<Complex<f32>>, AudioError>Expand description
Computes the Short-Time Fourier Transform (STFT) of a signal.
§Arguments
y- Input signal as a slice off32n_fft- Optional FFT window size (defaults to 2048)hop_length- Optional hop length in samples (defaults to n_fft/4, minimum 1)win_length- Optional window length in samples (defaults to n_fft)
§Returns
Returns a Result containing an Array2<Complex<f32>> representing the STFT spectrogram,
with shape (n_fft/2 + 1, n_frames), or an AudioError if array shaping fails.
§Examples
let signal = vec![1.0, 2.0, 3.0, 4.0];
let spectrogram = stft(&signal, None, None, None).unwrap();