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

Get amplitude (dB) from PDM

Hi,

for my sound application, I want to get the amplitude, or dB, of the PDM samples.

Are there any existing function implemented? If not, how can I code it on my own?

I already read about PDM. Is it true, that I only need to count the ones in a row? (as shown in the picture in devzone.nordicsemi.com/.../)

Thanks!

Parents
  • Hi David,

    are you using, or planning to use, the nRF52 PDM peripheral functionality? (It is possible to sample a PDM signal using for example SPI or I2S, but this is not the typical approach)

    When using the PDM peripheral, the nRF52 will in hardware convert the 1-bit PDM samples to 16-bit PCM. Your firmware will never see the original PDM signal, only the resulting 16-bit PCM. Calculating the amplitude of a PCM signal is more straight-forward.

    As the resulting PCM is a digital signal with a range of [-32767, 32767] (16-bit signed values) you would typically use decibel relative to full scale (dBFS) for the amplitude: amplitude = 20 * log10(abs(sample) / 32767) dBFS

    To answer your specific question: No, I don't believe you can determine the amplitude by counting the ones in the PDM signal. At the very least you would have to count the number and width of pulses. However, note that PDM is a sigma-delta modulated signal which includes a lot of high frequency quantization noise. Estimating the amplitude from this signal without low-pass filtering means you will include this noise in the estimate, which is probably not desirable.

    Audun

Reply
  • Hi David,

    are you using, or planning to use, the nRF52 PDM peripheral functionality? (It is possible to sample a PDM signal using for example SPI or I2S, but this is not the typical approach)

    When using the PDM peripheral, the nRF52 will in hardware convert the 1-bit PDM samples to 16-bit PCM. Your firmware will never see the original PDM signal, only the resulting 16-bit PCM. Calculating the amplitude of a PCM signal is more straight-forward.

    As the resulting PCM is a digital signal with a range of [-32767, 32767] (16-bit signed values) you would typically use decibel relative to full scale (dBFS) for the amplitude: amplitude = 20 * log10(abs(sample) / 32767) dBFS

    To answer your specific question: No, I don't believe you can determine the amplitude by counting the ones in the PDM signal. At the very least you would have to count the number and width of pulses. However, note that PDM is a sigma-delta modulated signal which includes a lot of high frequency quantization noise. Estimating the amplitude from this signal without low-pass filtering means you will include this noise in the estimate, which is probably not desirable.

    Audun

Children
Related