DSPRelated.com
Forums

Integrate PDM to PCM?

Started by Tom Becker October 13, 2016
> Have you worked with dolphins?
No; that would be a natural progression, though. I live on a brackish canal in Cape Coral (the live ultrasonic stream comes from the dock) where we occasionally hear Dolphins and Manatee breaking the surface to breathe - on rare occasion very clearly on the ambient mics out there (http://78.46.38.217/amb9); more likely you'll hear fish jumping. Our canals are behind a lock, though, which keeps most Dolphins and Manatee out but there is talk of leaving the lock open, exposing the canals to tides and the animals. If that happens I will certainly drop a pair of hydrophones off the dock. Tom
On Thursday, October 13, 2016 at 3:11:39 PM UTC-4, Tim Wescott wrote:
> On Thu, 13 Oct 2016 09:03:48 -0700, Tom Becker wrote: > > > 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. I > > want to stay in digital domain, ultimately recording 16-bit PCM at > > 192kHz. Researching PDM-to-PCM conversion algorithms suggests low-pass > > filtering. Analog's ADAU7002Z PDM to I2S converter might be useful but > > appears to only produce 96kHz PCM. > > > > Can I, instead, integrate the 1-bit stream in a 16-bit counter, > > incrementing or decrementing per each clocked PDM bit at 4.8MHz, and > > latch the counter value at 192kHz? > > Sounds like a plan, except that there's a good chance of a DC bias > that'll make your integrator run away. > > I'd put a DC-blocking algorithm in there someplace. If you're doing this > in an FPGA it should be simplicity itself to do so; just remember that > it's an IIR filter and therefor will need attention paid to data path > widths. >
and, given any finite word width, there should be error feedback to keep it from limit cycling outputting DC. you know Tim, this thing: https://groups.google.com/forum/?/comp.dsp/2QCyFGjGfxU/sRfVfvajbZAJ#!searchin/comp.dsp/tim$27s$20better$20dc$20blocker%7Csort:relevance/comp.dsp/OyUj74kMJWU/ojctmNuR3HwJ r b-j
radams2000@gmail.com writes:

> The "standard" way of decimating a delta sigma stream is to use an Nth > order sinc filter
Bob, By "sinc filter" do you mean CIC or moving average? Or do you really mean just a sin(pi x) / (pi x) filter? -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
Tim, 

First of all let me state that I think your idea (re: using an I2C and a
lookup table) is innovative. I give the approach an "A" for innovation.
But as I've touched on, some parts of the approach I don't think would
work out. I've one more comment below about this.

Tim Wescott <tim@seemywebsite.really> writes:

> On Fri, 14 Oct 2016 23:09:51 -0400, Randy Yates wrote: > >> Tim Wescott <seemywebsite@myfooter.really> writes: >> >>> On Thu, 13 Oct 2016 21:20:10 -0700, Tom Becker wrote: >>> >>>>> ... set up an SPI port to clock at 4.8MHz [] then you have a look up >>>>> table: >>>>> 0 has 0 bits on, >>>>> 1 has 1 bit on, >>>>> 2 has 1 bit on, >>>>> 3 has 2 bits on, >>>>> etc. >>>>> The output of that table gets 4 subtracted from it... >>>> >>>> Ah. So eight bits (0-255) @4.8MHz becomes three bits (0-7) @600kHz, >>>> offset by -4 makes it bipolar? So now I have 3-bit PCM @600kHz? How >>>> do I get from there to 16-bit @192kHz? >>>> >>>> Tom >>> >>> Low-pass filter. >> >> And resample. It's not a simple decimation either. >> >> You also will have an unwanted sync in the spectrum due to the >> disjointed 8-bit "integration." > > That kinda depends on the noise characteristics going into the > integration (and I don't think it needs the quotes). > > One thing about an integrator-comb filter is that it nulls out the very > frequencies that would alias down to DC, so it may not be that bad.
That is true. If I'm looking at this right, a moving-average filter is going to be a really crappy filter for decimation. The quantization noise from the modulator, regardless of its specifics, is going to have significant power at frequencies the MA won't filter out, so it would alias back to baseband after decimation. I think.
>> This sounds like a bad approach the more I think about it. I can't pull >> any rabbits out of a hat, either. I'm afraid Tom will need to suck it up >> and use something with more oomph. > > Going into what my 1980's trained brain calls a "small FPGA" but which > FPGA guys would call a "CPLD" should work.
Oh sure, then you could do a decent job. I was under the impression Tom was not willing to change his hardware.
> My gut feel is that you could get it shoehorned into an ATMega, but you'd > be spending more effort with the shoehorn than with the basic problem.
Possibly. -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
Randy Yates <yates@digitalsignallabs.com> writes:

> radams2000@gmail.com writes: > >> The "standard" way of decimating a delta sigma stream is to use an Nth >> order sinc filter > > Bob, > > By "sinc filter" do you mean CIC or moving average? Or do you really > mean just a sin(pi x) / (pi x) filter?
Duh, well I guess there's not a difference (in discrete-time)... -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
Yes, I use the terms interchangeably, but CIC would have been a better term to use. 

