Hello everyone,
I'm trying to plot amplitude and phase outputs from an fft~. So I convert rectangular coordinates to polar, and tabwrite~ them, resetting the phase of the incoming oscillator with every bang sent to the tabwrites.
I've done it using cartopol~ from cyclone, and also making the explicit calculations with the squaring and sqrt~ for amplitude, and atan~ for phase. No problem so far, both work and I have what I expected...
...EXCEPT when the frequency of the sinewave I send into the fft~ is exactly a multiple of <samplerate/fftSize>. When I do that, I have exactly one bin with non-zero amplitude (as expected), but the phase is all over the place, and dramatically so for low frequencies. It's only well-behaved at 0, Nyquist and Nyquist/2.
Extra unexpected behavior: moving the frequency just a bit from one of these "fft-harmonics" brings the phase-table back to a nice curve.
Is this expected behavior? If so, can anyone explain; if not, can anyone tell me what I'm doing wrong? I really expected all phases to be zero (or in a single-discontinuity curve) when analysing a multiple of the "fft-fundamental".
I've enclosed a patch with all that. Blocksize here is 128, but I've tried with different sizes getting similar results.
(forgive my lengthiness, it's my first post)