XIAO nRF52840 Sense PDM Microphone to Wav FIle

Hey everyone!

I’m needing to use the onboard PDM microphone to record some audio for a project. My project can’t use the mbed board definitions, so the only library I can use is this one here. The example plotting sketch converts the PDM data to PCM data, which can then be converted to a .wav file.

I have some simple python code that converts it to a playable file, but the wav file isn’t recording anything of value. For example, 7-10 seconds of recording creates a 1-2 second clip which has some pieces of audio, but not much.

Has anyone worked with the nRF52840 sense PDM microphone and extracted usable data, or have any idea how to?

Thanks in advance!

Hi cam,
“Examples → nRF52840 PDM Adafruit Fork → PDMSerialPlotter.ino” for reference, and by making the buffer size large enough, PCM data can be recorded to the SD card.

short sampleBuffer[32768];
PMD.setBufferSize(32768);
1 Like

The following link may be helpful.

Recording PDM data of XIAO nRF52840 Sense to SD card

Thank you for the response!