• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Class D Amplifiers 101

cjm2077

Active Member
Joined
Jan 22, 2020
Messages
160
Likes
261
While GaN FETs can be operated up to 100A, 200V, and 100MHz switching frequency, still, no class-d amp either Silicon-based or GaN-based, ever exceeded the 1MHz switching frequency barrier due to diver limitations and output low pass filter for high design problems for very high switching frequency (no inductor can handle more than 1MHz, due to stray capacitance and non-linearity and core losses). GaN has many advantages. No body diode, meaning no reverse recovery issues, lower Rdson resistance, meaning infinite damping factor and near 99% efficiency, and low outout/input capacitance (Coss), meaning very high switching frequency, which means virtually zero harmonic distortion.

Once ultra-high frequency inductors and gate drivers become available, all audio amps will be based on GaN class-d. A small lightweight class-d amp can deliver 2000W continuous power into 2 ohms without the need of a heatsink if based on GaN FETs.

It will take another decade for a 2000W 0.00001% THD 120db SINAD class-d amp, which easily outperforms D'agostino's relentless 250,000$ 400lb crap amp, to become available on Aliexpress for about 200$...

I've designed and built GaN Fet class D amps that ran at almost 7 MHz. But it was not for an audio range product. I couldn't really find a good ferrite to use for the inductors because of the size and values we wanted didn't work with the permeabilities available, so we had to go with carbonyl iron cores, which definitely were lossier, but they worked. Depending on what values and power handling you need, you can make inductors at that frequency range with ferrite. We definitely needed heatsinks even at a 50W output because the package sizes we got from EPC that have the best inductance values are tiny. At the time we were driving them from a micro controller PWM output, but now there are drivers that are capable of doing those frequencies and more. It may take some time for it to trickle down to home audio, but it will happen. There may be small heatsinks on some parts, but there wouldn't be a need for a huge heatsinks on high wattage amps. The switched capacitances are small as you noted, so the vast majority of losses are from the on resistance, and those are down in the single digit mOhm range on the highest current parts. But there is always a trade between the capacitances and the Rdson for a given technology, it's basically like you're putting more of them in parallel.
 

SIY

Grand Contributor
Technical Expert
Joined
Apr 6, 2018
Messages
10,511
Likes
25,356
Location
Alfred, NY

onix

Member
Joined
Aug 9, 2020
Messages
8
Likes
2
Thanks for the wonderful write-up, Don. As I'm new to the DIY scene, the revelation of feedback to make accommodations is interesting, but makes sense. It reminds me of oversampled 1-bit delta-sigma A/D topologies from decades back.

Your schematic suggests that the Vin going into the opamp would not have a current draw. But I keep reading that a pre-amp could (may) be needed for the input of the Class D, where the pre-amp provides a power gain of 10~13dB, e.g. https://vtvamplifier.com/frequently-asked-questions/

So for practical purposes, would I need an intermediate pre-amp if I were outputting a signal from a mobile phone 3.5mm jack into the Class D, which then drives my 8ohm speakers? Or from a DAC?
 
Last edited:
OP
DonH56

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,915
Likes
16,746
Location
Monument, CO
Thanks for the wonderful write-up, Don. As I'm new to the DIY scene, the revelation of feedback to make accommodations is interesting, but makes sense. It reminds me of oversampled 1-bit delta-sigma A/D topologies from decades back.

Your schematic suggests that the Vin going into the opamp would not have a current draw. But I keep reading that a pre-amp could (may) be needed for the input of the Class D, where the pre-amp provides a power gain of 10~13dB, e.g. https://vtvamplifier.com/frequently-asked-questions/

So for practical purposes, would I need an intermediate pre-amp if I were outputting a signal from a mobile phone 3.5mm jack into the Class D, which then drives my 8ohm speakers? Or from a DAC?

You're welcome.

While the output pulse train looks similar, everything before that is very different in a delta-sigma DAC (or ADC), at least at the architectural/circuit level. But delta-sigma designs dominate the audio world today, and the basic 1-bit approach (updated) is still around for things like DSD.

Class D (or any other class) audio amplifiers are not my day job so I'm not really competent to answer your question about the input buffer. In general any power amp needs an additional gain stage or two before the output and class D is no different. Most manufacturers include an input gain stage, but some allow you to roll your own. Either way, the thing to look at is how much voltage your phone or DAC can output, compared to the input voltage required to drive the amplifier to rated output (or enough output to play as loudly as you'd ever want). A preamp can also offer additional gain control to optimize noise and distortion through the signal chain and may include source selection (switches) so you can choose between your phone and DAC, and/or among other sources.

