🎯 Objective
By the end of this lab, students will be able to:
- Explain how a real-world audio signal (music) is processed and interfaced with a Class-D amplifier through filtering, scaling, and offsetting.
- Describe how broadband signals are encoded using PWM and how the duty ratio continuously varies to represent time-varying inputs.
- Evaluate the role of high-pass and low-pass filters in shaping the signal bandwidth and preventing distortion due to load characteristics and switching effects.
- Measure and interpret time-domain waveforms at two different time scales to distinguish between the audio envelope (ms scale) and high-frequency switching behavior (µs scale).
- Experience and evaluate their own Class-D amplifier by playing music and relating electrical measurements to perceived sound quality.
📚 Prerequisite
- Experiment A1, A2, and A3
- Experiment E1
- Basic understanding of frequency response characteristics, basic idea of Bode plots
- Being able to do Fast Fourier Transform (FFT) using MATLAB (example code provided) or on the scope.
🧠 Theory
In the previous experiment, a single-tone signal (e.g., 1 kHz) was successfully amplified using a Class-D architecture, demonstrating how PWM-based switching combined with an LC filter can reproduce a sinusoidal output with significantly higher power than a signal generator. The system behavior was also examined as a function of filter design, where component selection directly influenced gain, resonance, and attenuation. In practical applications, however, the input signal is not a single tone but a broadband, time-varying waveform such as music. Audio signals typically span a wide frequency range (approximately 20 Hz to 20 kHz) and contain multiple frequency components simultaneously, often distributed across multiple channels (e.g., stereo outputs from a computer). This introduces additional challenges in ensuring that the signal is properly conditioned before being applied to the PWM modulator.
To interface a computer audio output with the modulation stage, several signal-conditioning steps are required. First, the stereo signal must be converted into a single-channel (mono) signal, since the power stage is designed for single-input operation. Next, the signal must be scaled and shifted to meet the PWM modulator requirements. Specifically, the duty-ratio control signal must remain within the 0–4 V range, with a nominal offset of 2 V, to ensure proper operation of the comparator-based modulation scheme. Additionally, both the load characteristics and the filter design impose constraints on the system’s usable frequency range. The loudspeaker exhibits a mechanical resonance around 400 Hz, which can lead to excessive vibration and audible distortion if excited. To mitigate this effect, it is desirable to attenuate frequency components near this region. Furthermore, depending on the selection of the output filter capacitor, the system bandwidth may be limited, and high-frequency components outside the effective passband can introduce unnecessary switching ripple and distortion.
To address these considerations, the input signal is processed to achieve the following:
- Combine stereo channels into a mono signal
- Limit the frequency content to a controlled band (approximately 800 Hz to 12 kHz)
- Apply an appropriate DC offset (2 V) to center the signal within the modulator range
- Provide adjustable gain to control the perceived loudness (volume)
These operations are implemented using the audio signal processing block on the black board, as shown in Fig. 1. Functionally, this block prepares the raw audio signal such that it can be accurately encoded by the PWM stage and faithfully reconstructed by the output filter.

