Fft.js
Discrete Fourier Transform in Javascript, it is intended to be reasonably fast.
Install / Use
/learn @auroranockert/Fft.jsREADME
fft.js
FFT in JavaScript, it works, I think.
No promises, but I tested it against Wolfram Alpha once, and it was reasonably accurate.
There are optimized kernels for prime factors, 2, 3, 4, so if you want high performance, use lengths that are a factor of those.
Notice that the DFT is not normalized, so ifft(fft(x)) / n ~= x
Usage
/* Create a new FFT object */
var fft = new FFT.complex(n, inverse)
/* Output and input should be float arrays (of the right length), type is either 'complex' (default) or 'real' */
fft.process(output, outputOffset, outputStride, input, inputOffset, inputStride, type)
/* Or the simplified interface, which just sets the offsets to 0, and the strides to 1 */
fft.simple(output, input, type)
Installing via npm
You can also install via npm, the name is fft in the registy.
Credits
I was too lazy to calculate the butterflies myself, so they are inspired by kissfft, which is a small library for doing discrete fourier transforms.
Related Skills
node-connect
333.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
333.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.0kCommit, push, and open a PR
