James Harkins
2014-09-29 05:45:29 UTC
Partly for my own understanding, and partly to be able to explain digital audio theory more comprehensively to students, I'm trying to understand what we actually get back from FFT. (Bear with me -- I'm writing this on my phone, so I can't post complete code bits just now.)
I've gotten as far as: 'fft' on a Signal returns a Complex whose real and imaginary parts are Signals. The real values are, essentially, x coordinates and the imaginary values are y coordinates. Converting these x,y pairs into polar coordinates gives the magnitudes (rho) and phases (theta).
a = aSignal.fft(.....);
m = a.rho;
p = a.theta;
So then I tried by brute force to calculate sine waves for each element, where m[0] is the DC component, m[1] corresponds to 1 sine cycle within the window, m[2] to 2 cycles in the window and so on, scaling and offsetting each component according to mag and phase. Well, the sum of those waves was a complete hash -- garbage.
So I conclude that I've misunderstood something somewhere (though it seems, at least naively, that I'm following the formal definitions). What have I got wrong?
Thanks,
hjh
I've gotten as far as: 'fft' on a Signal returns a Complex whose real and imaginary parts are Signals. The real values are, essentially, x coordinates and the imaginary values are y coordinates. Converting these x,y pairs into polar coordinates gives the magnitudes (rho) and phases (theta).
a = aSignal.fft(.....);
m = a.rho;
p = a.theta;
So then I tried by brute force to calculate sine waves for each element, where m[0] is the DC component, m[1] corresponds to 1 sine cycle within the window, m[2] to 2 cycles in the window and so on, scaling and offsetting each component according to mag and phase. Well, the sum of those waves was a complete hash -- garbage.
So I conclude that I've misunderstood something somewhere (though it seems, at least naively, that I'm following the formal definitions). What have I got wrong?
Thanks,
hjh