DSPRelated.com
Forums

Integrate PDM to PCM?

Started by Tom Becker October 13, 2016
> ... not with an SPI bus that takes in 8 bits at a time...
True. An external shift register can solve that easily.
> Does the microphone company give any direction on the filtering...
Not much that I've found. Knowles sells an evaluation board that uses ICs from three competitors: Analog's ADAU7002 PDM-to-I2S converter, Cirrus' C42L51 I2S-to-audio codec, and TI's PDM2900 audio to USB codec. It seems odd to me that the USB output of Knowles' digital microphone evaluation board has passed in and out of analog. I believe the large sink of PDM mics is cellular handsets where the data format and rate is apparently standardized - so application notes are perhaps unnecessary. FYI: http://www.knowles.com/eng/content/download/6071/109968/version/2/file/Knowles_PM_Walleye_KAS-33100-002_Rev+0416.pdf http://www.analog.com/en/products/audio-video/sample-rate-converters/adau7002.html#product-overview https://www.cirrus.com/en/pubs/proDatasheet/CS42L51_F2.pdf http://www.ti.com/product/pcm2900 Tom
The mems element itself is unlikely to have much response at ultrasonic frequencies. Clocking the A/D at a higher rate does not scale the mechanical response of the mems element.  The roll-off rate above the mechanical resonance can be quite sharp. 

Bob
<radams2000@gmail.com> wrote:

>The mems element itself is unlikely to have much response at ultrasonic >frequencies. Clocking the A/D at a higher rate does not scale the >mechanical response of the mems element. The roll-off rate above the >mechanical resonance can be quite sharp.
Designers have told me that the MEMS microphones have good response beyond 30 KHz. But I am not sure what spretrum bats are using -- perhaps higher. Steve
On Sat, 15 Oct 2016 15:38:14 -0500, Tim Wescott wrote:

> (4.608MHz -- might be fun finding a crystal),
Digikey lists 4.608MHz oscillators but none are in stock. 18.432MHz (4 x 4.608MHz), however, is a standard baud rate generator frequency, and crystals and oscillators are cheap and readily available. Regards, Allan
> ... The mems element itself is unlikely to have much response at ultrason=
ic frequencies. The Knowles MEMS mic I'm expecting to use is essentially flat to 10kHz then= rises to +14dB at ~25kHz, falls to +8dB at 40kHz then rises to +13dB at 80= kHz according to its datasheet. The conventional 6mm-diameter analog elect= rets I currently use work well, albeit noisier than I'd enjoy, to ~50kHz. = You can hear them, downshifted by 20kHz, after dusk and before dawn in Cape= Coral at http://78.46.38.217/amb9u - unless there is local rain expected, = when they will be covered with a thin plastic jacket that reduces effective= sensitivity and makes loud raindrop pops.
> ... what spectrum bats are using...
Bats use 12kHz to 100kHz, although the higher frequencies are severely abso= rbed by atmosphere and are difficult to detect at any significant range. M= ost common bats use ~20kHz to ~40kHz. I am particularly interested in two = species that are audible to the healthy human ear, Eumops floridanus and Ta= darida brasilensis. Both can emit chirps at 12kHz that can be heard at som= e distance; in fact, you might hear what you'd dismiss as a high-flying sma= ll bird that is actually a large bat like Eumops. Tom
Am Donnerstag, 13. Oktober 2016 18:04:11 UTC+2 schrieb Tom Becker:
> As a bat call recording enthusiast I'd like to use a pair of digital MEMS elements whose ultrasonic performance appears to be well suited. > > The Knowles SPH0641LM4H-1 mic output is PDM and can run at 4.8MHz.
Actually, 4.8MHz doesn't sound like a lot for a 1-bit signal if you're interested in ultrasonics. I'm familiar with DSD signals (1-bit, 2.8 MHz, see Super Audio CD). They tend to be pretty noisy in the ultrasonic frequency range. The noise floor below 20 kHz is low but starts to increase pretty quickly at higher frequencies.
> I want to stay in digital domain, ultimately recording 16-bit PCM at 192kHz. Researching PDM-to-PCM conversion algorithms suggests low-pass filtering.
I wrote C code to convert 1-bit signals to PCM (just a 8:1 decimation). The filter was designed to deal with DSD signals but since you are interested in ultrasonics and have a signal at a higher rate (4.8 MHz instead of 2.8 MHz) the filter might be close to what you need. https://code.google.com/archive/p/dsd2pcm/ If you feed this with a 1-bit signal at 4.8 MHz, you'll get a PCM signal at 600 kHz. The lowpass filter has a flat response up to 80 kHz and starts attenuating frequencies above that. Further decimation stages make sense because this 600 kHz PCM signal would contain mostly noise within 150-300 kHz. The filter implementation uses six 256-element lookup tables each mapping 8 bits to floats (partial convolutions) and a bit reversal table exploiting the symmetry of the even-tap lowpass impulse response. The filter is actually a winwowed sinc using some high rejection Kaiser window IIRC. You could probably do better but this was good enough for the FFMPEG folks to reuse my code. :) Cheers! SG
> ... (4.8 MHz instead of 2.8 MHz) the filter might be close to what you need.
Indeed. Thanks, Sebastian. Between Tim, Steve, Bob, Randy and your thoughts I have much to work with. It'll be fun to try - particularly if something works. Your code's floats rule out the AVR but I can lean on a Raspberry Pi 3, too, which is also in the field box I carry. My downshifted live stream runs on one already, although the analog mic preamps feed a conventional USB sound module. Tom
The "standard" way of decimating a delta sigma stream is to use an Nth order sinc filter where you use the Hoganeur (spelling??) modulo trick, followed by a cascade of half-band 2:1 decimators. Choose N to be 1 degree larger than the modulator order. In this application it's unlikely that you would bother correcting for the sinc droop. Audiophiles will just have to live with the fact that they can hear the difference between a live bat and a recoded bat :)

Bob
> ... Audiophiles will just have to live with the fact that they can hear the difference between a live bat and a recoded bat :)
Recoded! Ha! You say that tongue-in-cheek but, while I am a bat recording hobbyist, albeit a serious one, there exist golden-ear batters who might well complain about processing artifacts just as there are oxygen-free-speaker-wire audiophiles. That's perhaps for good reason since batters both hear the calls and scrutinize their time-varying spectra - which is how most species call identification is made. Many, in fact, don't listen to the call at all - but they will notice that a third harmonic is missing. We are proud of our accurate, unclipped insect-, noise- and reflection-free spectrograms! Tom
Tom Becker  <gtbecker@rightime.com> wrote:

>> ... Audiophiles will just have to live with the fact that they can >hear the difference between a live bat and a recoded bat :)
>Recoded! Ha!
>You say that tongue-in-cheek but, while I am a bat recording hobbyist, >albeit a serious one, there exist golden-ear batters who might well >complain about processing artifacts just as there are >oxygen-free-speaker-wire audiophiles.
Excellent. Have you worked with dolphins? S.