DSPRelated.com
Forums

How to convert from PDM to PCM ?

Started by Mauritz Jameson September 1, 2015
On Fri, 18 Dec 2015 07:41:18 -0800 (PST), angrydude
<simfidude@gmail.com> wrote:

>On Thursday, December 17, 2015 at 3:10:52 PM UTC-5, akanksha92 wrote: >> Hi angrydude, >> >> you have quoted in your response that there are some cheap electret mic >> capsules which give excellent performance at 40 kHz. Can you suggest such >> microphones, which are small in size. Actually, I need them for the >> purpose of creating a microphone array of total aperture length of say 40 >> mm with uniform spacing between each microphone. I intend to use 10 mics >> in an array. presently I trying to use Knowles Acoustics SPH0641LU4H-1 >> mics. >> >> The statement of my problem is similar to that mentioned by Mauritz >> Jameson. Just in my case I intend to detect object with the received >> echoes of the emitted ultrasonic signals. It will be great if you can help >> me. >> >> >> --------------------------------------- >> Posted through http://www.DSPRelated.com > >Panasonic WM-61A electret capsules will give you excellent response at 40 KHz >and they are tiny: > >http://www.wildlife-sound.org/equipment/technote/micdesigns/ultrasonic.html
I've also been a big fan of the WM-61A for high frequency work, but, alas, it has been discontinued by Panasonic. There's a fair amount of discussion on the Web about alternatives, but I haven't looked into this lately to see what products are the current favorites. Best regards, Bob Masta DAQARTA v8.00 Data AcQuisition And Real-Time Analysis www.daqarta.com Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, Pitch Track, Pitch-to-MIDI FREE 8-channel Signal Generator, DaqMusiq generator Science with your sound card!
On 12/19/2015 8:24 AM, Bob Masta wrote:
> On Fri, 18 Dec 2015 07:41:18 -0800 (PST), angrydude > <simfidude@gmail.com> wrote: > >> On Thursday, December 17, 2015 at 3:10:52 PM UTC-5, akanksha92 wrote: >>> Hi angrydude, >>> >>> you have quoted in your response that there are some cheap electret mic >>> capsules which give excellent performance at 40 kHz. Can you suggest such >>> microphones, which are small in size. Actually, I need them for the >>> purpose of creating a microphone array of total aperture length of say 40 >>> mm with uniform spacing between each microphone. I intend to use 10 mics >>> in an array. presently I trying to use Knowles Acoustics SPH0641LU4H-1 >>> mics. >>> >>> The statement of my problem is similar to that mentioned by Mauritz >>> Jameson. Just in my case I intend to detect object with the received >>> echoes of the emitted ultrasonic signals. It will be great if you can help >>> me. >>> >>> >>> --------------------------------------- >>> Posted through http://www.DSPRelated.com >> >> Panasonic WM-61A electret capsules will give you excellent response at 40 KHz >> and they are tiny: >> >> http://www.wildlife-sound.org/equipment/technote/micdesigns/ultrasonic.html > > I've also been a big fan of the WM-61A for high frequency > work, but, alas, it has been discontinued by Panasonic. > There's a fair amount of discussion on the Web about > alternatives, but I haven't looked into this lately to see > what products are the current favorites.
The ones I have looked at seem to be very similar. What are the advantages and disadvantages of the ones they like? I can see utility in a group with common interests picking one unit and sharing knowledge of various undocumented features. But I'd bet there isn't so much difference. I suppose if you are planning to use them for ultrasonic work it might be preferable to pick one that doesn't have the "ECM" capacitors that many have. They say this is to exclude GSM TDMA noise. What frequency would that be? -- Rick
On Saturday, December 19, 2015 at 12:03:56 PM UTC-5, rickman wrote:
> On 12/19/2015 8:24 AM, Bob Masta wrote: > > On Fri, 18 Dec 2015 07:41:18 -0800 (PST), angrydude > > <simfidude@gmail.com> wrote: > > > >> On Thursday, December 17, 2015 at 3:10:52 PM UTC-5, akanksha92 wrote: > >>> Hi angrydude, > >>> > >>> you have quoted in your response that there are some cheap electret mic > >>> capsules which give excellent performance at 40 kHz. Can you suggest such > >>> microphones, which are small in size. Actually, I need them for the > >>> purpose of creating a microphone array of total aperture length of say 40 > >>> mm with uniform spacing between each microphone. I intend to use 10 mics > >>> in an array. presently I trying to use Knowles Acoustics SPH0641LU4H-1 > >>> mics. > >>> > >>> The statement of my problem is similar to that mentioned by Mauritz > >>> Jameson. Just in my case I intend to detect object with the received > >>> echoes of the emitted ultrasonic signals. It will be great if you can help > >>> me. > >>> > >>> > >>> --------------------------------------- > >>> Posted through http://www.DSPRelated.com > >> > >> Panasonic WM-61A electret capsules will give you excellent response at 40 KHz > >> and they are tiny: > >> > >> http://www.wildlife-sound.org/equipment/technote/micdesigns/ultrasonic.html > > > > I've also been a big fan of the WM-61A for high frequency > > work, but, alas, it has been discontinued by Panasonic. > > There's a fair amount of discussion on the Web about > > alternatives, but I haven't looked into this lately to see > > what products are the current favorites. > > The ones I have looked at seem to be very similar. What are the > advantages and disadvantages of the ones they like? I can see utility > in a group with common interests picking one unit and sharing knowledge > of various undocumented features. But I'd bet there isn't so much > difference. I suppose if you are planning to use them for ultrasonic > work it might be preferable to pick one that doesn't have the "ECM" > capacitors that many have. They say this is to exclude GSM TDMA noise. > What frequency would that be? > > -- > > Rick
Pretty much all of the electret capsules, even the cheapest off-brands, will give good response at 40 KHz. However what matters for OP's application is mic size and consistency in manufacturing. Size - the smaller the better because with wavelength of 8 mm omni-directional localization will suffer with bigger size mics (e.g. bigger than wavelength) WM-61A are pretty small - less than 8 mm in diameter
On 12/21/2015 4:25 PM, angrydude wrote:
> On Saturday, December 19, 2015 at 12:03:56 PM UTC-5, rickman wrote: >> On 12/19/2015 8:24 AM, Bob Masta wrote: >>> On Fri, 18 Dec 2015 07:41:18 -0800 (PST), angrydude >>> <simfidude@gmail.com> wrote: >>> >>>> On Thursday, December 17, 2015 at 3:10:52 PM UTC-5, akanksha92 wrote: >>>>> Hi angrydude, >>>>> >>>>> you have quoted in your response that there are some cheap electret mic >>>>> capsules which give excellent performance at 40 kHz. Can you suggest such >>>>> microphones, which are small in size. Actually, I need them for the >>>>> purpose of creating a microphone array of total aperture length of say 40 >>>>> mm with uniform spacing between each microphone. I intend to use 10 mics >>>>> in an array. presently I trying to use Knowles Acoustics SPH0641LU4H-1 >>>>> mics. >>>>> >>>>> The statement of my problem is similar to that mentioned by Mauritz >>>>> Jameson. Just in my case I intend to detect object with the received >>>>> echoes of the emitted ultrasonic signals. It will be great if you can help >>>>> me. >>>>> >>>>> >>>>> --------------------------------------- >>>>> Posted through http://www.DSPRelated.com >>>> >>>> Panasonic WM-61A electret capsules will give you excellent response at 40 KHz >>>> and they are tiny: >>>> >>>> http://www.wildlife-sound.org/equipment/technote/micdesigns/ultrasonic.html >>> >>> I've also been a big fan of the WM-61A for high frequency >>> work, but, alas, it has been discontinued by Panasonic. >>> There's a fair amount of discussion on the Web about >>> alternatives, but I haven't looked into this lately to see >>> what products are the current favorites. >> >> The ones I have looked at seem to be very similar. What are the >> advantages and disadvantages of the ones they like? I can see utility >> in a group with common interests picking one unit and sharing knowledge >> of various undocumented features. But I'd bet there isn't so much >> difference. I suppose if you are planning to use them for ultrasonic >> work it might be preferable to pick one that doesn't have the "ECM" >> capacitors that many have. They say this is to exclude GSM TDMA noise. >> What frequency would that be? >> >> -- >> >> Rick > > Pretty much all of the electret capsules, even the cheapest off-brands, will give good response at 40 KHz. > However what matters for OP's application is mic size and consistency in manufacturing. > Size - the smaller the better because with wavelength of 8 mm omni-directional localization will suffer with bigger size mics (e.g. bigger than wavelength) > > WM-61A are pretty small - less than 8 mm in diameter
Every one I saw was 8 mm or smaller. -- Rick
On Monday, December 21, 2015 at 7:11:41 PM UTC-5, rickman wrote:
> On 12/21/2015 4:25 PM, angrydude wrote: > > On Saturday, December 19, 2015 at 12:03:56 PM UTC-5, rickman wrote: > >> On 12/19/2015 8:24 AM, Bob Masta wrote: > >>> On Fri, 18 Dec 2015 07:41:18 -0800 (PST), angrydude > >>> <simfidude@gmail.com> wrote: > >>> > >>>> On Thursday, December 17, 2015 at 3:10:52 PM UTC-5, akanksha92 wrote: > >>>>> Hi angrydude, > >>>>> > >>>>> you have quoted in your response that there are some cheap electret mic > >>>>> capsules which give excellent performance at 40 kHz. Can you suggest such > >>>>> microphones, which are small in size. Actually, I need them for the > >>>>> purpose of creating a microphone array of total aperture length of say 40 > >>>>> mm with uniform spacing between each microphone. I intend to use 10 mics > >>>>> in an array. presently I trying to use Knowles Acoustics SPH0641LU4H-1 > >>>>> mics. > >>>>> > >>>>> The statement of my problem is similar to that mentioned by Mauritz > >>>>> Jameson. Just in my case I intend to detect object with the received > >>>>> echoes of the emitted ultrasonic signals. It will be great if you can help > >>>>> me. > >>>>> > >>>>> > >>>>> --------------------------------------- > >>>>> Posted through http://www.DSPRelated.com > >>>> > >>>> Panasonic WM-61A electret capsules will give you excellent response at 40 KHz > >>>> and they are tiny: > >>>> > >>>> http://www.wildlife-sound.org/equipment/technote/micdesigns/ultrasonic.html > >>> > >>> I've also been a big fan of the WM-61A for high frequency > >>> work, but, alas, it has been discontinued by Panasonic. > >>> There's a fair amount of discussion on the Web about > >>> alternatives, but I haven't looked into this lately to see > >>> what products are the current favorites. > >> > >> The ones I have looked at seem to be very similar. What are the > >> advantages and disadvantages of the ones they like? I can see utility > >> in a group with common interests picking one unit and sharing knowledge > >> of various undocumented features. But I'd bet there isn't so much > >> difference. I suppose if you are planning to use them for ultrasonic > >> work it might be preferable to pick one that doesn't have the "ECM" > >> capacitors that many have. They say this is to exclude GSM TDMA noise. > >> What frequency would that be? > >> > >> -- > >> > >> Rick > > > > Pretty much all of the electret capsules, even the cheapest off-brands, will give good response at 40 KHz. > > However what matters for OP's application is mic size and consistency in manufacturing. > > Size - the smaller the better because with wavelength of 8 mm omni-directional localization will suffer with bigger size mics (e.g. bigger than wavelength) > > > > WM-61A are pretty small - less than 8 mm in diameter > > Every one I saw was 8 mm or smaller. > > -- > > Rick
They are different in size though http://www.ebay.com/itm/Electret-Condenser-Microphone-Cartridge-Mic-Element-Various-Cardioid-and-Omni-/120807337827
On 12/21/2015 9:33 PM, angrydude wrote:
> On Monday, December 21, 2015 at 7:11:41 PM UTC-5, rickman wrote: >> On 12/21/2015 4:25 PM, angrydude wrote: >>> On Saturday, December 19, 2015 at 12:03:56 PM UTC-5, rickman wrote: >>>> On 12/19/2015 8:24 AM, Bob Masta wrote: >>>>> On Fri, 18 Dec 2015 07:41:18 -0800 (PST), angrydude >>>>> <simfidude@gmail.com> wrote: >>>>> >>>>>> On Thursday, December 17, 2015 at 3:10:52 PM UTC-5, akanksha92 wrote: >>>>>>> Hi angrydude, >>>>>>> >>>>>>> you have quoted in your response that there are some cheap electret mic >>>>>>> capsules which give excellent performance at 40 kHz. Can you suggest such >>>>>>> microphones, which are small in size. Actually, I need them for the >>>>>>> purpose of creating a microphone array of total aperture length of say 40 >>>>>>> mm with uniform spacing between each microphone. I intend to use 10 mics >>>>>>> in an array. presently I trying to use Knowles Acoustics SPH0641LU4H-1 >>>>>>> mics. >>>>>>> >>>>>>> The statement of my problem is similar to that mentioned by Mauritz >>>>>>> Jameson. Just in my case I intend to detect object with the received >>>>>>> echoes of the emitted ultrasonic signals. It will be great if you can help >>>>>>> me. >>>>>>> >>>>>>> >>>>>>> --------------------------------------- >>>>>>> Posted through http://www.DSPRelated.com >>>>>> >>>>>> Panasonic WM-61A electret capsules will give you excellent response at 40 KHz >>>>>> and they are tiny: >>>>>> >>>>>> http://www.wildlife-sound.org/equipment/technote/micdesigns/ultrasonic.html >>>>> >>>>> I've also been a big fan of the WM-61A for high frequency >>>>> work, but, alas, it has been discontinued by Panasonic. >>>>> There's a fair amount of discussion on the Web about >>>>> alternatives, but I haven't looked into this lately to see >>>>> what products are the current favorites. >>>> >>>> The ones I have looked at seem to be very similar. What are the >>>> advantages and disadvantages of the ones they like? I can see utility >>>> in a group with common interests picking one unit and sharing knowledge >>>> of various undocumented features. But I'd bet there isn't so much >>>> difference. I suppose if you are planning to use them for ultrasonic >>>> work it might be preferable to pick one that doesn't have the "ECM" >>>> capacitors that many have. They say this is to exclude GSM TDMA noise. >>>> What frequency would that be? >>>> >>>> -- >>>> >>>> Rick >>> >>> Pretty much all of the electret capsules, even the cheapest off-brands, will give good response at 40 KHz. >>> However what matters for OP's application is mic size and consistency in manufacturing. >>> Size - the smaller the better because with wavelength of 8 mm omni-directional localization will suffer with bigger size mics (e.g. bigger than wavelength) >>> >>> WM-61A are pretty small - less than 8 mm in diameter >> >> Every one I saw was 8 mm or smaller. >> >> -- >> >> Rick > > They are different in size though > > http://www.ebay.com/itm/Electret-Condenser-Microphone-Cartridge-Mic-Element-Various-Cardioid-and-Omni-/120807337827
Not sure what your point is? -- Rick
As per my experience most digital microphones with PDM outputs use a
2nd-order delta-sigma modulator inside, so the noise is rising by 12
db/octave. Usually the rising a/d noise "crosses over" the thermal noise
of the mic preamp near the top of the audio band. 
It is conventional to use sinc filters where the order of the sinc is one
higher than the order of the modulator so that the noise is dropping gas a
function of frequency. 


