I would like to convert PDM (Pulse Density Modulation)
microphone data into PCM (Pulse Code Modulation) data
. I understand that there are 2 steps in this process.
- application of a low pass filter on the PDM data stream of binary pulses
- decimation process to reduce the sample rate to the desired PCM data rate
- encode the values between 0 and 1 into words of eg 16-bit?
Can someone expand on how these 2 steps are implemented (eg pseudo-code)? Or, is it that the main steps are different in order to produce PCM words of the signal intensity over time?
For 1. (if correct) what type of filter is applied and how is it implemented?
For 2. when 'downsampling', is it correct to pass through the data collecting only every Nth sample
to get the required bit rate (eg 48KHz) from a faster sample rate (eg 1MHz)? Do we also apply a low pass filter after downsampling (same filter as 1. or different filter)?
For 3. are the words produced from the floating point values between 0 and 1 found in the previous steps?