/* This example shows how to use the FFT library with a circuit playground express. * * The LEDs will map around the circle when frequencies between FREQ_MIN and FREQ_MAX are detected */ #include #include "Adafruit_ZeroFFT.h" //this must be a power of 2 #define DATA_SIZE 256 #define NUM_PIXELS 12 //the sample rate #define FS 22000 //the lowest frequency that will register on the meter #define FREQ_MIN 600 //the highest frequency that will register on the meter #define FREQ_MAX 3000 #define MIN_INDEX FFT_INDEX(FREQ_MIN, FS, DATA_SIZE) #define MAX_INDEX FFT_INDEX(FREQ_MAX, FS, DATA_SIZE) #define SCALE_FACTOR 32 int16_t pixelData[NUM_PIXELS]; int16_t inputData[DATA_SIZE]; // the setup routine runs once when you press reset: void setup() { CircuitPlayground.begin(); } void loop() { CircuitPlayground.mic.capture(inputData, DATA_SIZE); /******************************* * REMOVE DC OFFSET ******************************/ int32_t avg = 0; int16_t *ptr = inputData; for(int i=0; i