Compute a 1024 point Fast Fourier Transform (FFT) frequency analysis, with real value (magnitude) output. The frequency resolution is 43 Hz, useful detailed for 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 511. 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);
This function does nothing. The 1024 point FFT always updates at approximately 86 times per second.
windowFunction(window);
Set the window function to be used. AudioWindowHanning1024 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 > Analysis > FFT
File > Examples > Audio > Analysis > SpectrumAnalyzerBasic
The raw 16 bit output data bins may be access with myFFT.output[num], where num is 0 to 511.
TODO: caveats about spectral leakage vs frequency precision for arbitrary signals
Window Types:
1024 point FFT has a peak CPU usage of approx 52% on Teensy 3.1. Average usage is much lower. Future versions might distribute the load more evenly over time....