## Nyquist FFT Tutorial Help

Using Nyquist scripts in Audacity.

If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like

### 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:

Code: Select all
`    > (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
Code: Select all
` SUM(Asin(2πnt) + Bcos(2πnt))`
where n is the frequency. Can anyone please clarify this for me?

MarkLorenz

Posts: 1
Joined: Fri Feb 10, 2012 1:18 pm

### Re: Nyquist FFT Tutorial Help

MarkLorenz wrote: Is -16 the correct result?

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.
steve

Posts: 46549
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

### Re: Nyquist FFT Tutorial Help

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:

Code: Select all
`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
edgar-rft

Posts: 347
Joined: Sun Jan 20, 2008 12:03 am

### Re: Nyquist FFT Tutorial Help

edgar-rft wrote:I can't even test with CMU Nyquist, because Nyquist 3.05 refuses to compile on 64-bit machines

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

Posts: 46549
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

### Re: Nyquist FFT Tutorial Help

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

Posts: 347
Joined: Sun Jan 20, 2008 12:03 am

### Re: Nyquist FFT Tutorial Help

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

Code: Select all
`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
edgar-rft

Posts: 347
Joined: Sun Jan 20, 2008 12:03 am

### Re: Nyquist FFT Tutorial Help

edgar-rft wrote: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:

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.
steve

Posts: 46549
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

### Re: Nyquist FFT Tutorial Help

steve wrote:Sounds like bug 336...

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
edgar-rft

Posts: 347
Joined: Sun Jan 20, 2008 12:03 am

### Who is online

Users browsing this forum: No registered users and 1 guest