audio power amplifiers pwm from dutch
here's a quick explanation.. hope it helps!
ok there are two ways that this is done.. PWM and PFM.. PWM is pulse width modulation - frequency is constant, much higher than the 20kHz upper limit of the ear. let's say 500kHz. If you have a steady signal, you will get a duty cycle that is equivalent to your voltage..
for example:
max output voltage of the system is 10v.. If your input signal is 1v, a class d amp is making 500kHz square waves at 10% duty cycle - full on for 10% of the time, full off for 90%. Into a slow network like the ear or a LRC of a speaker, this seems like just 1v.. Opposite side, if you have 9v signal, the PWM will be banging out square waves at 90% duty cycle, which equates to 9/10 or 9v..
To make a 1v-9v sine, you sweep from 10% to 90% duty and back again. The triangle wave explanation is a pretty good analogy, but I like saw waves..
take a comparator.. on one input you put your music or whatever, we will pretend it's a perfect sine wave from 0-10v (or 0-1v who cares!). On the other, you put a saw wave.. 500kHz, it ramps from 0-10 500k times a second. Every time the input is HIGHER than the saw, your comparator is on, giving a 1 output. when the saw ramps up to be higher (at 9v for the peak of the 1-9v sine) the comparator turns off.
Since it does this ramp 500k time a second, you get short pulses (10% duty) for low input signal like 1v, and long pulses (90% duty) for high input signal like 9v. as your music input wiggles up and down, this comparator keeps changing the duty cycle to match the input.
I'm sure you see a diagram like this when you learn about switchers or class D amps.. The reason it is very efficient is because you don't have to treat your power mosfet like a resisitor, varying the gate with the signal and wasting lots of power. In class D, you turn your power mosfet on all the way (maybe only 50mOhm RdsOn) for a little while, then turn it off completely once the saw wave passed the input signal. VERY NICE for minimizing switch loss!!!
PFM is pulse frequency modulation.. This guy only pulses for a very small fixed time (say 500ns - fastest output freq is 1MHZ) but when input is 9v, we are pulsing very very quickly over and over - again seems like 90% duty cycle, just made of many tiny pulses. 10% duty cycle for 1v output gives us the same size pulses, but farther apart.
PWM is much easier to implement, I don't know whether anyone has even made a PFM audio amp.. It's a more wasteful system but easier to control. It seems like PWM should be easiest, but you can run into trouble at high frequency if your signal to compare to has to go thru a slow network like a cheap amplifier or long wires. Now your PWM compares to something slow, and this mistake makes the next cycle have a bigger mistake. No way to escape this spiral once you hit it, but for audio you will never even see this case, 20kHz is no problem unless you have a mile of wire, or use 30kHz switcher (saw) frequency - below nyquist criterion (need at least 2x base frequency)
I say run the saw at 1-2MHz, you will have an extremely smooth system. Now your problem is the fact that headphones are inductors! All this switching will give you kickback ringing when you switch into an inductor. You can add a cheap RC filter between the switcher output and the speaker to make the speaker see DC, or there are more complicated, more "perfect" designs that compensate..
OK now i hope the tutorials take over.. Ask any questions if this seems confusing! Good luck!