I2S
I2S is the a protocol for streaming and seems like the best way to sample audio input.
Instructables example code
: Does this code handle multiple reads? How do we know when a buffer is full and it's time to re-read it?
i2s full tutorial
:does not address reading multiple times from analog input
excellent video walkthru using analog read
Arduino library that seems to do magic
but documentation for analog read and multiple buffers seems scant
I didn't review
this one
but it might be worth a look
Code from Google's AI bard
that uses interrupts to know when the buffer is full.
This is untested code.
bard offered these sources:
https://github.com/pion-labs/pion-educational-kits
subject to license (MIT)
https://github.com/tanakamasayuki/Arduino_TensorFlowLite_ESP32
subject to license (Apache - 2.0)
https://github.com/eggfly/MusicCard
subject to license (Apache - 2.0)
https://forum.arduino.cc/t/esp32-i2s-adc-read-two-inputs-possible/1032963
https://github.com/espressif/arduino-esp32/issues/4782
I2S alternatives
Audio sampling with interrupts