I am no expert in class D amplifier design. My career has been (mostly) low-level signals and, except for some DIY stuff many years ago, my class D work has been at RF including delta-sigma D/A converters with high-power (for GHz RF) output stages. I'll take a stab at it but more learned engineers may correct my discussion.
Class D amps usually have an analog input modulated to produce a PWM output. Below is the basic concept (see Wikipedia reference). The input signal is applied to a comparator (C) that switches between high and low depending on if the input is above or below the triangle wave. If it was just a DC (static) 0-V input instead of a triangle wave, you'd just get a square wave at the output at the signal frequency. If the DC (bottom) input was moved up and down, you'd get rectangular waves, still at the same frequency, with with different pulse width. The triangle generator means the pulse width varies with (modulates) the signal and thus you get a PWM output signal. The switching controller ensures the top and bottom output devices do not turn on at the same time -- that would short the +/- power rails with all the problems that implies. That also means there is a small "dead zone" when neither device is on during the switching phase. How much that matters depends upon how fast you switch, how large the dead zone (hysteresis), etc. Usually not a big deal in practice for audio amps now that switching frequencies have gotten well above the audio band.
View attachment 21623
https://en.wikipedia.org/wiki/Class-D_amplifier
This is what happens if we replace the triangle generator with a DC voltage above, at, and below the center point of the input signal (assumed 0 V):
View attachment 21614
The frequency is the same but the pulse width changes (assuming a fixed input frequency).
Feedback can be (and is) applied at several places. You can treat the blocks from the input to the speaker as an analog power amp (it is, technically) and then stick an input buffer (op-amp) in front and take the feedback from the output just like any other amplifier:
View attachment 21622
Making this stable means keeping the delay through the amp low enough and switching frequency high enough that the amp circuitry and output low-pass filter does not add too much phase shift. That was one of the biggest problems with early designs; the switching frequency was fairly low, so the output filter had to roll off just above the audio band, and that caused a lot of phase shift in the audio band itself. Too much phase shift and the feedback is in phase with the input so now it adds instead of subtracts and you have built an oscillator. A very powerful, speaker-eating oscillator. Switching frequencies have gotten much higher so this circuit can work well and is, I suspect, still the main compensation network for most of today's amplifiers.
An interesting approach is to take the feedback from point 2 back to point 1. That does a comparison of the output pulse before the filter to the digital input signal. It will not compensate for nonlinearity (distortion) in the input buffer, comparator, or output filter, but solves the phase lag problem of the output filter. I have only seen that used on low-frequency motor controllers and such where great linearity is not required (and sometimes the motor itself is the output filter).
Adding feedforward compensation is more prevalent today, at least in the very few schematics I have seen (remember this is
not my day job). In this scheme some of the input signal is "fed forward" to the output to help bypass the switching stages and output filter. The output buffer is often a low-power class A or AB amplifier that handles not only error correction but also provides most of the output for low-level signals. You have to align the phase of the feed-forward circuit to the main signal path, of course, to add the right amount of feedforward compensation at the right time. Again, I do not know, but suspect many modern class D audio amplifiers are using this sort of approach. Some call it a hybrid design due to the class A/AB output driver.
View attachment 21621
Other schemes put switching output stages in parallel so the effective switching rate is much higher, use more complex generators to create PWM/PFM and other output signals, and so forth. Too complicated for one post.
HTH - Don