# Nyquist FFT Tutorial Help

I’m following the Nyquist FFT Tutorial. But I’m getting a slightly different result than expected. The output from `(fft-test)` should have -1 in the 9th array element, but I’m getting -16:

``````    > (fft-test)
fft-test : (SEND FFT-ITER :NEXT) = #(3.28013e-15 2.79029e-15 1.15578e-15 2.79029e 15 2.79029e-15 2.79029e-15 6.73636e-15 1.68587e-07 -16 2.79029e-15 -6.73636e-15 2.79029e-15 -2.79029e-15 2.79029e-15 -1.15578e-15 3.28013e-15 -0 2.79029e-15 1.15578e-15 2.79029e-15 2.79029e-15 2.79029e-15 6.73636e-15 -1.68587e-07 3.4366e-07 2.79029e-15 -6.73636e-15 2.79029e-15 -2.79029e-15 2.79029e-15 -1.15578e-15 3.28013e-15)
``````

I copied and pasted the code from the tutorial, so I doubt there’s a mistake on my part. Is -16 the correct result?

Also, the tutorial describes the FFT array as:

• the DC component goes in array element 0
• the Cosine part is in elements 2i - 1
• the Sine part is in elements 2i
• the Nyquist frequency component is in the last element

I’m not clear what the meaning of “cosine part” and “sine part” are. The array as shown above doesn’t seem like it could be the coefficients for

`````` SUM(Asin(2πnt) + Bcos(2πnt))
``````

where n is the frequency. Can anyone please clarify this for me?

It looks like Nyquist has been updated since that tutorial was written.
Testing in Audacity 1.3.14 I get the same result as you ( 9th element -16, all other elements close to zero).
Testing in Audacity 1.3.4 I get the same result as the tutorial (9th element -1, all other elements zero or close to zero).

I’ve also tested with the standalone version of Nyquist 3.05 and I get the same result as in Audacity 1.3.14.

Sorry, I can’t help with the FFT theory stuff, I don’t understand it.

The Audacity Nyquist FFT functions seem to be seriously broken, with Audacity_2.0.1 on 64-bit Debian Linux I get complete nonsensical values:

``````fft-test : (SEND FFT-ITER :NEXT) = #(4.58592e-37 -1.77112e-37 6.30807e-35 -3.20121e-37 -1.17014e-34 4.19982e-37 1.53482e-34 1.30349e-41 -1.66395e-34 -4.19788e-37 1.53482e-34 3.20127e-37 -1.17014e-34 1.77112e-37 6.30807e-35 -4.58638e-37 1.80123e-41 1.77089e-37 -6.30807e-35 3.20173e-37 1.17014e-34 -4.19984e-37 -1.53482e-34 -1.30349e-41 1.66394e-34 4.1979e-37 -1.53482e-34 -3.20179e-37 1.17014e-34 -1.77089e-37 -6.30807e-35 4.58684e-37)
``````

I can’t even test with CMU Nyquist, because Nyquist 3.05 refuses to compile on 64-bit machines.

• edgar

How about the Debian repository version? Does that work on your 64-bit machine?

The “newest” 64-bit Debian Nyquist version is Nyquist 2.29 from January 2003, more than 9 years old.

Few minutes later - Nyquist 2.29 also produces nonsense on a 64-bit machine:

``````fft-test : (SEND FFT-ITER :NEXT) = #(0 0 -0 0 -0 0 -0 0 -0 0 -0 0 -0 0 -0 0 -0 0 -0 0 -0 0 -0 0 -0 0 -0 0 -0 0 -0 0)
``````
• edgar

Sounds like bug 336:
http://bugzilla.audacityteam.org/show_bug.cgi?id=336

I’ve been going through parts of the FFT tutorial (on a 32-bit machine) and although I get different results in some cases to those stated in the tutorial (specifically the original question in this thread) it does appear to all work.

Yes, Nyquist is not 64-bit compatible, where the major problem is that the XLISP garbage collector is hard-coded to 32-bit memory pointers. I’m wondering all the time why Audacity Nyquist plugins do not produce serial crashes on 64-bit computers.

But I have still not seriously tested Nyquist in Audacity for memory leaks to tell the truth…

• edgar