0

I am looking to have the ability to store/analyze audio using a Raspberry Pi Pico. I have found that electret microphones are a good option, since it only requires an ADC, which is already built-in to the Pico.

I am having trouble with finding resources for code/packages in Micropython and was wondering if this route is the way to go. I don't know much about this concept, but is there a package out there that can take the data captured from the ADC and turn it into something useable?

1 Answer 1

1

I've added one recently to a Pimoroni Galactic Unicorn which uses the Pi Pico W board. I've just written it up in Instructables: Adding a Microphone to Pi Pico W on Pimoroni Galactic Unicorn. That describes adding the SparkFun Sound Detector (essentially an amplified electret microphone) to the Pico on GPIO27. I'm working on a second article that describes the C++ code which continuously reads the ADC using DMA leaving it in two buffers where the program can then process the data.

In MicroPython you can't really get perfect audio from a microphone using simple ADC reads in a loop. You'd need to use the low-level stuff to use interrupts or DMA in the same style as C/C++ code to get jitter-free reads at a predictable, fixed rate. It may also be harder to write efficient code to process audio data in real-time in MicroPython although ulab library could be very helpful.

Additional Info

I've not used it but CircuitPython has analogbufio which is present on the RP2040 build for Pico. A hackspace article about this was covered by Adafruit Blog: Fast analogue input with Raspberry Pi Pico – HackSpace Magazine Issue 64.

My second article Instructables: Making a Guitar Tuner and Audio Spectrum Analyser Using the Pimoroni Galactic Unicorn

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.