annotate fft/fft.js/README.md @ 40:223f770b5341 kissfft-double tip

Try a double-precision kissfft
author Chris Cannam
date Wed, 07 Sep 2016 10:40:32 +0100
parents 66f9fd5ac611
children
rev   line source
Chris@25 1 fft.js
Chris@25 2 ================================================================================
Chris@25 3
Chris@25 4 FFT in JavaScript, it works, I think.
Chris@25 5
Chris@25 6 No promises, but I tested it against Wolfram Alpha once, and it was reasonably accurate.
Chris@25 7
Chris@25 8 There are optimized kernels for prime factors, 2, 3, 4, so if you want high performance, use lengths that are a factor of those.
Chris@25 9
Chris@25 10 Notice that the DFT is not normalized, so `ifft(fft(x)) / n ~= x`
Chris@25 11
Chris@25 12
Chris@25 13 Usage
Chris@25 14 ---------------------------------------------------------------------------------
Chris@25 15
Chris@25 16 ```javascript
Chris@25 17
Chris@25 18 /* Create a new FFT object */
Chris@25 19
Chris@25 20 var fft = new FFT.complex(n, inverse)
Chris@25 21
Chris@25 22 /* Output and input should be float arrays (of the right length), type is either 'complex' (default) or 'real' */
Chris@25 23 fft.process(output, outputOffset, outputStride, input, inputOffset, inputStride, type)
Chris@25 24
Chris@25 25 /* Or the simplified interface, which just sets the offsets to 0, and the strides to 1 */
Chris@25 26 fft.simple(output, input, type)
Chris@25 27
Chris@25 28 ```
Chris@25 29
Chris@25 30
Chris@25 31 Installing via npm
Chris@25 32 ---------------------------------------------------------------------------------
Chris@25 33
Chris@25 34 You can also install via npm, the name is `fft` in the registy.
Chris@25 35
Chris@25 36
Chris@25 37 Credits
Chris@25 38 ---------------------------------------------------------------------------------
Chris@25 39
Chris@25 40 I was too lazy to calculate the butterflies myself, so they are inspired by [kissfft](http://sourceforge.net/projects/kissfft/), which is a small library for doing discrete fourier transforms.
Chris@25 41