PWM, PAM, PCM sine generation and usage confusion

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
3
down vote

favorite












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



 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



 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?







share|improve this question






















  • You have missed one thing : low-pass filter.
    – Long Pham
    Aug 17 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?
    – Hypomania
    Aug 17 at 17:19






  • 1




    I think the speaker itself and our ears are crude low pass filters
    – Long Pham
    Aug 17 at 17:25






  • 2




    The inertia of the speaker diaphragm provides lowpassfilter.
    – analogsystemsrf
    Aug 17 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.
    – Michael
    Aug 17 at 17:37
















up vote
3
down vote

favorite












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



 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



 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?







share|improve this question






















  • You have missed one thing : low-pass filter.
    – Long Pham
    Aug 17 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?
    – Hypomania
    Aug 17 at 17:19






  • 1




    I think the speaker itself and our ears are crude low pass filters
    – Long Pham
    Aug 17 at 17:25






  • 2




    The inertia of the speaker diaphragm provides lowpassfilter.
    – analogsystemsrf
    Aug 17 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.
    – Michael
    Aug 17 at 17:37












up vote
3
down vote

favorite









up vote
3
down vote

favorite











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



 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



 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?







share|improve this question














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



 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



 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?









share|improve this question













share|improve this question




share|improve this question








edited Aug 17 at 17:17

























asked Aug 17 at 17:01









Hypomania

30910




30910











  • You have missed one thing : low-pass filter.
    – Long Pham
    Aug 17 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?
    – Hypomania
    Aug 17 at 17:19






  • 1




    I think the speaker itself and our ears are crude low pass filters
    – Long Pham
    Aug 17 at 17:25






  • 2




    The inertia of the speaker diaphragm provides lowpassfilter.
    – analogsystemsrf
    Aug 17 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.
    – Michael
    Aug 17 at 17:37
















  • You have missed one thing : low-pass filter.
    – Long Pham
    Aug 17 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?
    – Hypomania
    Aug 17 at 17:19






  • 1




    I think the speaker itself and our ears are crude low pass filters
    – Long Pham
    Aug 17 at 17:25






  • 2




    The inertia of the speaker diaphragm provides lowpassfilter.
    – analogsystemsrf
    Aug 17 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.
    – Michael
    Aug 17 at 17:37















You have missed one thing : low-pass filter.
– Long Pham
Aug 17 at 17:18




You have missed one thing : low-pass filter.
– Long Pham
Aug 17 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?
– Hypomania
Aug 17 at 17:19




@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?
– Hypomania
Aug 17 at 17:19




1




1




I think the speaker itself and our ears are crude low pass filters
– Long Pham
Aug 17 at 17:25




I think the speaker itself and our ears are crude low pass filters
– Long Pham
Aug 17 at 17:25




2




2




The inertia of the speaker diaphragm provides lowpassfilter.
– analogsystemsrf
Aug 17 at 17:26




The inertia of the speaker diaphragm provides lowpassfilter.
– analogsystemsrf
Aug 17 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.
– Michael
Aug 17 at 17:37




Isn’t a PWM basically an 1 bit DAC? With enough oversampling and a low-pass filter you can use it for audio.
– Michael
Aug 17 at 17:37










2 Answers
2






active

oldest

votes

















up vote
6
down vote



accepted











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.






share|improve this answer




















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

















up vote
3
down vote













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.






share|improve this answer




















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











Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");

StackExchange.ifUsing("editor", function ()
return StackExchange.using("schematics", function ()
StackExchange.schematics.init();
);
, "cicuitlab");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "135"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f391545%2fpwm-pam-pcm-sine-generation-and-usage-confusion%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
6
down vote



accepted











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.






share|improve this answer




















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














up vote
6
down vote



accepted











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.






share|improve this answer




















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












up vote
6
down vote



accepted







up vote
6
down vote



accepted







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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Aug 17 at 17:26









Andy aka

228k9167384




228k9167384











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
















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















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




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












up vote
3
down vote













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.






share|improve this answer




















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















up vote
3
down vote













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.






share|improve this answer




















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













up vote
3
down vote










up vote
3
down vote









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.






share|improve this answer












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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Aug 17 at 17:27









Kevin Reid

4,94611633




4,94611633











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

















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
















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





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


















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f391545%2fpwm-pam-pcm-sine-generation-and-usage-confusion%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

List of Gilmore Girls characters

Confectionery