AudioAnalyzeFFT1024 two instances doesn't work

Status
Not open for further replies.

McTime

Member
I would like to play with two FFTs, but as soon as I add the second one none of them will work, that is, available() is always false on both.
Any chance to get this working?

Note: Uncomment the commented lines and the problem should be visible.
Code:
#include <Audio.h>
// design with https://www.pjrc.com/teensy/gui/

// GUItool: begin automatically generated code
AudioInputI2S            i2s1;           //xy=160,109
AudioOutputI2S           i2s2;           //xy=482,51
//AudioAnalyzeFFT1024      fft1024a;       //xy=488,165
AudioAnalyzeFFT1024      fft1024b;       //xy=488,205
//AudioConnection          patchCord1(i2s1, 0, fft1024a, 0);
AudioConnection          patchCord2(i2s1, 0, i2s2, 0);
AudioConnection          patchCord3(i2s1, 1, fft1024b, 0);
AudioConnection          patchCord4(i2s1, 1, i2s2, 1);
AudioControlSGTL5000     sgtl5000_1;     //xy=176,209
// GUItool: end automatically generated code

void setup() {
  Serial.begin(9600);
  AudioMemory(12);
  sgtl5000_1.enable();
  sgtl5000_1.inputSelect(AUDIO_INPUT_LINEIN);
  Serial.println("Rdy");  
}

void loop() {
/*   if (fft1024a.available()) {
     Serial.println("A");  
   }*/
   if (fft1024b.available()) {
     Serial.println("B");  
   }
}
 
Each instance of fft1024 requires 8 audio memory blocks to hold the samples for the FFT. Just to be safe, I would allocate a bit more than 8*number_of_FFT1024.
But 16 works. Go for it :)

Pete
 
Status
Not open for further replies.
Back
Top