2024-05-02 11:15 PM
Not just an idea, something to verify:
"PDM microphone via USB or Network"
Instead of doing the PDM2PCM conversion (inside MCU) - send the PDM bit stream to a host PC at it is. We can do the PDM to PCM conversion, e.g. with Python scripts, on a host PC. Get the PDM bit stream directly, e.g. via USB as "Audio Input" and Python "sounddevice" or "pyaudio". Do the conversion on PC (which is faster, more flexible, allows to investigate the PDM MIC signal, e.g spectrum, which Delta-Sigma order, ...).
I have checked:
Actually, a PDM microphone should be similar to DSD. With 44.1 KHz sampling frequency, used for PDM MIC, it should be quite identical to a DSD64 audio bit stream.
Can I send PDM (without conversion into PCM) directly (without any filter used) via USB or Network?
Sure, I can! (via network anyway not a problem).
As USB, I need:
These 768 bytes are similar to a USB audio format as:
Just setup a correlating USB Enumeration (Device Descriptor). And now I can stream PDM directly via USB Audio to a host PC. OK, it will come in on PC as USB Sound Input (but you cannot listen to it, yet).
I thought about "how to decode PDM on host"?
There is DSD! And DSD64 is like PDM bit stream, but with 44.1 KHz audio sampling rate (I prefer 48 KHz).
So, I could also configure my PDM MIC for 44.1 KHz final PCM sampling rate (and adapt the USB Descriptors accordingly).
It should be possible to stream PDM MIC directly, like DSD, over USB.
OK, I might need my Python scripts to get it and to unpack and decode it (and to do the filtering on PC).
But cool would be: use an USB DSD driver (e.g. Thesycon, ASIO 2.1) and get the PDM MIC like a regular DSD audio steam. In this case (if possible) - I could use any tool on PC to analyze, to listen, ... to my PDM MIC sound.
Questions:
Remark:
I know for sure, you can "hijack" USB Audio for any transfer of any data, even a digital file transfer (I have used in the past).
But very important is!:
When an USB Recording Device pops up in Windows, e.g. as Digital Microphone Input, in a Python script (with "sounddevice") you will find several different drivers for the same interface, e.g. as "MME", "DirectSound", "WSAPI" and also as "WDM-KS".
All input devices go via the Windows Sound Mixer (e.g. for the volume control, to add effects like bass boost). And this creates "bit errors": the LSB can be changed, it is not anymore the original data (bit stream) which was sent/received via USB.
But if you use the "WDM-KS" device - it bypasses all this stuff and the bit stream remains bit-error-free.
For PDM (DSD) it would be very important to avoid any "bit-flip" even just on a 'LSB" because this would result in a huge frequency change (and sound artefact), because for PDM every bit matters!
So, has anybody tried to bring a PDM microphone via USB to a host PC (like DSD)?
Here my audio pipeline in STM MCU (Portenta H7) I have in place:
Solved! Go to Solution.
2024-07-04 09:28 AM
Hi @tjaekel
Thank you for sharing such insights.
AFAIK, USB peripheral can accept PCM audio data. However, we don't have DSD examples. Also, DSD filtering is not used in the same way as it would be in a typical PDM to PCM conversion process. Maybe you can refer to documentations in specifications or resources from audio engineering third party.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-07-04 09:28 AM
Hi @tjaekel
Thank you for sharing such insights.
AFAIK, USB peripheral can accept PCM audio data. However, we don't have DSD examples. Also, DSD filtering is not used in the same way as it would be in a typical PDM to PCM conversion process. Maybe you can refer to documentations in specifications or resources from audio engineering third party.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.