cancel
Showing results for 
Search instead for 
Did you mean: 

PDM microphone as "DSD over USB" (or network)

tjaekel
Lead

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:

  • 48KHz audio sampling frequency, with decimation 64 - I get 48 * 64 bits PDM = 3.072 MHz (on SAI, PDM MIC).
  • with stereo = 6,144 bits per 1 ms
  • but packed as bytes: I need a payload of 768 bytes (every 1 ms via USB ISO Audio Streaming)
  • and maximum for USB Audio is 960 bytes - it fits!

These 768 bytes are similar to a USB audio format as:

  • 48 KHz, 8bit, 16 channels
  • or 48 KHz, 16bit, 8 channels

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:

  • Does anybody know how to use a USB DSD driver?
  • I do not want to use "DSD over PCM" (DoP), instead native DSD (PDM) - is it possible?
  • assuming "DSD over USB" works - would it be filtered (and converted on PC) to PCM format, so that any audio tool getting audio from such a USB Recording Device would work?

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:

PDM_verification.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
FBL
ST Employee

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.


I'm out of offce with limited access to my emails.
Happy New Year!

View solution in original post

1 REPLY 1
FBL
ST Employee

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.


I'm out of offce with limited access to my emails.
Happy New Year!