# PWM, PAM, PCM sine generation and usage confusion

I am confused about something fundamental regarding PWM, PAM and PCM. I am going to be using a speaker's driver analogy to explain my point. As far as I know motors use PWM for power input, I don't know if my scenario with the speaker is any different but that's where it all began from.

As far as I know some DAC's convert digital signal to analogue signal using PCM. So you have pulses varying in amplitude being used as a carrier to represent a quantized signal (Fig. 1). That signal is then passed through a low-pass filter to interpolate the discrete pulses and get rid of the high frequency carrier. We feed the reconstructed signal into the speaker and we get clear audio.

                                          Figure 1

Then we've got PWM with varying duty cycle (Fig. 2). Let's assume it's Vhigh is 1V and its Vlow is -1V. By varying the pulse width in a certain order we can get a desired signal (a sinusoidal in this case) as we can calculate the average voltage of each cycle: Vavg = D*Vhigh + (1-D)*Vlow, where D is the duty cycle. The result is a choppy sine wave but a sine wave nevertheless.

                                          Figure 2

Now, this is where I am getting confused, sounds like a paradox to me. If I fed a PWM signal from Figure 2 into the speaker, what would happen? Would I hear a sine tone or the speaker popping as if it was being pushed back and forth? I understand that the average voltage comes to a sine wave, but if I connected an oscilloscope to the signal's output I would see a PWM, so what outcome would I get without any filtering or interpolation?

Similar thing with PAM, if we have 50% duty cycle and PAM pulses in a sequence of a sine wave, what would the speaker output, a tone or a popping noise?

• You have missed one thing : low-pass filter. Aug 17, 2018 at 17:18
• @LongPham, I understand the use of LPF's in such circuits, I am talking about pure PWM signal modulating a sine wave without any external RLC components. Would it work? Aug 17, 2018 at 17:19
• I think the speaker itself and our ears are crude low pass filters Aug 17, 2018 at 17:25
• The inertia of the speaker diaphragm provides lowpassfilter. Aug 17, 2018 at 17:26
• Isn’t a PWM basically an 1 bit DAC? With enough oversampling and a low-pass filter you can use it for audio. Aug 17, 2018 at 17:37

Would I hear a sine tone or the speaker popping as if it was being pushed back and forth?

Usually, for audio, the PWM frequency is substantially above 20 kHz (and usually above 100 kHz) so the speaker (if directly connected to the PWM signal) would reconstruct the audio on the cone because it has mass and cannot move the cone at the PWM rate. In other words the speaker acts as a low pass filter. However, the PWM frequency may still produce cone movements that can annoy bats/animals but a human wouldn't hear this.

But, there will be energy lost in the speaker due to the raw signal being applied and this may not be negligible hence, an inductor/capacitor low pass filter is chosen that removes the PWM "carrier" content.

The same applies to a motor - a motor isn't usually as "agile" as a speaker and may be operated at a PWM frequency in the low kHz range but it can still present a problem with over-heating when connected to the "raw" PWM signal so extra low pass filtering is sometimes employed.

Similar thing with PAM/PCM, if we have 50% duty cycle and PAM pulses in a sequence of a sine wave, what would the speaker output, a tone or a popping noise?

Again, the answer is similar; the "digital noise" is almost certainly at a much higher frequency than audio so some filtering may be required but it won't affect the sound quality or the sound produced if the PCM frequency is high enough.

• Extremely simple and clear answer, thank you for making it crystal clear! Aug 17, 2018 at 17:29

Your Figure 2 must be assuming some kind of filtering — somewhere in the system there is an analog low-pass filter which takes the PWM and converts it to the more sine-like result.

However, that filter does not need to be an explicit component of the system. Speakers and electric motors both have inductance (and mechanical inertia which basically adds to the inductance) which acts as a filter. The cost of doing this directly is that there will be vibrations (therefore acoustic noise and wasted power) at the PWM frequency. In a motor driver, this is often taken as an acceptable side effect; in a speaker system you must use a separate filter or ensure that the PWM frequency and hence the noise is ultrasonic, or both.

• Thank you for your answer and confirming my predictions! You added some very good points to the first answer. Aug 17, 2018 at 17:32

You got the concept of digital amps.

They amplify the PWM instead of converting it into analog.

You can not feed it directly into an speaker, but put an LC in between and Tada, you have music.

So by filtering the PWM Signal with LCs, you get a nice analog you can feed your speaker with.

As the signal stays digital until the very last moment, digital amps, In theory, have higher sound quality. But this is only true if you don't Squeeze too much power out of them, otherwise the MOSFET no longer switch fast enough and "cut corners", literally, which causes distortion.

So until a certain power level (According to Sony the limit is 250mW @ 16Ω), you have superior sound quality, given that the rest of the circuit also uses the best possible components (good capacitors, large LCs, high quality solder and so on)