---------------------------------------
Posted through http://www.DSPRelated.com
This thread has been silent for almost 2 years, but I prefer to post here
before starting a new thread. 

I'm working with an FPGA board (Nexys 4) which has an integrated PDM 
microphone and a PDM audio output. I would like to prepare a HW design
project for my students that implements some basic audio DSP. A demo
project is available for the board so that the first steps consist on just
tweaking the demo and "hear" what happens. 

Firstly, I need to check that I can convert from PDM to PCM and the other
way around. Unfortunately, I get an annoying hiss. The PDM sampling
frequency is 3 MHZ. Downsampling by a large factor (lets say 4096) greatly
reduces the bandwidth so that my voice sounds severely distorted.
Therefore I chose a 64 factor. 

This is the setup: At the microphone side, I accumulate 64 samples
obtaining a 6-bit unsigned PCM value (I ignore the first sample in a
series of 64 so that the results fits in 6 instead of 7 bits). This is my
way to implement a low-pass filter. 

The demo project saves those values in RAM and sends it later to the
speaker side. I've checked that this part works fine.

Now, at the speaker side I have to convert every PCM sample to a series of
64 PDM pulses. I do so by using the following algorithm (of course, I
actually use VHDL): 

error = 32;

for n=1 to number of samples
  value = sample[n]
  for i=1 to 64
    sub = value - error
    if sub < 0 then 
       pdm_o = 0
       error = 64 + sub
    else
       pdm_o = 1
       error = sub
    end if
  next i
