UNPKG

frost-fft

Version:

Fast Fourier Transform (FFT) implementation in TypeScript using the Cooley–Tukey algorithm for power-of-2 input lengths

41 lines (29 loc) 1.12 kB
# frost-fft The world didn't need yet another Fast Fourier Transform (FFT) implementation, but here we are... ```typescript import {fft, ifft, ifftReal} from 'frost-fft'; const signal = new Float64Array(256).map(Math.random); // The imaginary argument is optional, zeros assumed by default (faster). const [realCoefs, imagCoefs] = fft( signal, signal.map(() => 0) ); // There's no normalization. These are 256 times too large. const [realSignalScaled, imagSignalScaled] = ifft(realCoefs, imagCoefs); // The original signal reconstructed (with some floating point noise). const realSignal = ifftReal(realCoefs, imagCoefs).map(s => s / 256); ``` ## Supported imports Use only the package root import: ```typescript import {fft, ifft, ifftReal} from 'frost-fft'; ``` Public export path(s): - `frost-fft` Do not import from internal build paths such as `frost-fft/dist/*`; those are not part of the public API contract and may change. ## Documentation ## Documentation is hosted at the project [Github pages](https://frostburn.github.io/frost-fft). To generate documentation locally run: ```bash npm run doc ```