I2S issues with ESP32

So I have a simple code to plot the INMP441 audio input into the Serial Plotter. However I find two major issues after testing the code:
-The sample rate does not match with the sample rate I set in the i2s_config structure. In fact, is the half of the frequency i set up in the .sample_rate variable. For instance, in my case, setting up the sample rate to 44.1KHz will mean that sound frequencies above 11025 Hz won’t be captured by the microphone. If I set up to 88.2KHz then it will capture sound waves untill 22.5 KHz.
-INMP441 supports untill 24 bits of resolution. However when I change the bits per sample above 16 bits the data output has no sense. Before you ask, I’ve increased the loop stack size to make room for the 32 bits vector(called buffer in my case) that stores the input from the microphone.
Please take a look at my code in case it’s a firmware error. Otherwise it might be the inmp441 that is malfuctioning.
The code for 16-bit or 32-bit resolution is the same except for the change from 16 to 32 in all the appropriate places.

#include <driver/i2s.h>

#define I2S_BCK_PIN 32
#define I2S_SD_PIN 33
#define I2S_WS_PIN 25
#define I2S_PORT I2S_NUM_0

const uint8_t dma_count=8;
const uint16_t dma_len=256;

void i2s_install(){
 const i2s_config_t i2s_config={
   .mode=i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX),
   .communication_format= i2s_comm_format_t(I2S_COMM_FORMAT_STAND_I2S),
 const i2s_pin_config_t pin_config={


void setup(){
   Serial.printf("Inicio del programa de comunicación con el micrófono MEMS INMP441 mediante protocolo I2S.\nSe utilizará el Serial Plotter para visualizar los datos de audio.\n ");
void loop(){
   size_t bytes_read=0;
   int16_t samples=dma_len*dma_count;
   int32_t buffer[samples]; 
   uint16_t samples_read=0,range=1000;
   esp_err_t i2s_err= i2s_read(I2S_PORT,&buffer,samples*sizeof(int32_t),&bytes_read,portMAX_DELAY);
        for(uint16_t i=0; i<samples; i++){
         //Serial.print(" ");
         //Serial.print(range * (-1));
         //Serial.print(" ");


Does the issue also happen in the Arduino IDE with the newest Arduino-ESP32 core version? If yes, you’ll receive the best help from the Espressif people directly → Issues · espressif/arduino-esp32 · GitHub