espressif / esp-who

Face detection and recognition framework
Other
1.64k stars 458 forks source link

for esp32-s3-eye I2S (AIV-637) #270

Open hzhh110 opened 10 months ago

hzhh110 commented 10 months ago

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;

while (true)
{
    i2s_read(I2S_CH, i2s_buff, samp_len_bytes, &bytes_read, portMAX_DELAY);

}

Why is the audio data I'm getting all noisy?

hzhh110 commented 10 months ago

How do I set up to get the full PCM data?

feizi commented 10 months ago

Hi @hzhh110 , you can refer to esp-bsp/esp32-s3-eye about how to set your I2S.