Compute a 256 point Fast Fourier Transform (FFT) frequency analysis, with real value (magnitude) output. The frequency resolution is 172 Hz, useful for simple audio visualization.
Port | Purpose |
---|---|
In 0 | Signal to convert to frequency bins |
available();
Returns true each time the FFT analysis produces new output data.
read(binNumber);
Read a single frequency bin, from 0 to 127. The result is scaled so 1.0 represents a full scale sine wave.
read(firstBin, lastBin);
Read several frequency bins, returning their sum. The higher audio octaves are represented by many bins, which are typically read as a group for audio visualization.
averageTogether(number);
New data is produced very radidly, approximately 344 times per second. Multiple outputs can be averaged together, so available() returns true at a slower rate.
windowFunction(window);
Set the window function to be used. AudioWindowHanning256 is the default. Windowing may be disabled by NULL, but windowing should be used for all non-periodic (music) signals, and all periodic signals that are not exact integer division of the sample rate.
File > Examples > Audio > MemoryAndCpuUsage
The raw 16 bit output data bins may be access with myFFT.output[num], where num is 0 to 127.
TODO: caveats about spectral leakage vs frequency precision for arbitrary signals
Window Types: