chuck icon indicating copy to clipboard operation
chuck copied to clipboard

incorrect/missing FFT behavior and documentation

Open gewang opened this issue 8 months ago • 0 comments

from discord (c/o rwixen) "The FFT unit analyzer appears to round up the FFT size to the next power of two. It would be nice if the documentation reflected this. It would also be nice if the documentation said that the output is half the size of the FFT, containing only the frequencies below the Nyquist frequency."

"The FFT unit analyzer's .cvals() array is always size 8 when I use the transform(float[] from), regardless of the FFT size. When I instead use upchuck(), the size of the .cvals() array is appropriately half of the (power-of-two) FFT size."

"The FFT unit analyzer seems to be giving an incorrect output for an impulse input, for which the expected output should be constant. Instead, the output has a larger value for DC than for other frequencies. The attached file surfaces the issue."

Impulse impulse => FFT fft => blackhole;
impulse => Flip flip => blackhole;

8 => int N;
N => fft.size;
N => flip.size;

impulse.next(1);
N::samp => now;
fft.upchuck();
flip.upchuck();

<<<"x[n]">>>;
for (0 => int i; i < N; 1 +=> i) {
    <<<i, flip.fval(i)>>>;
}

<<<"X[n]">>>;
for (0 => int i; i < N / 2; 1 +=> i) {
    <<<i, fft.fval(i)>>>;
}

gewang avatar Oct 18 '23 01:10 gewang