FFT frequencies

Hello,
I use the stock libraries.
I am working on a visualizer and I have 2 questions:

  1. What is the frequency distribution of the FFT.
    If I set it to 512 bands, what frequencies it returns values for?
  2. How do I use the Movie library to render the video If I have individual PImages?

hi, i can not answer about the mentioned “stock library”
as i never used it, is it good? where you get it from ?

but about FFT
let us just assume you would have imported / use the

http://code.compartmental.net/minim/

sound library,
then there are examples to find like

processing IDE 3.4 / File /Examples /
Contributes Libraries / Minim / Basics /
AnalyzeSound

using that example you could make following changes ( to understand )

in

setup () {
//.. add
  println("jingle.bufferSize() "+jingle.bufferSize());
  println("jingle.sampleRate() "+jingle.sampleRate());
  println("fft.specSize()"+fft.specSize());
}

you could even in the play loop add

//...
  for(int i = 0; i < fft.specSize(); i++)
  {
    // draw the line for frequency band i, scaling it up a bit so we can see it
    line( i, height, i, height - fft.getBand(i)*8 );
    print(" i: "+i+" "+fft.getBand(i));
  }
  println("\nnext");
}

ok, when you talk about

512 bands

i think you mean samples ( for the FFT input buffer ) to analyze
see also: song.bufferSize()

so with 512 samples
you would get back a array
fft with 256 +1 “bands”
where [0] is not a frequency, more a average offset
and [1] a sinus what fits inside the 512 samples
and the value is the amplitude of it.
insofar the real frequency is not known, as the samples might be 512 measurements over a month of moonshine intensity…
only the

song.sampleRate()

brings it in relation to the real world.

now what can be in [2]?
amplitude of 2 sinus in the 512 samples…

1 Like