Skip to main content

Module stft

Module stft 

Source
Expand description

The short-time Fourier transform, its inverse and the spectrogram.

See the book entry Power spectra: periodogram, Welch, spectrogram and Lomb-Scargle.

Structs§

Spectrogram
A spectrogram: per-frame one-sided power with Welch’s scaling, and the frame times and bin frequencies.

Functions§

istft
Inverts stft by weighted overlap-add, x[n] = Σ_t w[n − t·hop] y_t[n − t·hop] / Σ_t w², the least-squares signal for possibly modified frames (Griffin and Lim). Exact for an unmodified STFT wherever Σ w² > 0; samples not covered by any frame are zero.
spectrogram
The spectrogram |STFT|² of x sampled at fs, scaled as a density or spectrum like super::welch::welch (each row is a single-segment periodogram).
stft
The one-sided STFT of a real signal: row t holds the spectrum (window.len()/2 + 1 bins) of the frame starting at sample t · hop, windowed by window. Frames run while they fit entirely inside the signal (pad the signal first to cover its edges).