Different sound qualities when sampling with different frequencies and microphones

Hi,

Sampling from USB device works with some sampling rates on some microphones but not with others. I tested four different microphones with these results:

INMP411 with 16K - Very quiet and noisy
INMP411 with 8K - Very quiet and noisy

ICS-43434 with 16K - Better, but still distorted
ICS-43434 with 8K - Super loud pink noise (or similar)

ICS-43432 with 16K - Even better but still not perfect
ICS-43432 with 8K - No sound at all

PUI-DMM-4026-B with 16K - No sound at all
PUI-DMM-4026-B with 8K - No sound at all

All these microphones are I2S microphones and I used the latest edge impulse firmware without modification.
You can listen to the recordings here: EdgeImpulse-Sampling-tests – Google Drive

Has anybody an idea why i get so different results?

1 Like

Hi @edsteve,

I’m a little confused by your setup. Did you capture audio by connecting your ESP32-EYE (running the official firmware) to the Edge Impulse Studio? Or did you capture it directly to your computer (via USB) using some other software tool?

Please note that if you are using the Edge Impulse firmware, only the onboard microphone (MIC8-4X3-1P0) is supported. To capture from other microphones, you will need to write your own driver for the ESP32.

Hi @shawn_edgeimpulse and thanks for your reply.

Yes. I am using Edge Impulse firmware directly to Edge Impulse studio.
I am a bit confused because most of these I2S microphones work with the same driver and the same firmware when i did data collection which wrote wav files on a SD card. They also work with different sample rates. But i will look into changing the driver.

If you can give me a quick hint::
Is it this file ei_microphone.cpp from the firmware i have to modify or the i2s.h file itself?

I know you are very busy so would really appreciate your answer.

Hi @edsteve,

I believe you should just need to modify ei_microphone.cpp, but @AIWintermuteAI would best know the answer to that. That being said, I often find it easier to start with a pre-existing library that does the I2S work for you and then write samples to e.g. an SD card for saving wav files. Once I have a trained model, I’ll use the same driver to capture audio data to feed to run_classifier() for performing inference.

Thanks so much for your answer. That points me in the right direction.

and then write samples to e.g. an SD card for saving wav files

I actually already have a trained model based on wav files recorded with the ESP32 to an SD card. My firmware programmer used atomic14’s code for that.
So i basically have to implement the “driver” from atomic14 into the edge impulse firmware. This is over my capacity but i will hopefully find a solution on Upwork :slight_smile:

1 Like

It seems to be really difficult to adjust the I2S driver properly? Even for 200USD i can’t find someone who can do it. I tried two freelancers.

So i will go with another approach and hope to get some feedback if that will work:

Instead of making the Edge Impulse I2S driver work. The plan is to deploy the TFlite model into my already existing firmware that has a tested and working I2S driver compatible with my microphone (ICS-43434).
Can the Edge Impulse TFlite model be deployed into my own firmware? Any obstacles?

This is my working firmware (Good sound but without a deployed mode):

Hi @edsteve,

Rather than deploy the TFLite model, I recommend deploying the C++ SDK library. That should integrate into your C++ firmware code. I recommend taking a look at this example to get started using the C++ SDK: GitHub - edgeimpulse/example-standalone-inferencing-espressif-esp32: Builds and runs an exported impulse locally (ESP IDF).

To perform inference, you call run_classifier() (which is shown here). You will need to provide a callback function (demonstrated here) that fills the internal inference buffer with your audio samples.