The audio signal processing block prepares the raw input signal for compatibility with the PWM modulator while enforcing key constraints on amplitude and bandwidth. Capacitors C4 and C5 are used to block any DC component present in the incoming stereo signal, ensuring that the signal entering the processing chain is centered around zero. The stereo inputs (Channel 1 and Channel 2) are then combined by the op-amp stage U1A (NE5532), which converts the stereo signal into a mono signal and provides adjustable gain for volume control via the Volume1 potentiometer. Following this, the network formed by C3, R11, and the potentiometer Lower_cutoff_freq_select1 implements a tunable high-pass filter. This stage attenuates low-frequency components, particularly near the speaker’s mechanical resonance (~400 Hz), thereby reducing distortion and preventing excessive cone motion.
In the next stage, the second op-amp (U1B) introduces a controllable DC offset. By adding an offset of approximately 2 V, the signal is shifted into the required operating range of the PWM modulator. The signal is then passed through a low-pass filter formed by the potentiometer Upper_cutoff_freq_select1, resistor R8, and capacitor C7. This stage limits high-frequency components, ensuring that frequencies beyond the effective bandwidth of the output filter are attenuated. This reduces switching ripple and prevents unnecessary distortion in the reconstructed audio. Finally, the processed signal may still exceed the allowable input range of the downstream PWM comparator, which operates from a unipolar 5 V supply. To protect this stage and ensure proper operation, a clamp circuit is used to restrict the signal within safe voltage limits.
🧰 Required Components
The components needed in this lab are:
- Blue Board
- Red Board
- Black Board
- Oscilloscope
- Signal Generator
- Speaker (Option: Soberton WSP-5090-4 (4 Ohm, 10 W speaker) or equivalent).
- Multimeter
- Current probe (if interested in measuring load current)
🎥 Overview Video
This video gives you a quick glimpse of what you can expect from this lab.
🛡️ Safety
Watch out for potential safety issues.
- Confirm probe grounds are properly connected for each measurement.
- Don't power the blue board using both the USB-C cable and the power adapter.
- Always disconnect the power once you are done with the experiment.
⚠ Common Mistakes
- The gate of a MOSFET is directly connected to a microcontroller digital pin to perform switching actions without a gate driver.
- Incorrect grounding between comparator output, vref source, and carrier source. All of the signals are referenced relative to gnd of the blue board.
- Scope probe not set to dc-coupling.
- The reference of the scope channels are not properly set to zero at the start of the experiment. This will lead to incorrect reading of the signals.
- Forgetting to record Capacitances (C).
Youtube list to try out
20Hz to 20kHz (Human Audio Spectrum): https://www.youtube.com/watch?v=qNf9nzvnd1k
2 Hours of Tibetan Temple Bell Sound: https://www.youtube.com/watch?v=mZ--aNCoJzw
Dave Brubeck - Take Five: https://www.youtube.com/watch?v=vmDDOFXSgAs&list=RDvmDDOFXSgAs&start_radio=1
W.A.Mozart - Eine kleine Nachtmusik [Violin Solo by Roman Kim] - https://www.youtube.com/watch?v=KsxY3WL1cP8&list=RDKsxY3WL1cP8&start_radio=1
Memories on piano cover - https://www.youtube.com/watch?v=hp_qQMm_WOg&list=RDhp_qQMm_WOg&start_radio=1
Deep Bass Sound Test Demo - Hires Music Collection 2022 - Audiophile - https://www.youtube.com/watch?v=MHj9XlV3fFg&list=RDMHj9XlV3fFg&start_radio=1
🧷 Jumper Settings
For this experiment, we will be using only the black board.
Blue Board:
| Jumper | Function | Setting | Note |
|---|---|---|---|
| JP4 | Carrier waveform selection (Option 1: Constant, Option 2: External Carrier, Option 3: Sawtooth waveform internally generated) | Position 3 (we will use internal sawtooth) | - |
| JP5 | Reference signal selection (Option 1: a dc, whose magnitude can be varied using the potentiometer Rduty1, Option 2: any external signal that ranges between 0 and 5 V, Option 3: Voltage mode (we will use this later on for closed-loop control) | Position 2 (we will provide the reference signal from a signal generator) | - |
| JP3 | The PWM input signal to the deadtime generation circuit can be provided in three ways. (Option 1: Using an external PWM source, for example, an Arduino generating PWM pulses, Option 2: Internal PWM that is generated by the PWM generation circuit, and Option 3: Using current-mode control.) | Position 2. We will generate PWM using the internal comparator | - |
| JP1 | The gate of the high-side MOSFET [qH (in Blue Board) or PWM_H(in Red Board)] can be fed three signals. (Option 1: q1 signal from the dead time compensation circuit, Option 2: gnd, Option 3: q2 signal from the dead time compensation circuit). Note that q1 follows q(t) and q2 is complementary. | Position 1. We will use the half-bridge in synchronous mode. | |
| JP2 | The gate of the low-side MOSFET [qL (in Blue Board) or PWM_L(in Red Board)] can be fed three signals. (Option 1: q2 signal from the dead time compensation circuit, Option 2: gnd, Option 3: q1 signal from the dead time compensation circuit). Note that q1 follows q(t) and q2 is complementary. | Position 1. We will use the half-bridge in synchronous mode. |
Red Board:
| Jumper | Function | Setting | Note |
|---|---|---|---|
| J7 | Populating this jumper provides the 12 V supply to the gate driver. (Option 1: 12 V is internally generated, Option 2: An External supply is needed) | Position 1. We will provide the internally generated 12V supply to the gate driver. | - |
| J10 and J11 | These jumpers allow changing the direction of current measurement through the Rsense resistor. (Option 1: Current can be measured flowing from L2 to Vmid terminals, Option 2: Current can be measured flowing from Vmid to L2 terminals) | X (we will not be using the internal current sensors) |
Black Board:
| Jumper | Function | Setting | Note |
|---|---|---|---|
| Spkr_cnct1 | Populating this jumper provides power to the speaker. | Unpopulated to begin with. We will change this configuration later. | - |
| Gnd_connect1 | This jumper connects the ground between the power stage and the audio filter stage. | X. | |
| JP1 | This jumper allows you to change the capacitance (C) (Option 1: Not populated, C = 0.47 uF, Position 1: C = 3.77 uF, and Position 2: C = 40.47 uF) | As directed in the procedure. | |
| JP4 | This jumper allows the routing of the Channel 1 signal through the audio filter (in position 2) or directly to the duty output (position 1) | Position 2. We will enable the audio filter signal processing. |
Keep all the other jumpers unpopulated.
⚙️ Circuit Configuration & Setting up the experiment
We will start with the following circuit configuration, as shown below. After observing key variables in isolation, we will adapt the circuit to play audio using the speaker. Please make the connections between the red board and external components using the banana cables. Use jumper cables to connect the blue board to the black board. If a current probe is available, we will measure the input current to the speaker.

Use the checklist below to mark each step as you complete it. You can download it later on to verify that you have performed all the steps.
Startup & Setup Checklist
🧪 Experiment
Download the checklist above and ensure you have completed all steps before we power on. We will go through the following steps:
- You are most likely probing the signal generator output (Chn 1, Black Board) on Scope Channel 1, (Chn1_dcblock, Black Board) on Scope Channel 2, (Chn1+2, Black Board) on Scope Channel 3, and Chn1+2_HP (Black Board) on Scope Channel 4. Let us adjust the time scale to capture at least three cycles of the reference signal on the scope. Do you notice that Chn 1 has a DC while Chn1_dcblock is only an AC signal of 1 V and 800 Hz?
- Next, let us tune the volume such that Chn1_dcblock and Chn1+2 have the same amplitude by tuning the Volume1 potentiometer (Black Board). These two signals are out of phase. Can you find out why from the circuit shown in Fig. 1? Write it in the report.
- Next, let us tune the high-pass filter and set its corner frequency (- 3dB point) to 800 Hz. For this setting, adjust Lower_cutoff_freq_select1 potentiometer (Black Board), to get an amplitude of ~707 mV on Chn1+2_HP. Capture a screenshot of the scope showing all these waveforms properly scaled and shifted.
- Next, let us tune the offset. For this step, probe the signal generator output (Chn1+2_HP, Black Board) on Scope Channel 1, (Chn1+2_Offset, Black Board) on Scope Channel 2, (duty, Black Board) on Scope Channel 3, and sawtooth (Blue Board) on Scope Channel 4.
- Reduce the signal generator amplitude to approximately 1 mV, and adjust the Offset1 potentiometer until the duty signal is centered midway within the sawtooth waveform.
- Now, we will tune the low-pass filter. Bring the signal generator amplitude back to 1 V and set the frequency to 12 kHz. Observe Chn1+2_Offset and duty both in AC-coupled mode on the scope. This step will eliminate the DC part (that we have already adjusted).
- To set the corner frequency (- 3dB point) to 12kHz, adjust Higher_cutoff_freq_select1 potentiometer (Black Board), to get an amplitude of ~707 mV on duty while Chn1+2_Offset shows an amplitude of unity. Capture a screenshot of the oscilloscope.
- We are ready to play music! Disconnect the signal generator. Connect the computer audio port to Black Board audio port using the audio cable, as shown below.

- Ensure Jumper JP1 (Black Board) is in position 1. This gives us a C of 3.77 uF for the class-D audio amplifier filter stage.
- Increase the dc supply to 10 V.
- Open Youtube and play https://www.youtube.com/watch?v=qNf9nzvnd1k. This will sweep the frequency from 20 Hz to 20 kHz. Ensure the computer volume is high enough.
- Let us probe the following signals: (Chn1+2, Black Board) on Scope Channel 1, (q(t), Blue Board) on Scope Channel 2, and speaker current (if current probe is available) on Scope Channel 3.
- Play https://www.youtube.com/watch?v=vmDDOFXSgAs&list=RDvmDDOFXSgAs&start_radio=1. Are you able to hear the music?
- Set the oscilloscope time scale to 10 ms/div. At this timescale, observe the dynamic nature of the music signal at Chn1+2 (Black Board) along with the speaker current. Notice how the waveform varies continuously in amplitude and shape, reflecting the broadband and time-varying characteristics of the audio signal. Capture a screenshot showing both signals clearly.
- Next, reduce the time scale to 4 µs/div. At this timescale, observe the PWM signal that encodes the music, along with the speaker current. You should now see the high-frequency switching behavior, where the pulse widths vary according to the audio signal. Capture a screenshot showing these waveforms.
- You are strongly encouraged to experiment further by playing your favorite music. You are also encouraged to change the filter capacitance by using JP1 to select 40.77 µF or 0.47 µF, and listen to how the change in filter design affects the sound quality.
Turn off Checklist
Before we close the experiment, please ensure:
Turn-Off & Shutdown Checklist
🧠 Observations & Analysis
Now, let us analyse the data you collected to write a brief report that solidifies our understanding. Structure the report to include the following:
- Objective: What are the objectives of this experiment? Clearly restate them in your own words. Your response should reflect how a broadband audio signal (music) is processed, encoded, and amplified using a Class-D amplifier, how the signal conditioning stage prepares the audio signal (scaling, filtering, and offsetting) for PWM generation.
- Theory: Explain the role of each stage in the signal chain and the expected system behavior. Your explanation should include the function of the audio signal processing block (stereo-to-mono conversion, high-pass filtering, gain control, offset addition, and low-pass filtering).
- Explain the screenshot you captured in Step 3. How did the approach of setting the −3 dB point of the high-pass filter work out? In your explanation, describe how the amplitude of Chn1+2_HP was reduced to approximately 707 mV when the input signal amplitude was 1 V, and how this corresponds to the definition of the −3 dB cutoff frequency. Does the phase shift at the cutoff frequency match theoretical expectations?
- Explain the screenshot you captured in Step 7. Does the phase shift at the cutoff frequency match theoretical expectations?
- At 10 ms/div, analyze the time-domain waveform of Chn1+2 and the speaker current. Discuss how the waveform varies continuously, reflecting the low-frequency envelope of the music signal.
- At 4 µs/div, analyze q(t) and the speaker current. Identify the high-frequency switching behavior (~100 kHz) and explain how the pulse widths vary according to the audio signal.
- Using different capacitor values (0.47 µF, 3.77 µF, 40.47 µF): Compare the reconstructed waveform quality. Which case provides the best trade-off between fidelity and filtering? Which case allows more high-frequency content to pass? Why does a larger capacitance lead to smoother but potentially duller sound? Why does a smaller capacitance lead to noisier but more responsive output?
- What would you do to improve the speaker?
- Conclusion: Summarize the key takeaways from this experiment. our conclusion should reflect how arbitrary signals can be encoded using PWM, how the half-bridge enables power amplification, how the filter reconstructs the audio waveform, how component choices affect fidelity and distortion, and how the experimental observations align with theoretical expectations.
✔ Conclusion
This experiment demonstrated how a broadband audio signal can be conditioned, encoded using PWM, and amplified through a Class-D architecture, with the output filter reconstructing the desired waveform. The results highlight the importance of signal conditioning and filter design in balancing fidelity, distortion, and performance for real-world applications.
🔍 References & further reading
- https://www.infineon.com/assets/row/public/documents/24/42/an-1071.pdf?fileId=5546d462533600a40153559538eb0ff1
- https://www.analog.com/en/resources/technical-articles/class-d-audio-amplifier-output-filter-optimization.html
- https://www.renesas.com/en/document/apn/r32an0007-output-filter-design-selection?srsltid=AfmBOooowPBGWjSoicC4KDtusR03O5iHkyMzSdJJWZJNdrjW5XhQ3vaL
- https://www.ti.com.cn/cn/lit/an/sloa119b/sloa119b.pdf?ts=1775757169912