for esp32-s3-eye board
static void i2s_init(void)
{
i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX), // the mode must be set according to DSP configuration
.sample_rate = 16000, // must be the same as DSP configuration
.bits_per_sample = (i2s_bits_per_sample_t)32, // must be the same as DSP configuration
.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT, // must be the same as DSP configuration
.communication_format = I2S_COMM_FORMAT_STAND_I2S,
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL2,
.dma_buf_count = 3,
.dma_buf_len = 300,
};
i2s_pin_config_t pin_config = {
.mck_io_num = I2S_PIN_NO_CHANGE,
.bck_io_num = 41, // IIS_SCLK
.ws_io_num = 42, // IIS_LCLK
.data_out_num = I2S_PIN_NO_CHANGE, // IIS_DSIN
.data_in_num = 2 // IIS_DOUT
};
i2s_driver_install(I2S_CH, &i2s_config, 0, NULL);
i2s_set_pin(I2S_CH, &pin_config);
i2s_zero_dma_buffer(I2S_CH);
}
for esp32-s3-eye board static void i2s_init(void) { i2s_config_t i2s_config = { .mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX), // the mode must be set according to DSP configuration .sample_rate = 16000, // must be the same as DSP configuration .bits_per_sample = (i2s_bits_per_sample_t)32, // must be the same as DSP configuration .channel_format = I2S_CHANNEL_FMT_ONLY_LEFT, // must be the same as DSP configuration .communication_format = I2S_COMM_FORMAT_STAND_I2S, .intr_alloc_flags = ESP_INTR_FLAG_LEVEL2, .dma_buf_count = 3, .dma_buf_len = 300, }; i2s_pin_config_t pin_config = { .mck_io_num = I2S_PIN_NO_CHANGE, .bck_io_num = 41, // IIS_SCLK .ws_io_num = 42, // IIS_LCLK .data_out_num = I2S_PIN_NO_CHANGE, // IIS_DSIN .data_in_num = 2 // IIS_DOUT }; i2s_driver_install(I2S_CH, &i2s_config, 0, NULL); i2s_set_pin(I2S_CH, &pin_config); i2s_zero_dma_buffer(I2S_CH); }
size_t samp_len = audio_chunksize I2S_CHANNEL_NUM; size_t samp_len_bytes = samp_len sizeof(int32_t); int32_t i2s_buff = (int32_t )malloc(samp_len_bytes); assert(i2s_buff); size_t bytes_read;
}
Why is the audio data I'm getting all noisy?