LC3 codec with 24-bit PCM

Hi, I'm hoping someone could advise on interfacing with the T2 LC3 codec included in nRF Connect.

The context is I have stereo I2S microphones providing 24-bit 2's complement PCM audio streams, which are to be encoded and decoded via the LC3 codec.

The API suggests 24-bit data should use a buffer with 3-bytes per sample. Therefore my approach is to provide a [3 * N] bytes buffer of PCM data, aligned on the 24th bit assuming the codec will parse this correctly when initialised with a 'bits per sample' of 24.

Using this method, I would expect the decoder to output similar PCM values as the input, however instead I get values with seemingly no correlation at all, so I'm not sure if I'm either making a false assumption about the codec's interface for 24 bit samples, or if they're not actually supported within the implementation.

I've tried configuring the codec for 32-bit, and simply feeding in in the 24-bit value with an ( << 8) bit shift, which is the non-adjusted output from the I2S driver running in 24in32 mode. When I do this, I do get a value which looks similar and consistent, and produces an audible response in playback - but the audio is very noisy and I think this is because the codec should be configured for 24-bit resolution.

Can anyone offer some insight? Thanks.

Related