So, it depends... My guess is you'd want one for the phone, maybe for the DAC...

HTH - Don
 
  • Like
Reactions: PSO

onix

Member
Joined
Aug 9, 2020
Messages
8
Likes
2
You're welcome.

While the output pulse train looks similar, everything before that is very different in a delta-sigma DAC (or ADC), at least at the architectural/circuit level. But delta-sigma designs dominate the audio world today, and the basic 1-bit approach (updated) is still around for things like DSD.

Not having read the patents, I suspect that the one-bit multi-order noise-shaping employed in DAC's is also behind the internals of the class D output driving the FET's ;) I would be *really* surprised if that wasn't the case.

DonH56 said:
Class D (or any other class) audio amplifiers are not my day job so I'm not really competent to answer your question about the input buffer. In general any power amp needs an additional gain stage or two before the output and class D is no different. Most manufacturers include an input gain stage, but some allow you to roll your own. Either way, the thing to look at is how much voltage your phone or DAC can output, compared to the input voltage required to drive the amplifier to rated output (or enough output to play as loudly as you'd ever want). A preamp can also offer additional gain control to optimize noise and distortion through the signal chain and may include source selection (switches) so you can choose between your phone and DAC, and/or among other sources.

So, it depends... My guess is you'd want one for the phone, maybe for the DAC...

HTH - Don

If the input required is simply a voltage into and "infinite" impedance (near zero input current drive), than your argument is correct, and what you have drawn for a Vin to the Input Buffer stage is correct. But the reason for my original question casts doubt to that assumption.
 
OP
DonH56

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,915
Likes
16,746
Location
Monument, CO
Not having read the patents, I suspect that the one-bit multi-order noise-shaping employed in DAC's is also behind the internals of the class D output driving the FET's ;) I would be *really* surprised if that wasn't the case.

No noise shaping is used in the amps, at least not the ones I have seen. I certainly have not seen them all.

If the input required is simply a voltage into and "infinite" impedance (near zero input current drive), than your argument is correct, and what you have drawn for a Vin to the Input Buffer stage is correct. But the reason for my original question casts doubt to that assumption.

Some class D modules have very low (for typical audio) input impedance. Modules including an input buffer have "normal" high'sh impedance. You need to look at what you are using, and ask others like Alan (@March Audio ) who are doing this in their day jobs... ;)
 
  • Like
Reactions: PSO

March Audio

Master Contributor
Audio Company
Joined
Mar 1, 2016
Messages
6,378
Likes
9,321
Location
Albany Western Australia
Thanks for the wonderful write-up, Don. As I'm new to the DIY scene, the revelation of feedback to make accommodations is interesting, but makes sense. It reminds me of oversampled 1-bit delta-sigma A/D topologies from decades back.

Your schematic suggests that the Vin going into the opamp would not have a current draw. But I keep reading that a pre-amp could (may) be needed for the input of the Class D, where the pre-amp provides a power gain of 10~13dB, e.g. https://vtvamplifier.com/frequently-asked-questions/

So for practical purposes, would I need an intermediate pre-amp if I were outputting a signal from a mobile phone 3.5mm jack into the Class D, which then drives my 8ohm speakers? Or from a DAC?

OK, referring specifically to Hypex and Purifi modules. The modules have a low gain of around 13dB. As an example you will require about 42 volts output to the speaker to achieve 450 watts into 4 ohms (the full rating of the Purifi module).

Typical dacs output 2 volts single ended and 4 volts balanced. As such you will need an overall gain of 26dB or 20dB respectively to get the module to output 42 volts and full power.

So from this you can see that an additional gain section is required of 13dB or 7dB respectively.

Secondly the input impedance of the modules is low, 2k SE or 4k balanced so the gain section will also isolate the source from this low impedance load.

So unless your source can output 10 to 14 volts rms (module dependant) and can drive low impedances at that level, you need an input buffer.
 

Synergy4

Member
Joined
Jan 12, 2021
Messages
82
Likes
51
Location
Silicon Valley
Some interesting Class D amplifier history - 1932, amplifier US Pat # 1,874,159 & Class D 1967 US Pat # 3,336,538
There is also the X10 Sinclair class D amplifier from 1964.



1932-Patent-Class D-P1.JPG

1932-Patent-Class D-P2.JPG
1967-Patent-Class D -P1.JPG

1967-Patent-Class D -P2.JPG

