Maker Pro
Maker Pro

Class D audio amp

Nanren888

Nov 8, 2015
622
Joined
Nov 8, 2015
Messages
622
But the shift is constant from pulse to pulse so show me how that creates distortion.
I'm not sure whether this is what WHONOES meant, but here's one view of the difference.
upload_2022-4-23_6-31-48.png
The first two plots show two cases of a triangle threshold waveform. The first with an instantaneous signal level of 0.0; the second with signal level 0.5.
The purple trace shows the fundamental of the resulting PWM waveform. We assume that the sampling and filtering is good, so all harmonics above fundamental are to be ignored. The change in siganal level is seen to affect the magnitude of the fundamental, as we would expect and does not affect the phase of the fundamental.
The second two plots show the same conditions with a sawtooth. Here the phase of the fundamental can be seen to shift with the signal level, as pointed out, as one end of the PWM output is fixed in time, a regular, uniform sampling time. So the phase of the fundamental changes with signal instantaneous level.
I have not tried to quantify what level of distortion this phase shift would mean for different input waveforms. Seems it could be argued that for adequately over-sampled waveforms (that is no "rapid" level changes) and some applications some phase distortion could be tollerated.
.
Another aside: I also remember that some implementations tended to add the threshold waveform to the signal and then have a comparator to a constant threshold level. Can't remember whether having a constant threshold into the comparator was significant or for what subtle reason.
 

crutschow

May 7, 2021
839
Joined
May 7, 2021
Messages
839
Because of oversampling, I think any of that small PWM phase-shift from sample to sample would not be audible, as it's occurring at ultrasonic frequencies, and would be filtered out by the output PWM filter.
But I'm willing to be proved otherwise.
 

HANKMARS

Jul 28, 2019
498
Joined
Jul 28, 2019
Messages
498
How does whether its a triangle or a sawtooth affect the duty-cycle accuracy of the square-wave?
Either a triangle or a sawtooth will generate a 50% duty-cycle when the modulation input is 1/2 the PP voltage of either wave-shape.
I think I understand what you are saying here. As the sawtooth starts upward from -s it is out of comparator = -V. When sawtooth crosses Vref, comparator out = +V. However, sawtooth V+ to V- is not instantaneous and I can see how distortion could be created. A triangle wave would eliminate that "don't care" (x) state of no man's land, even though it may be only a few ns. This is a guess on my part.
 

HANKMARS

Jul 28, 2019
498
Joined
Jul 28, 2019
Messages
498
How does whether its a triangle or a sawtooth affect the duty-cycle accuracy of the square-wave?
Either a triangle or a sawtooth will generate a 50% duty-cycle when the modulation input is 1/2 the PP voltage of either wave-shape.
You are most likely correct about this. I was envisioning a high speed crossover "squeak" ( all but eliminated in a quality device ) but even if a distortion was generated at the high freq rate, it would be negated in the low pass output filter.
 
Top