"ESP32 INMP441 Stuck at microphone_inference_record(); – No Error, No Data Received"

Question/Issue:
Tried uploading code to esp32 TTGO T-Display Board
The program gets stuck at microphone_inference_record();.
The last log message is:

Starting microphone recording!..

Project ID:
619283

Context/Use case:
I am using an ESP32 with an INMP441 I2S microphone to record audio and send it to Edge Impulse for processing. The program initializes the microphone and starts recording, but it gets stuck at microphone_inference_record();.

Steps Taken:

  • Verified that the INMP441 microphone is correctly wired (VDD = 3.3V, GND, BCK = 27, WS = 26, DOUT = 25).
  • Checked that the I2S configuration is correctly set (sample_rate = 16000, channel_format = I2S_CHANNEL_FMT_ONLY_RIGHT).
  • Added debug logs to check if the I2S is receiving data before calling microphone_inference_record();.
  • Modified microphone_inference_record(); to print debug messages, but it still gets stuck after logging “Starting microphone recording!..”.
  • Tried reducing DMA buffer size and changing the sample rate (16KHz, 48KHz).

Expected Outcome:

  • The microphone should start recording successfully.
  • The program should proceed past microphone_inference_record(); and process audio data.

Actual Outcome:

  • The program hangs indefinitely after printing "Starting microphone recording!...".
  • No error messages appear, and the ESP32 does not crash or reboot.
  • Debugging shows that I2S may not be receiving data, but no confirmation yet.

Environment:

  • Platform: ESP32
  • Build Environment Details: Arduino IDE 1.8.19, ESP32 Core for Arduino 2.0.4
  • OS Version: Windows 10
  • Edge Impulse Version (Firmware): [Check using AT+INFO or model_metadata.h]
  • Edge Impulse CLI Version: 1.5.0
  • Project Version: 1.0.0
  • Custom Blocks / Impulse Configuration: Using default audio classification model from Edge Impulse

Ok since no one is answering, I have found solutions to my answer.
And now I have unlocked another Wall which are:

I recently encountered an issue while working on my Edge Impulse project with MFCC (Mel-Frequency Cepstral Coefficients) and 1D Convolution for audio classification. Here’s the error I was facing:

06:28:37.909 -> Starting continuous inference in 2 seconds...
06:28:39.884 -> EI_CLASSIFIER_INTERVAL_MS: 0.02
06:28:39.884 -> EI_CLASSIFIER_SLICES_PER_MODEL_WINDOW: 4
06:28:39.977 -> Recording...
06:28:40.696 -> Error sample buffer overrun. Decrease the number of slices per model window (EI_CLASSIFIER_SLICES_PER_MODEL_WINDOW)
06:28:41.173 -> Error sample buffer overrun. Decrease the number of slices per model window

What Causes This Error?

The error occurs because the system is trying to process too many slices of data in a very short time (EI_CLASSIFIER_INTERVAL_MS = 0.02 ms). This overwhelms the buffer, causing an overrun. Essentially, the hardware cannot keep up with the processing demands.

So I’m trying to play /tweak the right parameters in thee model at MFCC parameter.
Also Ill start at 1D convolution in Classifier

image

I fixed the error saying

06:28:37.909 -> Starting continuous inference in 2 seconds...
06:28:39.884 -> EI_CLASSIFIER_INTERVAL_MS: 0.02
06:28:39.884 -> EI_CLASSIFIER_SLICES_PER_MODEL_WINDOW: 4
06:28:39.977 -> Recording...
06:28:40.696 -> Error sample buffer overrun. Decrease the number of slices per model window (EI_CLASSIFIER_SLICES_PER_MODEL_WINDOW)
06:28:41.173 -> Error sample buffer overrun. Decrease the number of slices per model window

How?
By modifying in the source code the number of slices per model window
at the library of arduino file

Documents\Arduino\libraries\Home-Ear-TinyML_inferencing\src\model-parameters
filename : model_metadata.h

Changed EI_CLASSIFIER_INTERVAL_MS value from 0.02 to 10
Changed EI_CLASSIFIER_SLICES_PER_MODEL_WINDOW from 4 to 2

So far The program now continuously starts giving predictions without any error

also before this, I encountered error about watchdog that keeps rebooting my board

E (16210) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
E (16210) task_wdt:  - IDLE0 (CPU 0)
E (16210) task_wdt: Tasks currently running:
E (16210) task_wdt: CPU 0: loopTask
E (16210) task_wdt: CPU 1: IDLE1
E (16210) task_wdt: Aborting.
E (16210) task_wdt: Print CPU 0 (current core) backtrace

So, I add a delay(1000); at the end of void loop program which solves the error

The only problem now Im facing is because of modifications I had made. the accuracy of prediction has gone down too much.

Im still looking into ways to increase the accuracy for now

(post deleted by author)

This post was flagged by the community and is temporarily hidden.

Create Impulse parameters:
-Window size : 1200ms
-Window Stride : 800ms

Window Slice per Model : 4
Classifier Interval 0.2ms
Raw Sample Count : 52920

Processing Block : MFCC
Learning Block : NN Classifier ( default 1D )

So far this parameter is working on the board

Board : ESP32 TTGO T-Display
Sensor : Inmp441 Mems Mic

Result :
Classification Working
Prediction Accuracy : Still Low
No Error in the Program

Tried 1500 window Size , 1000 window Stride , 66150 Raw Sample count and the result is

ERR : Audio Buffer too large ( El Classifier Raw Sample Count )