Skip to main content

Module stft

Module stft 

Source
Expand description

Real forward STFT over actual audio samples — Hann-windowed framing through the forge FFT (crate::wgsl_forge::dispatch::fft_f32, GPU best-path with CPU DFT floor).

This is the genuine forward transform that the cold-path sidecar bake consumes: bake_stft_sidecar_from_samples reduces the real magnitude spectrum to SPECTRAL_PREVIEW_BINS and writes it through the same header machinery as the preview-synthesis bake in crate::audio::stft_bake — so the sidecar derives from real audio, not from a parametric preview.

Heap allocation is fine here: STFT runs at ingest (cold path), never in the zero-heap U3 hot worklet.

Functions§

bake_stft_sidecar_from_samples
Bake an STFT sidecar from REAL audio samples.
forward_stft
Real forward STFT over samples.
stft_magnitudes
Per-frame one-sided magnitude spectrum: the first frame_size/2 + 1 bins (DC … Nyquist) of |X[k]| = sqrt(re² + im²).