Bob
On Tuesday, October 18, 2016 at 2:06:25 AM UTC+2, Randy Yates wrote:
> > If I'm looking at this right, a moving-average filter is going to > be a really crappy filter for decimation. The quantization noise > from the modulator, regardless of its specifics, is going to have > significant power at frequencies the MA won't filter out, so it > would alias back to baseband after decimation. I think.
You're right. A filter with a strong rejection is really important here. The one I used has a rejection of 140 dB in the stopband. But I do tolerate a bit of aliasing in the very high frequencies to keep the impulse response short. Cheers! SG
SG  <s.gesemann@gmail.com> wrote:

>On Tuesday, October 18, 2016 at 2:06:25 AM UTC+2, Randy Yates wrote:
>> If I'm looking at this right, a moving-average filter is going to >> be a really crappy filter for decimation. The quantization noise >> from the modulator, regardless of its specifics, is going to have >> significant power at frequencies the MA won't filter out, so it >> would alias back to baseband after decimation. I think.
>You're right. A filter with a strong rejection is really important >here. The one I used has a rejection of 140 dB in the stopband. >But I do tolerate a bit of aliasing in the very high frequencies >to keep the impulse response short.
I agree, as the assumption is the MEMS mic issues something like a sigma-delta-modulated stream -- although this is nowhere specified, it seems logical. Such bitstreams have a huge amount of energy in the stopband, with a spectral density up there greater than in the passband. An IIR filter with an order at least one greater than the order of the S-D modulator is the baseline choice. If an FIR (Kaiser would be a good place to start), it should equal or exceed the performance of a suitable IIR. There are many good choices, it just seems we're in an information vacuum trying to design this BHC. ** Steve ** Bat-Human Converter
On Tuesday, October 18, 2016 at 10:38:24 AM UTC-4, Steve Pope wrote:
> SG <s.gesemann@gmail.com> wrote: > > >On Tuesday, October 18, 2016 at 2:06:25 AM UTC+2, Randy Yates wrote: > > >> If I'm looking at this right, a moving-average filter is going to > >> be a really crappy filter for decimation. The quantization noise > >> from the modulator, regardless of its specifics, is going to have > >> significant power at frequencies the MA won't filter out, so it > >> would alias back to baseband after decimation. I think. > > >You're right. A filter with a strong rejection is really important > >here. The one I used has a rejection of 140 dB in the stopband. > >But I do tolerate a bit of aliasing in the very high frequencies > >to keep the impulse response short. > > I agree, as the assumption is the MEMS mic issues something like > a sigma-delta-modulated stream -- although this is nowhere specified, > it seems logical. Such bitstreams have a huge amount of energy in the > stopband, with a spectral density up there greater than in the > passband. > > An IIR filter with an order at least one greater than the order > of the S-D modulator is the baseline choice. If an FIR (Kaiser > would be a good place to start), it should equal or exceed the > performance of a suitable IIR. > > There are many good choices, it just seems we're in an information > vacuum trying to design this BHC. ** > > Steve > > ** Bat-Human Converter
fyi http://www.avisoft.com/ they used to have an interesting tutorial showing the effects of MP3 encoding via spectrographs , but I can no longer find it here m
On Tuesday, October 18, 2016 at 10:58:43 AM UTC-4, mako...@yahoo.com wrote:
> On Tuesday, October 18, 2016 at 10:38:24 AM UTC-4, Steve Pope wrote: > > SG <s.gesemann@gmail.com> wrote: > > > > >On Tuesday, October 18, 2016 at 2:06:25 AM UTC+2, Randy Yates wrote: > > > > >> If I'm looking at this right, a moving-average filter is going to > > >> be a really crappy filter for decimation. The quantization noise > > >> from the modulator, regardless of its specifics, is going to have > > >> significant power at frequencies the MA won't filter out, so it > > >> would alias back to baseband after decimation. I think. > > > > >You're right. A filter with a strong rejection is really important > > >here. The one I used has a rejection of 140 dB in the stopband. > > >But I do tolerate a bit of aliasing in the very high frequencies > > >to keep the impulse response short. > > > > I agree, as the assumption is the MEMS mic issues something like > > a sigma-delta-modulated stream -- although this is nowhere specified, > > it seems logical. Such bitstreams have a huge amount of energy in the > > stopband, with a spectral density up there greater than in the > > passband. > > > > An IIR filter with an order at least one greater than the order > > of the S-D modulator is the baseline choice. If an FIR (Kaiser > > would be a good place to start), it should equal or exceed the > > performance of a suitable IIR. > > > > There are many good choices, it just seems we're in an information > > vacuum trying to design this BHC. ** > > > > Steve > > > > ** Bat-Human Converter > > fyi > http://www.avisoft.com/ > > they used to have an interesting tutorial showing the effects of MP3 > encoding via spectrographs , but I can no longer find it here > > m
avaialble via the wayback machine https://web.archive.org/web/20070222044624/http://www.avisoft-saslab.com/compression.htm m