Electronic – Audio using PWM, what is the principle behind it

audiopcmpwm

I have seen a schematic of a PIC board which uses filtered PWM to provide audio output signal to an audio jack. It shows PWM output filtered using 3 stages of passive RC filter followed by an LM386 stage. I have the following questions:

  1. Usually an audio signal would have multiple frequencies summed up simultaneously. How does PWM do that?
  2. Is the audio quality as good as using PCM with DAC, filter and amplifier?
  3. Since this technique looks and is so convenient, why don't all audio devices use this to save money and cost, including sound cards in computers?

Best Answer

Usually an audio signal would have multiple frequencies summed up simultaneously. How does PWM do that?

The audio signal that contains a spectrum of multiple frequencies is still just an audio signal that can be sampled by and ADC and recreated by a DAC. Providing the sampling rate used is higher than twice the highest audio frequency then all is good. A DAC that uses PWM techniques is no different. In any one cycle of the PWM waveform, the ratio of mark-to-space must accurately "represent" the instantaneous analogue signal and a single PWM cycle must be shorter in time than half the period of the highest audio signal: -

enter image description here

The above is a simple representation of 3 DC levels using PWM. Clearly if the PWM frequency is "high" those three levels can be regarded as part of a complex AC waveform. Hopefully you can see that controlling the PWM mark-space ratio accurately is really fundamental to obtaining low audio distortion.

Is the audio quality as good as using PCM with DAC, filter and amplifier?

Traditionally no, but it's getting better.

Since this technique looks and is so convenient, why don't all audio devices use this to save money and cost, including sound cards in computers?

Controlling PWM ratio accuracy is quite difficult to get really good hi-fi quality and with class D amplifiers power supply rejection is still a pretty difficult challenge. See the embedded picture above - if the 5V power rail doubled then the gain also doubles - now imagine that instead of it simply doubling, you had a load of crappy noise on that rail - this would directly modulate your audio signal and create some very noticeable effects.