I was wondering if there is or will be any support for analog microphones. Everything that I’ve seen so far is for PDM microphones. I am using a Wio Terminal which uses an analog microphone on board.
I don’t think this would be too hard to implement. You need to fill the signal buffer with raw audio data, and the EI library takes care of feature extraction and inference, regardless of where the data comes from. The hard part is doing it quickly enough so you don’t overrun the audio buffer.
There are a few ways to handle this that I know of. The first is to use DMA (assuming your controller supports DMA on an ADC pin) to fill the the signal buffer while your processor does feature extraction and inference. I used I2S with DMA in my STM32 demo to fill the buffer.
The other option is to use a preemptive RTOS to interrupt the processor every few microseconds to read a sample on the ADC. I think this is what the EI PDM example is doing (I’m sure an EI person will correct me if I’m wrong on this ).
Edit: I’ve also dabbled with the Wio Terminal, and it is lacking a way to fill an audio buffer in parallel with inferencing. I wish I knew the SAMD51 better, as I can’t imagine it would be too hard to set up DMA if I did
@ShawnHymel, you’re correct. DMA prefered, but you can have a higher-prio thread sample every X ms. depending on the size of the buffer as well.
Haven’t tried DMA yet but it seems that’s the right approach. I’m also new to the SAMD51 but it does DMA with the ADC. I think Adafruit may have extended their Zero DMA library to work with the SAMD51 in addition to the SAMD21. That’s probably what I’ll try first when I get a chance.
@ralphjy Please let me know if it works! I’d love to get my Wio Terminal doing speech recognition with the built-in mic.