Four plus channels of audio recording with I2S
Four plus channels of audio recording with I2S
Hi all,
I've been working with a pair of INMP441 MEMS microphones, and the ESP32 has no problem capturing audio from them, and subsequently writing that to an SD card. My current program uses a single I2S channel to capture the data from the two mics, sampling at 44.1 kHz, 16 bits per sample.
My question is whether it is possible to capture more channels of audio than just two, and if so how I might go about doing that. I do understand that there is a second I2S channel on the ESP32, but that it cannot be operated for audio capture while the other channel is being used. If that's incorrect please advise!
Best,
CB
I've been working with a pair of INMP441 MEMS microphones, and the ESP32 has no problem capturing audio from them, and subsequently writing that to an SD card. My current program uses a single I2S channel to capture the data from the two mics, sampling at 44.1 kHz, 16 bits per sample.
My question is whether it is possible to capture more channels of audio than just two, and if so how I might go about doing that. I do understand that there is a second I2S channel on the ESP32, but that it cannot be operated for audio capture while the other channel is being used. If that's incorrect please advise!
Best,
CB
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: Four plus channels of audio recording with I2S
As far as I know, there's no reason you can't use it, but there's only one audio PLL, so you likely can't use it to record a stream on a random sample rate. Not sure how the driver implements it, but I'd guess you should be fine if you use a sample rate derived from the main PLL, or the same sample rate as the other I2S channel.
Re: Four plus channels of audio recording with I2S
ESP_Sprite wrote: ↑Mon Dec 09, 2019 2:16 amAs far as I know, there's no reason you can't use it, but there's only one audio PLL, so you likely can't use it to record a stream on a random sample rate. Not sure how the driver implements it, but I'd guess you should be fine if you use a sample rate derived from the main PLL, or the same sample rate as the other I2S channel.
Thanks for your response. The reason I thought that it could not be done that way is from reading this doc:
https://docs.espressif.com/projects/esp ... s/i2s.html
...which states that for the Function: esp_err_ti2s_set_pin(i2s_port_ti2s_num, consti2s_pin_config_t*pin)
The I2S peripheral output signals can be connected to multiple GPIO pads. However, the I2S peripheral input signal can only be connected to one GPIO pad.
From this, it would seem that it is not possible to read from both I2S peripherals simultaneously.
Am I reading that incorrectly?
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: Four plus channels of audio recording with I2S
'the' is a bit misleading here (probably something to do with Chinese not having articles) but it is per I2S peripheral. If you have two I2S peripherals, you can assign an unique GPIO to either, totalling 2 I2S inputs. The idea behind the line is that you can use the GPIO matrix to route an I2S output to go to a bunch of pins in parallel, but you cannot do the same with input pins.
Re: Four plus channels of audio recording with I2S
Thanks for that very helpful clarification. I'll give it a try!
Re: Four plus channels of audio recording with I2S
Sorry, I don’t quite understand what the program code will look like allowing you to simultaneously record more than 2 ADC channels while using 2 I2S.
I mean in the i2s_adc_dac example one ADC channel is recorded using one I2S.. Is there any ability to simultaneously ascque 3-4 adc channels with high (20-50K) sps per channel ?
I mean in the i2s_adc_dac example one ADC channel is recorded using one I2S.. Is there any ability to simultaneously ascque 3-4 adc channels with high (20-50K) sps per channel ?
Re: Four plus channels of audio recording with I2S
Some search gives that esp32_technical_reference_manual says:
Multiple-channel scanning mode; there is a pattern table that defines the measurement rule for each SAR
ADC. The scanning mode can be configured as a single mode, double mode, or alternate mode.
But API for pattern table has a lot of issues and not documented in IDF... The question is when is it planned to add pattern table functionality to the IDF API and docs?
Multiple-channel scanning mode; there is a pattern table that defines the measurement rule for each SAR
ADC. The scanning mode can be configured as a single mode, double mode, or alternate mode.
But API for pattern table has a lot of issues and not documented in IDF... The question is when is it planned to add pattern table functionality to the IDF API and docs?
Re: Four plus channels of audio recording with I2S
@cblondon Could you summarize where you landed on this subject?
I just want to clarify that it is possible to have two microphones share the same 3 i2c pins and one i2c interface on the esp32 just by setting their jumper to L and R modes? I'm trying to build a four mic array for sound localization, and wondering how to handle that with the two i2c ports available. Any info much appreciated.
I just want to clarify that it is possible to have two microphones share the same 3 i2c pins and one i2c interface on the esp32 just by setting their jumper to L and R modes? I'm trying to build a four mic array for sound localization, and wondering how to handle that with the two i2c ports available. Any info much appreciated.
Re: Four plus channels of audio recording with I2S
Yes, I was able to use both I2S interfaces on the ESP32, and was successful in simultaneously capturing four channels of audio. It did take some experimenting with bits to get both interfaces to work properly. I'm happy to share code if you'd like.
Re: Four plus channels of audio recording with I2S
Yes please share your code, I am also very interested in the solution.I'm happy to share code if you'd like.
Who is online
Users browsing this forum: No registered users and 144 guests