Give away medical masks when you place an order. learn more

Adding Class D Audio to Your Embedded Design

While the power and sophistication packed into many MCUs can support basic audio-processing functions and allow them to perform tasks such as audio record/playback (see the TechZone article “Choosing an MCU for Audio Capture/Playback”), managing MP3 digital music streams (see the TechZone article “Choosing the Right MCU for Your Audio Application”), and providing basic alert sounds, there are times when a design calls for an upgrade to more robust audio performance, which can be achieved via digital audio architectures that employ Class D amplifiers.

When solid-state audio amplifiers started hitting the consumer hi-fi market in the late ‘60s, audiophiles immediately started complaining that they did not sound as good as tube amplifiers. I was working as an audio technician at the time and knew that the total harmonic distortion (THD) of the best solid-state amps was lower than all but the best tube amps. We did not know at the time about transient intermodulation distortion (TIM), which was indeed worse in early solid-state amps. This problem has arguably been eliminated, but do not say that to a tube aficionado.

Those early solid-state stereos had Class AB output stages. Can Class D, where MOSFETs push a pulse-width modulation (PWM) signal through a simple LC filter into a speaker, really give you high-quality audio? The answer, surprisingly, is yes.

Amplifiers with class

Different classes of amplifiers reflect different tradeoffs between efficiency, power, and distortion:

Class A amplifiers (Figure 1) conduct during the entire input cycle, making them both highly linear and extremely inefficient since they draw current even in the absence of a signal. With inductive coupling, Class A amplifiers can reach 50 percent efficiency; with capacitive coupling, they can only reach 25 percent. Class A amplifiers use single devices, so there is no issue with crossover distortion. Op amps are typically Class A amplifiers, as are the gain stages in most commercial audio amplifiers.

Figure 1: Class A amplifier.

Class B amplifiers only amplify half of the input waveform, so they are typically implemented as complementary pairs in a push-pull arrangement (Figure 2). Since the output devices are rarely perfectly matched, this gives rise to crossover distortion. Crossover distortion can be reduced by biasing the transistors so that the nonconducting one is never completely off, known as Class AB operation, sacrificing some efficiency for greater linearity. Class AB amplifiers can achieve 60 to 65 percent efficiency with good linearity. The ON Semiconductor NCS2211 can deliver 1 W output to an 8 Ω speaker at 0.2 percent THD+N.

Figure 2: Push-pull Class B amplifier.

Class C amplifiers can reach 90 percent efficiency but are highly non-linear, since they conduct during less than half of the signal cycle (Figure 3). RF amplifiers are typically run in Class C, though almost always feeding a tuned circuit that smoothes out the waveform at the resonant frequency. However, further filtering is usually necessary to remove harmonics and other spurious radiation.

Figure 3: Class C amplifier.

Class D amplifiers consist of a switching power amplifier architecture utilizing pulse-width modulation (PWM) to generate an output waveform; in audio applications their output is then fed through an LC filter to convert it back to analog form before being fed to a speaker or other output device. Figure 4 shows a simple Class D signal diagram.

Figure 4: Class D power amplifier signal diagram (Courtesy of Silicon Labs).

The Class D output stage typically consists of a pair of inexpensive MOSFETs that at any given time are either fully on or fully off. Since MOSFETs have very-low internal resistance when switched on, the output stage is highly efficient, enabling high-power amplifiers that are far more compact than equivalent Class AB designs. Class D amps can achieve well over 90 percent efficiency at high power levels, enabling far smaller heat sinks, power supplies, and PCB space than you would need for a comparable Class AB design, a critical consideration in portable applications in particular.

That is the good news. The bad news, or at least the heads up, is that low-distortion analog Class D amplifiers are not simple to design. Fortunately, there are numerous off-the-shelf solutions that address that problem, as well as some MCUs well suited to working with the less conventional Class D power amplifier.

The devil’s in the D-tails

In contrast to a straight analog Class A/Class AB signal chain, any audio device using a Class D output stage must first digitize the input signal, therefore giving rise to multiple sources of distortion even before the audio is amplified:
  • Sampling rate: A digital signal cannot contain frequencies above one half of the sampling (Nyquist) rate, otherwise aliasing occurs, causing a loss of information. CD quality sound is sampled at 44.1 kHz, enabling reproduction of sounds up to 22 kHz.
  • PWM switching rate: This should be at least 10 times faster than the highest input frequency in order to accurately reconstruct the input signal.
  • PWM resolution control: High-resolution control is needed to reduce output quantization distortion.
