-
Notifications
You must be signed in to change notification settings - Fork 159
Home
This is the wiki for the Fourier Fast Transform library. It was mainly devised for using it on embedded systems but it can also be used on native desktop applications.
Add #include <arduinoFFT.h>
to the file where it is required. If you are using it with something other that the Arduino or Platformio frameworks, make sure to point the compiler and linker to the library src
folder. If you want to use any of the optimizations, make sure to add #define USE_AVR_PROGMEM
and/or #define FFT_SPEED_OVER_PRECISION
and/or #define FFT_SQRT_APPROXIMATION
before the include statement. See Optimizations for more information.
#include <arduinoFFT.h>
const uint16_t samples = 64; //This value MUST ALWAYS be a power of 2
const float signalFrequency = 1000;
const float samplingFrequency = 5000;
const uint8_t amplitude = 100;
float vReal[samples];
float vImag[samples];
ArduinoFFT<float> FFT = ArduinoFFT<float>(vReal, vImag, samples, samplingFrequency); /* Create FFT object */
void setup(){
// Setup code
}
void loop() {
// Get samples
FFT.windowing(FFTWindow::Hamming, FFTDirection::Forward); /* Weigh data */
FFT.compute(FFTDirection::Forward); /* Compute FFT */
FFT.complexToMagnitude(); /* Compute magnitudes */
float x = FFT.majorPeak();
// Rest of the code
}
See API for a detailed description of all the functions and arguments.
This is work in progress, both the wiki and the code.
The theory doesn't change, Fourier Fast Transform is solid, demonstrated theory; but technology does change and adding support for newer chips while retaining compatibility with old ones is a tricky and time consuming task. Therefore, major changes will be sparse and efforts will concentrate on documentation and bug fixes. Collaborations are welcomed.
The wiki is a recent addition starting from code version 2.0.