Error sample buffer overrun

Question/Issue: The arduino IDE report “Error sample buffer overrun. Decrease the number of slices per model window (EI_CLASSIFIER_SLICES_PER_MODEL_WINDOW)”

**Project ID:**318672

**Context/Use case:**Can anyone help me? I encountered the error mentioned in the title. I found similar questions, but I still didn’t solve the problem after resetting the window size and window increase. I also tried modifying EI_CLASSIFIER_SLICES_PER_MODEL_WINDOW in the .h file, but I still encountered the same error. The device i use is esp32, The microphone is inm441, but when I sampled, although the sampling rate was set to 16000, it was only 500Hz on the web page. Is this the cause of the error?

Hi @Winster,

When I downloaded one of your audio samples and opened it in Audacity, you can see that your samples were recorded with a 500 Hz sample rate.

Screenshot 2023-12-05 at 11.12.20 AM

It seems like there was a problem with how you recorded your samples if you wanted them to be 16 kHz.

“Error sample buffer overrun” means that your inference processing is taking longer than it takes to fill up a single slice in the buffer (in other words, your inference speed cannot keep up with the recording speed). For example, if it takes 0.28 sec to run inference and each slice is 0.25 sec long, you will see this error.

First, fix your sampling rate issue to get the data in the desired format (e.g. 16 kHz). If the “sample buffer overrun” issue is still present, then you will want to see how long it takes to perform inference (for example, use the static_buffer example view inference execution time). Then, make sure that EI_CLASSIFIER_SLICES_PER_MODEL_WINDOW is set so that inference time is less than a single slice (for example, if your windows are 1 sec and EI_CLASSIFIER_SLICES_PER_MODEL_WINDOW is set to 4, then your slice time would be 0.25 sec).

Hope that helps!