This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Thingy audio streaming

Hello,

I'm playing with two thingy and I'm trying to make a sort of walkie talkie with them.

I wrote the code for the sound service client, then modified other parts for making them scanning, connecting and discovering services, exchange mtu, and till here everything works.

At the moment, when I press the button (on the gatt client side) I start the microphone and I start receiving mic frames from the driver. Now I want to write that audio to the gatt server on the peer. Anyway the mic data is provided from the driver with ADPCM encoding, while the speaker characteristic is in PCM 8bit.

At this point I think I need a ADPCM decoder, is that right? Do anybody know where I can find the code for a routine that does this without the need of implementing it? Or is it better to get the PCM from the raw PDM data of the mic?

Thanks, Davide

Parents
  • I reply myself because I did progress in the work and I have understood some thing that were actually not clear.

    The Thingy can play 8bit PCM data at 8kHz. Although the mic outputs PDM data (1032kHz) the PDM interface of the nrf52834 includes a bandpass and decimation block which converts PDM@1032kHz to PCM [email protected] (data is downsampled by a factor of 64). Then to play the mic data into the speaker a further conversion from PCM 16kHz-16bit to PCM 8kHz-8bit is necessary.

    I didn't realize the PDM interface includes the PDM-to-PCM decimation filter and that's was the main reason of all my doubts.

    Now I manage to obtain some audio streamed between the two thingys, but it is still quite distorted.

Reply
  • I reply myself because I did progress in the work and I have understood some thing that were actually not clear.

    The Thingy can play 8bit PCM data at 8kHz. Although the mic outputs PDM data (1032kHz) the PDM interface of the nrf52834 includes a bandpass and decimation block which converts PDM@1032kHz to PCM [email protected] (data is downsampled by a factor of 64). Then to play the mic data into the speaker a further conversion from PCM 16kHz-16bit to PCM 8kHz-8bit is necessary.

    I didn't realize the PDM interface includes the PDM-to-PCM decimation filter and that's was the main reason of all my doubts.

    Now I manage to obtain some audio streamed between the two thingys, but it is still quite distorted.

Children
Related