ESP 32 S3 DEVKIT C - digital PDM microphone problem
Posted: Thu Feb 15, 2024 9:06 pm
I need help with a problem I'm experiencing with my ESP32 S3 DevKit C. When I try to record audio, sometimes the volume is very loud, and other times it is extremely low. I've tested with multiple microphones, but the issue persists. I'm using the Arduino IDE with an I2S configuration for audio input. Here's the configuration code I'm using:
What can I do to solve this problem?
Can you suggest some code to test my application, maybe I'm doing something wrong?
- void i2s_install() {
- const i2s_config_t i2s_config = {
- .mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_PDM),
- .sample_rate = SAMPLE_RATE,
- .bits_per_sample = i2s_bits_per_sample_t(BITS_PER_SAMPLE),
- .channel_format = i2s_channel_fmt_t(I2S_CHANNEL_FMT_ONLY_LEFT),
- .communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_I2S),
- .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
- .dma_buf_count = 32,
- .dma_buf_len = BUFFER_LEN,
- .use_apll = false,
- };
- i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL);
- esp_err_t status = i2s_set_clk(I2S_PORT, SAMPLE_RATE, BITS_PER_SAMPLE, I2S_CHANNEL_MONO);
- }
Can you suggest some code to test my application, maybe I'm doing something wrong?