1964-Class D amplifier-Sinclair-x-10_ad.jpg
 

Synergy4

Member
Joined
Jan 12, 2021
Messages
82
Likes
51
Location
Silicon Valley
This 2MHz switching frequency GaN Class D amplifier project used air core output inductors: "GaN Transistor Based Digital Class-D. Amplifier with Global Feedback" by Denis Hafizovic & Magnus Karlsson (2020) CHALMERS UNIVERSITY OF TECHNOLOGY, Gothenburg, Sweden 2020

"The output filter was a second-order low pass LC-filter with a cutoff-frequency of 400 kHz, as a result of a trade-off between aliasing distortion and loop filter gain. Air core inductors were used in the output filter, which resulted in lower resistive losses in the core and well as in the copper windings."

"The proposed system has a THD of as low as 0.005% and a THD+N of 0.02%. Clock jitter in the design is believed to limit the noise performance of the system, which could be significantly improved with a redesign of the clock network. "
 
OP
DonH56

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,915
Likes
16,746
Location
Monument, CO
@Synergy4 thanks for the patent post! I thought I had included the 1930's reference for the original design in my first post but don't see it. I usually mention it so folks know this is not really "new", just "improved". :)

Air core inductors have less inductance for the volume but not as much hysteresis and fewer issues with saturation compared to those with ferrite cores.
 

Rene

Member
Joined
Feb 11, 2018
Messages
90
Likes
87
Air core inductors have .......... not as much hysteresis and fewer issues with saturation compared to those with ferrite cores.[/QUOTE]

Sort of an understatement, Don.
 

EB1000

Senior Member
Joined
Jan 8, 2020
Messages
484
Likes
579
Location
Israel
This is a quick overview of how class D amplifiers operate. Note the “D” does not mean “digital”; it is simply the next letter in order as standards bodies enumerated amplifier types (A, B, C, D, E, F, G, H, I, etc.) It takes an analog, not digital, input and produces a pulse width modulated (PWM) output. I apologize in advance for the length.

The figure below is a simplified schematic diagram of a class D amplifier. It is a rather busy diagram, so we’ll step through each piece from input to output. First the input signal, Vin, is applied to the input buffer (shown as an operational amplifier, opamp). The negative input of the opamp receives the feedback signal (Vfb) from the output (Vout). The output of the buffer is the difference between these two signals, providing a modified signal to the rest of the amplifier. The feedback signal allows the amplifier to correct any errors at the output, improving linearity (e.g. lowering distortion) and stabilizing the circuit so part variations, power supply and temperature changes, and other effects do not reduce performance. In the real world perfection is hard to find, so the output will not be perfect even with feedback, but it can get pretty close as Amir’s measurements have shown.

View attachment 25114

After the buffer is a comparator, a circuit that outputs a “high” if the (+) input is above the (-) input and a “low” otherwise. The (-) input is the comparator’s threshold voltage. This converts the input from a purely analog signal to one that is quantized (sampled) in amplitude though not in time. Almost but not quite a true digital signal, which is quantized in time and amplitude. A comparator with a clocked latch after it is a basic building block for an analog-to-digital convert (ADC). This is not an ADC. The other input to the comparator is a triangle wave; more about that shortly.

The comparator’s output (Vcmp) is applied to a controller. This is usually a logic circuit and voltage amplifier that drives the output switches. The controller can be complicated, but its basic job is to turn on either the high or the low switch, and never both at the same time! That would short the power rails through the switches, increasing power, heat, and chances of blowing up the amplifier.

The switches connect the unfiltered output (Vamp) to either the positive (V+) or negative (V-) power supply rail. Power is expended mainly as the signal is switched from high to low and back and the filter plus load (speaker) is charged; when the switches are static, little power is needed, as the signal is supplied from the output filter. That is the key to the high efficiency of a class D amplifier. There is no standing bias current in the output devices as in a class A or class AB amplifier. A push-pull class A amp has full current flowing all the time and is at best 50% efficient. A class AB amplifier reduces the current by only supplying current as needed to drive the load with minimal standing (constant) current just to cover the “gap” when the signal transitions from top and bottom devices. A class AB can achieve about 67% efficiency. By eliminating standing current, a class D amplifier can achieve 90% or higher efficiency, meaning much lower average power and much less power wasted as heat.

The switching rate is usually well above the audio band, perhaps 100 kHz to 1 MHz. That means no in-band power supply noise, but also adds very high frequency noise at the output. There is also a small “dead zone”, a time during which neither switch is on, thus higher switching frequency makes the dead zone as short as possible so it does not affect the output signal. The output low-pass filter is to get rid of all the high-frequency energy and deliver a smooth analog waveform to the speaker.

