Could I please ask a few questions about fft?
#1. when i draw the spectrum with this in draw()
plot(fft.getBins(), 128);
and in plot()
for (int i=0; i <n; i++) {
ofVertex (i, buffer[i]);
this is drawing all the frequency data as it is coming in, right?
and if I do like this and change the variable n to a # (like 200)
for (int i=0; i <200; i++) {
ofVertex (i, buffer[i]);
that is going to draw the frequency data coming in from a portion of the bins, in this case 0-200, right?
#2 If I want to get the amplitude of a bin, and save that number as a variable to use in drawing a shape I can do like this:
for (int i = 0; i<200; i++) {
float a =fft.fft->getAmplitudeAtBin(buffer[i]);}
and then ‘a’ will give me some number that is the amplitude of bin 0-200, right?
Because i tried that but when i try to draw a shape, using ‘a’ as a point on a vertex, it seems like ‘a’ is always 0. is that what is happening? I guess I’m not sure about if I do something like this what range of number can I expect to be in a?
#3 what do you recommend for other ways to get a series of variables that come from the sound input that i can then use to draw shapes?
ideally i want to have a series of floats (a,b,c) that I can fill with numbers from the sound input and fft and then i can use those to create shapes that will move (as the sound input changes)
I saw in a post that I can also use getBinFromFrequency and GetAmplitudeAtFrequency, do you think those would be helpful for my purpose? If so, I would need a little help to figure out how to syntax it correctly and figure out what kind of range of number to expect.
thank you very much