microphone-library-for-pico icon indicating copy to clipboard operation
microphone-library-for-pico copied to clipboard

Sample rate lower than 16000 may cause some PDM microphone to stop outputting data

Open rxing365 opened this issue 1 year ago • 2 comments

The output frequency of the clk pin is calculated by the sample rate, and some PDM microphone has a limited frequency range for clock speed (Like MP34Dxxx has a clock rate limit from1 to 3.25 MHz), which causes the sample rate below 16000(Corresponding to the clk frequency of 1.024MHz) to sometimes fail to make the microphone work.

rxing365 avatar Jul 23 '22 07:07 rxing365

Hi @rxing365,

How do you suggest this be addressed? Would you like to see a new API added?

Would changing the PDM_DECIMATION macro to 128 work for your use case?

sandeepmistry avatar Jul 25 '22 14:07 sandeepmistry

Really appreciate your reply. I tested it on my adafruit board and it works. I'm trying to run some voice recognition algorithms on pi pico, it doesn't need much sound quality, the high sample rate is a big challenge for memory. A sample rate of 8000Hz is a reasonable value for my audio buffer, but it would be more convenient to have an API that would allow me to set a lower value. The PDM to PCM conversion seems to be implemented with a lookup table, does that mean it would be hard to implement functions for arbitrary decimation values? It would be a cool feature if the library could automatically adjust the decimation settings to a range acceptable to the sensor, or manually set arbitrary decimation values.

rxing365 avatar Jul 26 '22 03:07 rxing365