Hello,
I'm new to the board and hope to get some help here in the next time. As I'm absolutely new to microcontroller development (but not to software development), I will have some questions. Here is the first today
I'm using Audio Board and do some FFT and display some LED Matrix stuff. I realized, that the FFT only provides data every 23ms. As I like to do some real-time reaction later, this seems very slow. I found some people in other forums telling that FFT with 256 only needs about 6 to 9ms on some 16Mhz device. Sadly I dont find it anymore.
Is there a way to enhance the speed a little? Something around 12ms will be sufficient.
This is my reduced source:
Is there something I can enhance?
Best,
Kukulkan
I'm new to the board and hope to get some help here in the next time. As I'm absolutely new to microcontroller development (but not to software development), I will have some questions. Here is the first today
I'm using Audio Board and do some FFT and display some LED Matrix stuff. I realized, that the FFT only provides data every 23ms. As I like to do some real-time reaction later, this seems very slow. I found some people in other forums telling that FFT with 256 only needs about 6 to 9ms on some 16Mhz device. Sadly I dont find it anymore.
Is there a way to enhance the speed a little? Something around 12ms will be sufficient.
This is my reduced source:
Code:
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
#include <Metro.h>
#include <Audio.h>
#include <SPI.h>
#include <SD.h>
// Initialize related values
const int myInput = AUDIO_INPUT_LINEIN;
// Define objects
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
Metro tMatrix = Metro(60); // speed of scrolling
AudioInputI2S audioInput; // audio shield: mic or line-in
AudioAnalyzeFFT256 myFFT;
AudioOutputI2S audioOutput; // audio shield: headphones & line-out
AudioControlSGTL5000 audioShield;
elapsedMillis sinceTest1;
// Connect the live input
AudioConnection patchCord1(audioInput, 0, myFFT, 0);
// Define constants
// Set global variables
int matrixCounter = 10;
float level[11];
int lastTime = 0;
void setup() {
// *** init serial interface for debug ***
Serial.begin(9600);
// *** Init audio ***
AudioMemory(12);
// Enable the audio shield and set the output volume.
audioShield.enable();
audioShield.inputSelect(myInput);
audioShield.volume(0.5);
audioShield.lineInLevel(5);
// Configure the window algorithm to use
myFFT.windowFunction(AudioWindowWelch256);
// *** init matrix display ***
matrix.begin(0x70); // pass in the address
matrix.setRotation(2);
matrix.clear();
lastTime = sinceTest1;
}
void loop() {
if (myFFT.available()) {
doFFT(); // do FFT
Serial.print(sinceTest1 - lastTime);
Serial.println("ms");
lastTime = sinceTest1;
}
}
void doFFT() {
// each time new FFT data is available
// do some stuff with the FFT data
}
Is there something I can enhance?
Best,
Kukulkan