Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: AudioAnalyzeFFT1024 two instances doesn't work

  1. #1
    Junior Member
    Join Date
    Jan 2020
    Posts
    10

    AudioAnalyzeFFT1024 two instances doesn't work

    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");  
       }
    }

  2. #2
    Senior Member
    Join Date
    Feb 2017
    Posts
    399
    Maybe reserve more AudioMemory?

  3. #3
    Junior Member
    Join Date
    Jan 2020
    Posts
    10
    Thanks, AudioMemory(16); did it.

  4. #4
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,317
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •