Anyone know of any software that can do this?

I've built myself a very simple Arduino PDM synth and want to slap in some waveforms and (very small) samples without having to write them out by hand (and guesswork). I've literally been using photoshop to work out the conversion.

There must be something out there that takes a PCM wave (.wav or something), crunches the numbers and spits out a bunch of 1s and 0s which I can then copypaste into the code.

You've probably seen this but this: http://en.wikipedia.org/wiki/Pulse-density_modulation Includes an algorithm in pseudocode to convert from PCM to PDM. Is this what you are looking for? If you want I can try and implement it in C++ or something, doesn't seem that hard. It's weird that there are no apps (or implemented versions) of this algorithm readily available.

Yeah, I saw this but couldn't quite decipher it well enough to apply the code meaningfully (I'm not very good, still learning). If you knocked this up in C++ or whatever I'd be eternally grateful.

Last edited by PROTODOME (Apr 3, 2014 6:32 pm)

Could you send me a PM with contact info or something? I have some questions and I don't want to clutter up the forum with conversation threads.

Cool! I never heard of PDM till now. It's a tad unrelated but seeing the 1's and 0's like that representing the sign reminds me heavily of this 1bit ADC that kind of does a similar thing to a wavform (though its still very different). At about 4:56 you can really start seeing the discrete highs and lows that make up the sinewave in her example.

Last edited by TylerBarnes (Apr 4, 2014 5:34 pm)

I believe this might be of interest to you: http://jefftheworld.com/software/pcm2pwm.tar.gz

Good luck with the project! Keep us updated wink

Shoot me a message if you need any help.

Edit:

Noticed someone posted my pcm2pwm software. I'm not sure it's exactly what you're looking for but might get you most of the way there. I think there are instructions on the use of the software and it's output. It's designed for use in some older CPU assembly code but I'm sure you could format it however you'd like. However, the output is a differential format used for latch audio and not necessarily what you want.

It's still 1-bit audio but it depends on what your 1-bit DAC is like. If it's a "true" 1-bit DAC then my code will work fine for you, if you have a more advanced delta-sigma modulator sort of setup then you'll need to write a little program to do the conversion. WAV files are extremely easy to parse byte by byte, so writing a little C program to convert to whatever format you need should be quick and painless.

Last edited by jefftheworld (Apr 4, 2014 7:12 pm)

Cheers for the help guys. Vegas Diamond wrote me up a little bit of software in the end. The output sounds very NES DPCM, which is rad.

And yeah, if I get something really decent out of it, I'll let y'all know.

PROTODOME wrote:

Cheers for the help guys. Vegas Diamond wrote me up a little bit of software in the end. The output sounds very NES DPCM, which is rad.

And yeah, if I get something really decent out of it, I'll let y'all know.

Hi, I'm arrived here by googling...
Do you still have the PCM->PDM conversion software? Can you please share it if possible?

I would be very grateful, I need something similar to prepare some test bitstream for a decoder...

Thank you!

Don't know if Vegas Diamond frequents the forums much any more, so here it is.

Code is commented, instructions are in there too.

Shoot him some €s if it comes in useful.

Thank you very much!
If some other one is interested in this topic I've found this link that could be helpful:
http://dlbeer.co.nz/articles/pdm.html

;-)

Hi all,
I'm working on a PDM flow audio, and i'm testing some code that convert from PDM 2 PCM. So I'm starting from a PCM audio, than i convert to PDM with the fantastic code posted here (thank you very much!!) and finally back to PCM with my code.
Now i have a question: when I convert from PCM 2 PDM, should i have a number of bit equal to (num_pcm_samples * 8)/decimation_factor ?
A numeric example:
I want to have a PCM audio flow at 16khz, from PDM i sample at 1.024Mhz (16kz*64).
For each msec i have 128 PDM samples (bit) and 16 PCM samples. Correct?
Now when I convert from PCM 2 PDM with the script of Vegas Diamond, i've that the PDM samples are equal to PCM samples.
What am I doing wrong?

It is easy to convert 16bit PCM to PDM, if not oversampling the PCM data.
That is, if the wav file contains 64K audio samples, convert the 64K audio samples to 64K PDM samples is no issue.
However, without oversampling the 64K audio samples to at least 64 times, the output 64K PDM samples is pretty much useless.
I am working on PDM to PCM conversion too.
Have trouble to test my code using existing PCM/wav file as input source.
Looks like the only way to test my code is get real PDM samples from digital microphone.
Any suggestion besides to use the real PDM samples from digital microphone?

Hi there,

Any one know how to convert PDM to PCM. I'm interfacing Knowles pdm mems with samd21 atmeal series MCU. I have interfaced and getting the millions of data but don't know how to extract the useful data from it. kindly share and help.

Last edited by nishant (Aug 12, 2018 8:55 am)