Using a simple LC filter on the output side of a Class D amplifier may seem like a pretty primitive substitute for a DAC followed by an analog reconstruction filter, and it is; but when you are dealing with an amplifier in the 10 to 100 W+ range, there are not any obvious alternatives. Having said that, it is possible to obtain quite satisfactory results using some simple circuits.

Silicon Labs Class-D Toolstick Kit is a USB-based demonstration and evaluation kit that lets developers add digital Class D audio capabilities to 32-bit embedded designs using their SiM3U164, an ARM Cortex-M3-based MCU with two 12-bit ADCs, two 10-bit DACs, fine frequency resolution up to 80 MHz, and spread spectrum mode for reduced EMI. The output network for the Class D amplifier stage (Figure 5) consists of ferrite beads, LC filters, and grounding capacitors. The ferrite beads dissipate what would otherwise be EMI noise as heat, the LC components filter the PWM noise, and the combination of the grounding capacitors and the speaker, another LC network, provides additional filtering. The component parameters vary with signal volume, bandwidth, noise harmonics, and hiss at low and high volumes.

Figure 5: Class D Toolstick output network (Courtesy of Silicon Labs).

Silicon Labs also offers a full Class-D Reference Design, a two-channel, two-state, half-bridge Class D audio amplifier based on their Si8241 Class D audio drivers (Figure 6). The Si8241 includes two high-/low-side drivers and an integrated dead-time generator that provides precise control for achieving optimal THD. Using the same basic output circuit described above, this stereo amplifier delivers 120 W per channel into 8 Ω while enabling < 0.02 percent THD at 60 W and > 95 dB SNR. That is as good as, or better than, the Class AB amplifiers we discussed earlier.

Figure 6: Si824x-based Class D audio driver block diagram (Courtesy of Silicon Labs).

Other Class D options

NXP’s TFA9881 Class-D audio amplifier targets portable applications. The TFA9881 receives an oversampled pulse-density-modulated (PDM) bitstream, using a second-order closed-loop architecture to provide high-quality audio, as well as high supply voltage ripple rejection. Audio output is rated at 2.7 W into 4-Ω/20-µH load with one percent THD. NXP offers a Class D Audio Amplifier training module to assist you with your design.

Also throwing their hat in the portable ring, Texas Instruments offers its TPA2025D1 Class D audio power amplifier. The TPA2025D1 includes battery-tracking AGC technology and an integrated Class-G boost converter that enhances efficiency at low output power. It drives up to 1.9 W into an 8 Ω speaker with one percent THD+N.

Need surround sound? TI’s LM48901 Quad Class-D Spatial Array creates an enhanced sound stage for portable multimedia devices. The LM48901’s 18-bit stereo-differential input ADC processes analog stereo signals; and its Class-D output stage takes advantage of TI’s edge rate control (ERC) architecture to reduce RF emissions while preserving audio quality and efficiency. The LM48901 can deliver 2.8 W/channel of continuous output power into a 4 Ω load with <10 percent THD+N.

Cirrus Logic takes a flexible approach with its CS35L01 high-efficiency hybrid Class D audio amplifier. Standard Class-D (SD) mode offers full audio bandwidth and high audio performance; Hybrid Class D (HD) mode offers a substantial reduction in idle power consumption with an integrated Class H controller (Classes G and H use "rail switching" to decrease power consumption and increase efficiency, these amplifiers provide several power rails at different voltages and switch between them as the signal output approaches each level, thereby reducing wasted power at the output transistors). Reduced Frequency Class D (FSD) mode reduces the output switching frequency, producing lower electromagnetic interference (EMI); and Reduced Frequency Hybrid Class D (FHD) mode produces both the lower idle power consumption of HD mode and the reduced EMI benefits of FSD mode. In SD and HD modes, the chip is rated at 1 W at 0.02 percent THD+N. Cirrus Logic also offers a reference design for the CS35L01. The company also provides a CS35L0x Audio Amplifiers Overview product training module to help you get started.


While classic tube amplifiers may still command a high price on eBay, it is increasingly due to nostalgia rather than technical considerations. Today high-efficiency, high-quality Class D audio amplifiers are rapidly replacing Class AB output stages in everything from MP3 players to audiophile-quality stereos. If your next design involves high-volume audio output, give Class D some serious consideration.

For more information on the productions discussed in this article, use the links provided to access product pages on the Hotenda website.