next n 

Despite I can record and hear my voice with a decent quality, there is an
annoying hiss in the background at a quite loud level. In order to isolate
the error source, I fed the PCM-PDM converter with a synthetic 460 Hz
signal. I can here the signal but the hiss is still there. To save you the
maths, the period of the 460 Hz signal consists of 128 samples ranging
from 0 to 63. Each sample will be converted to 64 PDM pulses.

I also tested the algorithms in my computer, but I assumed I large
sampling ratio. Basically, I took good quality audio and convert every
16-bit PCM sample to 64, 1024 or 4096 PDM pulses. Then, I accumulated the
PDM pulses and scaled them in order to obtain a PCM value again. The sound
quality was fine, with a hiss at low sampling rates. Of course, I was
actually using an unrealistic sampling rate in most cases. 

My DSP knowledge is quite limited, so I don't know what I'm doing wrong.
The PDM to PCM procedure seems to be ok. Reading the posts in this thread
I suspect that some noise is added somewhere and I should filter the PCM
signal before converting to PDM. Can anyone shed some light on this topic?


By the way, I'm willing to share the resulting VHDL project. 

Best,

Roberto



---------------------------------------
Posted through http://www.DSPRelated.com
Your method of decimation only implements a first-order sincx roll-off followed by 64x decimation. The modulator used inside the microphone is at least 2nd order (noise floor rising at 12db/ octave) if not more, so your first-order filter is not adequate and the out-of-band noise will fold into the pass-band. 
Likewise your modulator is only 1st-order so it will not adequately suppress the noise caused by 1-bit quantization. 
The Hoganour CIC filters referenced earlier in this thread are the cheapest decent filter you can build and the vhdl code is probably less than 20 lines. 

