I2S raw import is always 16bit pcm

stuartiannaylor
Posts: 17
Joined: Wed Dec 02, 2020 6:02 pm

I2S raw import is always 16bit pcm

Postby stuartiannaylor » Wed Dec 02, 2020 6:10 pm

Hi there I have been playing with my 1st Esp32 and https://github.com/atomic14/ICS-43434-breakout-board

Which works great but slightly confused as irrespective of I2S_BITS_PER_SAMPLE_24BIT it would seem to be always 16 bit when importing the raw into audacity.

https://drive.google.com/open?id=1FQkvV ... 6_uW_Absuy

The above is my result and apart from stereo mics to the above project its vanilla with a slight change to I2S config.

Code: Select all

// i2s config - this is set up to read fro the left channel
i2s_config_t i2s_config = {
    .mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX),
    .sample_rate = 44100,
    .bits_per_sample = I2S_BITS_PER_SAMPLE_32BIT,
    .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
    .communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB),
    .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
    .dma_buf_count = 4,
    .dma_buf_len = 1024,
    .use_apll = false,
    .tx_desc_auto_clear = false,
    .fixed_mclk = 0};
Its not that much of a biggy as 16bit is fine but it did confuse me and just curious to why?

stuartiannaylor
Posts: 17
Joined: Wed Dec 02, 2020 6:02 pm

Re: I2S raw import is always 16bit pcm

Postby stuartiannaylor » Thu Dec 03, 2020 9:06 pm

Ignore me as its part of the project.

Code: Select all

void I2SSampler::processI2SData(uint8_t *i2sData, size_t bytes_read)
{
    int32_t *samples = (int32_t *)i2sData;
    for (int i = 0; i < bytes_read / 4; i++)
    {
        // you may need to vary the >> 11 to fit your volume - ideally we'd have some kind of AGC here
        addSample(samples[i] >> 11);
    }
}

Who is online

Users browsing this forum: No registered users and 34 guests