Page 1 of 1

ADPCM Compression

Posted: Wed May 31, 2017 9:59 am
by lil_spli
Hi

According to the ESP32 datasheet

"The ESP32 I2S module integrates an A-law compression/decompression module to enable compression/decompression of the received audio data."

Does anyone know there's anything in the SDK (or any plans) to enable compression/decompression on incoming I2S PCM data. I have a MEMS microphone that imports 32-bit samples at quite high sample rates so some kind of hardware A-law compression would be great.

Thanks


Simon

Re: ADPCM Compression

Posted: Thu Jun 01, 2017 1:29 pm
by BuddyCasino
ADPCM is a simple predictive codec. A-law and ยต-law are non-linear quantization curves to get better dynamic or s/n ratio for when your ADC resolution is limited, which seems to be the opposite of what you have to deal with.

What do plan to accomplish?

Re: ADPCM Compression

Posted: Fri Jun 02, 2017 11:40 am
by lil_spli
Hi

Sorry, wasn't very clear. I would actually like to compress the raw PCM that is coming through from the microphone as I'm transmitting it over UDP using Wifi. 32bit PCM is taking too much bandwidth, so I'm investigating how I can get the ESP32 to perform some compression. I was looking into ADPCM/A-law, saw there was hardware support for it and wondered whether it would help, especially as it's only voice quality I'm interested in. I admit to not using A-law before, so I could be wrong on this.

Thanks

Re: ADPCM Compression

Posted: Fri Jun 02, 2017 1:46 pm
by BuddyCasino
I see. I'm not sure the ESP32 has ADPCM hardware, where did you read that?

Someone recently ported the LAME MP3 encoder, you can try to use that one if latency is not important. Also, there is a software SBC encoder in the bluetooth module you could try

I am streaming 16bit, 16khz mono audio via wifi just fine, which microphone are you using? Even the Knowles SPH0645LM4H supports 16khz in practise, though the datasheet says otherwise.

Re: ADPCM Compression

Posted: Fri Jun 02, 2017 2:36 pm
by lil_spli
I took the quote I posted above from the hardware reference manual https://espressif.com/sites/default/fil ... ual_en.pdf. I didn't realise the Knowles SPH0645LM4H did 16khz rates, as I was just going by the datasheet :) but as you say, that should be fine.

I'll take a look at the SBC encoder as well.

Thanks for your help

Re: ADPCM Compression

Posted: Wed Dec 06, 2017 8:34 am
by englund
The manual also mentiones "The RX_PCM_BYPASS bit and the TX_PCM_BYPASS bit of register I2S_CONF1_REG should be cleared when using the A-law compression/decompression module." which could be interpreted as "should be cleared to use". Have you tried clearing them and looked if the data being written by the DMA has been compressed on the way?