This program implements the decimation of a Pulse Density bit-stream. The typical use-case of this program is to decimate the PDM stream of a microphone to the usual audio sampling-rates. For example 16kHz for the keyword recognizer of Alexa voice services.
A bit-exact demonstration files and executable (BATCH_SRC.BAT) is located Here.
The code is ported and benchmarked for ARM Cortex-M4 / M7, and can be executed on any processor using 32-bits arithmetic. The first processing stage is a 4th order CIC decimator with decimation rate of 32 or 64, followed by an half-band decimator and DC-offset canceller using floating point arithmetic.
Example with a PDM rate is 2.048MHz with an Over Sampling Ratio (OSR) of 128, the targeted sampling rate is 2.048MHz/128 = 16kHz. The CIC decimator consumes 9.5 cycles/bits of a Cortex-M7, 39 cycles/samples at OSR=2 for the second decimator, 10 cycles for the DC-offset canceller.