auroranockert / fft.js

Discrete Fourier Transform in Javascript, it is intended to be reasonably fast.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FFT for N > 4 seems to be incorrect

jussi-kalliokoski opened this issue · comments

For this test file:

var FFT = require('fft')

var l = 1 << 5

var input  = new Float32Array(l)
var output = new Float32Array(l + 2)
var fft    = new FFT.RFFT(l)

input[0] = 1;
fft.process(output, input)

console.error([].join.call(output))

Results are:

0.1767766922712326,0,0.14295193552970886,0.00672816252335906,0.1142766922712326,0.02588834799826145,0.0951165109872818,0.05456359311938286,0.0883883461356163,0.0883883461356163,0.0951165109872818,0.12221310287714005,0.1142766922712326,0.1508883535861969,0.14295193552970886,0.1700485348701477,0.1767766922712326,0,0.21060144901275635,-0.00672816252335906,0.2392766922712326,-0.02588834799826145,0.2584368884563446,-0.05456359311938286,0.2651650309562683,-0.0883883461356163,0.2584368884563446,-0.12221310287714005,0.2392766922712326,-0.1508883535861969,0.21060144901275635,-0.1700485348701477,0.1767766922712326,0

While I think they should be uniformly 0.17677669529663687,0.

The normal FFT reports correct results.

I'll close this as a duplicate, since there is new syntax and new bugs now.