Hi all,

I am still trying to perform simple one way acoustic ranging through the audio library but keep having inconsistencies in the elapsed timing even after increasing the sampling rate. The idea I am pursuing is to see if I can record the sounds and post process the recording to detect the tone and derive the elapsed time through that.
I am working with two teensy 4's, one with a mic and the other with a speaker. What I am trying to do is have a sequential tone being played from the teensy+speaker which also triggers a pin (triggered using the bounce library) connected to the teensy+mic to direct it to start recording sound. I want to record a short duration (~150ms) into a record queue and then transfer that to a play queue to do a tone detection. I am trying to see if i can accurately detect which packet(and possibly sample) in the queue crosses the threshold for the tone detection, and if I can do that I can deduce the timing, possibly.
I am a bit unclear on how to transfer the data from the record queue to the play queue, and how much can the play queue hold on to. Here is a snippet of my code:

void back_end()
  while (1)
   if(queue_r.available()>=50 )
   { queue_r.end(); 
    byte buffer[12800]; 
    for(int i =0; i<50; i++)
      memcpy(buffer+i*256, queue_r.readBuffer(),256); 
     int16_t *outbuf = queue_p.getBuffer();
     memcpy(outbuf, buffer, 12800); 
I think this is wrong because the getBuffer() function can only do a 128 int16 array at a time. But it is not clear to me if the play queue works similar to the record queue and I can keep iterating through the buffer to fill in the play queue. Any hints are appreciated! Below is what the Audio GUI tool documentation says about the record queue.

Up to 52 packets may be queued by this object, which allows approximately 150 ms of audio to be held in the queue