The triangle generator is what creates the high-frequency PWM signal to drive the switches. To see how it modulates the signal, consider replacing it with a DC source (a battery). If Vdc is 0 V, then the output is a square wave at the signal frequency. As you raise or lower the DC voltage, the period remains the same, but the pulse width changes since only part of the signal is above or below the threshold.

View attachment 25115

The period of the comparator’s output is the same as the input signal’s (same fundamental frequency) but the pulse width changes. Since you only have two levels (high and low), it is like a one-bit DAC without oversampling, and you would not be able to filter output. Not only is the switching rate too low, but it effectively varies with the signal, so you are just turning your input into a pulse train at the same frequency. Hardly useful for this application. By applying a high-frequency triangle wave, the pulses can be made much narrower, and the comparator’s output frequency is modulated to a much higher frequency. This allows the pulses to be filtered to create a smooth (analog) output signal.

Here is a picture showing some of the waveforms inside the amplifier. The input at the top is a ~10 kHz sine wave. The triangle generator is producing a 100 kHz signal as shown in the middle. The bottom plot shows the comparator’s output. It creates a pulse train similar to that shown with a DC reference, but now the pulse train produces much higher-frequency pulses. Notice the high pulses are still generally longer as the input signal is higher, and shorter as the input signal drops below 0 V, but the pulses occur and a much higher rate. Now a simple filter can remove the high-frequency switching noise to create a smooth analog output.

View attachment 25116

Moving on, the plots below show the input and triangle wave in the upper plot, and the output before and after the output filter in the lower plot. For the particular circuit simulated, the gain is set to produce ~100 Vpp for a 2 Vpp input using +/-100 V power supply rails. The Vamp signal looks exactly like the Vcmp signal as expected but scaled to the output level (+/-100 V instead of +/-1 V). At this scale you cannot see any dead zone in the output; like any decent design, it is as small as practical and invisible by eye. The ripples in the output signal Vout are because this amplifier is designed to operate at 500 kHz. I slowed it down to make it easier to see the switching waveforms, but that means the feedback and filter circuits are not adequately reducing switching noise at the output since they were designed for higher a switching frequency.

View attachment 25117

Here is the picture for the same 10 kHz input signal but switching at 500 kHz as designed. It is harder to see the triangle waves and distinguish the pulse shaping (width modulation) at the higher rate. The output signal is much smoother as seen in the next plot of just the output signal.

View attachment 25118
View attachment 25119

Finally here is an FFT (frequency plot) of the output signal. There are some low-frequency artifacts of the simulation and FFT resolution, plus some mixing products from the signal and switching frequencies, but the overall dynamic range is about 65 dB. This is an idealized design but also is not particularly optimized for performance – I just did enough to get it stable. The output filter rolls off over about 20 kHz, but you can clearly see the 500 kHz switching frequency tone about 50 dB below the output signal, then harmonics falling off above that. I could take more points and optimize the design for better performance but hopefully this shows enough to see generally how a class D amplifier works.

View attachment 25120

A word about the feedback circuit: 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 feedback circuit (and output filter) had to roll off just above the audio band, and that caused a lot of phase shift in the audio band itself. There was little loop gain to reduce the distortion of higher-frequency audio signals and to ensure amplifier stability with complex loads (like many speakers). Too much phase shift and the feedback would be in phase with the input, adding instead of subtracting (positive feedback), 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.

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 feedforward circuit may include 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 must 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 25121

Other schemes put multiple switches in parallel, but staggered in time, 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

These are the worst class-d implementations. You can't feed an error signal directly to a PWM modulator. Error signals should be fed to a compensator (PID controller), however, a PID or ever a PR controller cannot be used with a non sinusoidal reference signal. Class D amps are either based on open-loop PWM, or closed-loop self-oscillating controllers (an error signal fed directly to a comparator, without any carrier signal, as in you schematics).

Also, in the second schematic, the use of feed-forward is also not implemented correctly. How do to feed a line-level signal into the high-level signal? Do you use an analog amplifier? So why even bother with the class-D stage in the first place. feed-forward is used to compensate for power supply variations, and not to compensate for the reference signal. For example, in a DC-DC converter, feedforward can be used to suppress variations in the input voltage.

I've included the correct and simplest implementation of a self oscillating half-bridge class-D amp.
Class-D.jpg
 
