ESP32 record audio from USB microphone?

Hye there, I am wondering if a USB microphone can connect to ESP32 (I know Arduino can't handle stereo audio recording, so I'm trying to avoid it), and then record the stereo audio to the ESP32. Probably would save it in .wav format using an SD card. I am not an expert at all, I have been trying to look for examples of related projects, but still no solution.

For the initial outcome, at least it would be fine to receive some signals from the microphone, to the Audacity software for instance (I've seen this done but using I2C mic, which is not thru USB input. Before programming it to save the .wav to the SD card automatically.

It is for a project of recording bird sounds, I just need to use a low-powered device for this project, other than using raspberry pi.

Thanks!!

A USB microphone needs a driver and I don't think that exists for an ESP32. I think you need an operating system (Windows, OS-X, or Linux).

1 Like

The ESP32 MCU doesn't have native USB and all the boards I've seen have a USB-to-Serial that is a USB peripheral interface. A USB microphone plugs into a USB host interface.

In addition to the I2C microphone, one could use an analog output microphone module connected to the ESP32 analog to digital converter to capture the signal.

Most common ESP32 dev boards don't have the USB hosting capability for connecting to any USB devices without additional hardware. Only one that has the hardware is ESP32-S2 boards that ESP-Arduino may or may not support. Also the software side is lacking. There isn't an official release of USB host stack by Espressif. Looking forward to a release some time this year though.

You can ask on teensy forum whether their latest Teensy 4.1 supports USB hosting of audio devices. I didn't see a driver on their repo though.

https://www.pjrc.com/store/teensy41.html

USB host shield library 2.0 is another possibility. But I didn't see an audio driver either. Worth asking the question there:

Seems that your use case is relatively uncommon. Maybe you can find some spy audio recording devices to trigger start/stop with arduino so it would record to its sd card instead of getting the data through an arduino or esp32.

Using the ESP32 to receive audio and convert it to digital is possible. The ESP32 can be ran from batteries and placed near feeding areas.

I use a Adafruit Electret Microphone Amplifier - MAX9814 with Auto Gain Control in a project. I like the microphone module cause I can change the gain programmatically.

Any other signal processing, after the signal is digitized, such as TensorFLow or Linear Regression, would best be done on the RPi. The ability of the RPi to store trained models and with the processing libraries such as LinearRegression TensorFlow and SicktLearn are beyond what can be done with a ESP32.

It took my ESP32 96 hours to develop a training model to predict the next hours air pressure with a .98+ accuracy. Because I have models stored in a database connected to the Pi training models are already available. I can then get immediate predictions of air pressure data 5 days out with a .98+ correlation.

This morning, I was using my ESP32-CAM to capture images, grey scale,, FTP the images over to the RPi to be used as training models to ID ducks; my first attempt. I was able to use LR/SciKitLearn to attempt to ID ducks. I am currently getting correlations between .3 to .4; yea more training needs be done. It was my first try.

1 Like

So, if I use a USB Host shield 2.0 or USB Host mini for ESP32, is it possible? Does USB host shield have drivers for audio processing?

Thanks! Yes, it is possible, but the problem here is that I need to use my USB microphone, which I think ESP devices don't have any drivers for that.

Btw, great project you're doing there! Good luck.

Okay thanks for the info! Will definitely ask it there.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.