fourier-transform/stftsubpath export — STFT and inverse STFT.stft(signal, opts)— analysis-only STFT returning frames withre,im,mag,phase,time.istft(frames, opts)— synthesis from STFT frames.stftBatch(data, process, opts)— batch STFT with per-frame processing callback and overlap-add synthesis.stftStream(process, opts)— streaming STFT with processing callback.stftAnalysisStream(opts)— streaming analysis-only STFT.- Zero-padded boundaries for perfect reconstruction.
- Hann window with per-size cache.
- Compatible with
pitch-shift,time-stretch, andpitch-detectionpatterns.
cifft(re, im)— in-place complex inverse FFT (1/N normalized).
- ESM only. Use
import rfft from 'fourier-transform'instead ofrequire(). - Returns
Float64Arrayinstead ofArray. - Returns internal buffer by default — overwritten on next call with same N. Pass an output buffer to keep results:
rfft(input, output). - Fixed off-by-one in magnitude spectrum. Imaginary components were indexed as
x[N-k-1]instead ofx[N-k], shifting bins with imaginary content by one. Results are now correct. - Rejects N < 2 (previously N=1 returned empty array silently).
- Removed
asm.jsentry point.
fft()named export — returns complex DFT as[re, im], N/2+1 bins, unnormalized.ifft(re, im)— inverse offft(), native split-radix DIF inverse (~1.8x faster than complex IFFT approach).cfft(re, im)/cifft(re, im)— in-place complex FFT and inverse FFT (radix-2 Cooley-Tukey).- Optional output buffer parameter for both
rfft()andfft().
- Float64Array working buffers instead of generic Array.
- Precomputed twiddle factors and bit-reversal table, cached per size.
- Zero-copy real part in
fft()via subarray view. - ~2.7x faster than dsp.js (the original split-radix ancestor).
- On par with fft.js (indutny) in raw transform speed.
asm.js— no modern engine validates'use asm'anymore.- All runtime dependencies (zero deps).