Bob
N&#4294967295;&#4294967295;&#4294967295;&#4294967295;*.&#4294967295;)&#1865;&#429;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#534;&#4294967295;$y&#4294967295;&#4294967295;)&#2018;&#4294967295;&#482;&#4294967295;j&#4294967295;&#4294967295;&#4294967295;&#4294967295;[^&#4294967295;&#425;&#4294967295;X&#4294967295;v&#4294967295;&#430;v*&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;jx&#4294967295;&#4294967295;W&#4294967295;z{Z&#4294967295;*'~&#4294967295;&#1714;f&#4294967295;&#4294967295;#&#1286;&#4294967295;i&#4294967295;&#4294967295;&#1850;&#4294967295;&#4294967295;&#4294967295;&#491;r&#4294967295;&#4294967295;*&#4294967295;zx&#4294967295;o&#4294967295;&#4294967295;^&#4294967295;_&#4294967295;&#4294967295;&#4294967295;]&#4294967295;)&#1718;)&#4294967295;r&#4294967295;&#4294967295;&#4294967295;"&#4294967295;&#4294967295;^&#4294967295;&#4294967295;&#4294967295;y&#1581;k]&#4294967295;&#4294967295;&#1500;&#4294967295;f&#4294967295;&#4294967295;&#4294967295;&#11370;i&#4294967295;'&#4294967295;N&#4294967295; '&#4294967295;&#1515;y&#4294967295;&#1686;&#4294967295;j&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;v)&#4294967295;&#423;v&#4294967295;Z&#4294967295;&#4294967295;[i&#4294967295;~&#1515;&#4294967295;&#4294967295;&#1906;&#4294967295;k&#4294967295;&#4294967295;!&#4294967295;&#4294967295;&#4294967295;&#4294967295;1&#4294967295;'&#4294967295;&#4294967295;&#4294967295;z&#4294967295;&#4294967295;z&#4294967295;&#4294967295;"&#4294967295;b&#4294967295;B"&#4294967295;&#4294967295;^&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;r&#4294967295;r"&#4294967295;b&#4294967295;X&#4294967295;&#4294967295;^&#4294967295;&#4294967295;&#4294967295;&#4294967295;+,i&#4294967295;^&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;1&#4294967295;'&#4294967295;&#4294967295;&#49801;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;g&#4294967295;&#4294967295;*'y&#4294967295;(&#4294967295;&#4294967295;&#4294967295;&#4294967295;)&#3459;&#4294967295;1&#4294967295;&#4294967295;&#807;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;1&#4294967295;l&#4294967295;&#4294967295;h&#4294967295;&#4294967295;m&#4294967295;&#4294967295;a&#4294967295;&#4294967295;&#137;&#4294967295;z&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;h<3&#4294967295;
+&#4294967295;&#4294967295;f&#4294967295;&#4294967295;+&#4294967295;x"&#4294967295;&#4294967295;&{&#4294967295;>&#4294967295;-y&#4294967295;a&#4294967295;&#4294967295;&#4294967295;&#4294967295;m&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;=&#4294967295;j&#1501;r&#4294967295;