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

Thread: AudioRecordQueue limited to 53 blocks? Why 53?

  1. #1
    Senior Member
    Join Date
    Oct 2015
    Location
    Vermont, USA
    Posts
    167

    AudioRecordQueue limited to 53 blocks? Why 53?

    Hi,

    Why is the AudioRecordQueue limited to 53 blocks? I understand why one might want to limit the depth of the queue, but why 53?

    If I wanted to, could I change the code to increase it to 100 (for use on a Teensy 3.6, for instance) without unintended issues?

    Thanks,

    Chip

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,222
    Quote Originally Posted by chipaudette View Post
    Hi,

    Why is the AudioRecordQueue limited to 53 blocks? I understand why one might want to limit the depth of the queue, but why 53?

    If I wanted to, could I change the code to increase it to 100 (for use on a Teensy 3.6, for instance) without unintended issues?

    Thanks,

    Chip
    Chip,
    maybe some life-history related number?

    Seriously, AFAIK, there is no reason to limit to 53. In fact I decided to make my own Template based queue and use up to 550 audio blocks on a T3.6 for my recorder.
    I know you can handle this Template implementation but for others: here is a link to a modified record queue, that is named different to avoid interferences with audio library.
    It is used line this:
    Code:
      #include "input_adc.h"
      AudioInputAnalog    acq(ADC_PIN);
      #include "m_queue.h"
      mRecordQueue<int16_t, MQUEU> queue1;
      AudioConnection     patchCord1(acq, queue1);

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    There is indeed an arbitrary limit of 53 within the code, which allows for about 150 ms to be buffered in the queue.

    Internally the queue uses an array of pointers to keep track of the buffered blocks.

    Code:
            audio_block_t * volatile queue[53];
            audio_block_t *userblock;
            volatile uint8_t head, tail, enabled;

  4. #4
    Senior Member
    Join Date
    Oct 2015
    Location
    Vermont, USA
    Posts
    167
    WMXZ, thanks for the real-world feedback, and for the code. I've been looking at your audio recorder as I, too, am struggling with the less-then-speedy performance of the default SD libraray. As I was so focused on the SD issue, though, I had failed to notice that you had also expanded the queue in your code. Cool!

    Quote Originally Posted by PaulStoffregen View Post
    There is indeed an arbitrary limit of 53 within the code, which allows for about 150 ms to be buffered in the queue.

    Internally the queue uses an array of pointers to keep track of the buffered blocks.

    Code:
            audio_block_t * volatile queue[53];
            audio_block_t *userblock;
            volatile uint8_t head, tail, enabled;
    And, presumably, in addition to changing 53 in the *.h file (as quoted above), I'll probably need to change all of the "53" that are hard-coded in the *.cpp. Roger.

    Chip

Posting Permissions

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