OP
DonH56

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,915
Likes
16,746
Location
Monument, CO
These are the worst class-d implementations. You can't feed an error signal directly to a PWM modulator. Error signals should be fed to a compensator (PID controller), however, a PID or ever a PR controller cannot be used with a non sinusoidal reference signal. Class D amps are either based on open-loop PWM, or closed-loop self-oscillating controllers (an error signal fed directly to a comparator, without any carrier signal, as in you schematics).

Also, in the second schematic, the use of feed-forward is also not implemented correctly. How do to feed a line-level signal into the high-level signal? Do you use an analog amplifier? So why even bother with the class-D stage in the first place. feed-forward is used to compensate for power supply variations, and not to compensate for the reference signal. For example, in a DC-DC converter, feedforward can be used to suppress variations in the input voltage.

I've included the correct and simplest implementation of a self oscillating half-bridge class-D amp.View attachment 109289

They are not, and were not meant to be, rigorous, just something a lay person could follow. My experience is in high-speed analog/RF/mW so I am used to using feedforward compensation in amplifier circuits. I have not designed a class D audio amplifier in many years and it looked very little like the simplified circuit in this tutorial. The article was originally written several years ago (2011, actually) and I have not bothered to update it. Please write up a better version and I'll ask Amir to delete this thread.
 
Last edited:

onix

Member
Joined
Aug 9, 2020
Messages
8
Likes
2
Air core inductors have .......... not as much hysteresis and fewer issues with saturation compared to those with ferrite cores.

Sort of an understatement, Don.[/QUOTE]

What size inductors are we talking about here -- nanoH, microH, milliH? And are there multiple places where they get used, e.g. on the power input and output side, filtering in the pre-amp stages? Curious, since I work in technology where we can easily make nanoH-sized air-core inductors with a platform for tighter component integration, à la low parasitics and such.
 

cjm2077

Active Member
Joined
Jan 22, 2020
Messages
160
Likes
261
Sort of an understatement, Don.

What size inductors are we talking about here -- nanoH, microH, milliH? And are there multiple places where they get used, e.g. on the power input and output side, filtering in the pre-amp stages? Curious, since I work in technology where we can easily make nanoH-sized air-core inductors with a platform for tighter component integration, à la low parasitics and such.

I've used air core inductors in the resonant tank of switching amps, and even at a few uH they get very large. That will depend on how much current handling you need and at what frequency though. I was running up to 500 kHz and up to 100A, so the litz wire got pretty big. The design above seems to be talking about one LC output filter, which could be a pretty similar setup to what I used, and at 400 kHz would be pretty close to the parameters I was working with. We're definitely not talking about a design aiming for the smallest total size possible. But it does remove all those pesky core issues, which is nice.
 
Last edited:

oursmagenta

Active Member
Forum Donor
Joined
Jan 19, 2021
Messages
161
Likes
187
Location
France
Hello,
I have what could be a silly question.
Does the math tells you that the switching frequency noise amplitude is gain independent ? In the sense that the noise amplitude does not depend on the output voltage gain you are asking from the amplifier.
In practice if for a 4V@1khz output from the amp we measure say 500mV@450khz for the noise amplitude, can we assume that if we ask for a 40V@1khz output we still have a 500mV@450khz noise amplitude ?
 
Last edited:
OP
DonH56

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,915
Likes
16,746
Location
Monument, CO
Hello,
I have what could be a silly question.
Does the math tells you that the switching frequency noise amplitude is gain independent ? In the sense that the noise amplitude does not depend on the output voltage gain you are asking from the amplifier.
In practice if for a 4V@1khz output from the amp we measure say 500mV@450khz for the noise amplitude, can we assume that if we ask for a 40V@1khz output we still have a 500mV@450khz noise amplitude ?

I missed this, been a crazy year, sorry.

Not silly at all!

There are some caveats and such, probably best explained by those who design audio amplifiers better than I, but in general the actual switching noise from the output switches is mostly independent of gain. The noise from the earlier stages, is not, however, and the noise level and frequency is somewhat dependent upon the input signal since it changes the output pulse stream. There will be little bursts of noise every time the output changes state. I had to do an analysis of that years ago to include both large-signal effects and the small wideband noise bursts as the output transistors pass through the linear region on their way to being fully on or off. There is also the potential for power supply noise to modulate the output since you are switching the rails. That may also be handled much differently by modern class D amps, I don't know, but back when I first designed a class D amp (ca. 1979) that was a big problem and required regulated supply rails.

HTH - Don
 
Last edited:
Top Bottom