---
title: PWM Audio Analysis with FPGA + Red Pitaya Gen 2
description: Analyze PWM audio signals with Red Pitaya Gen2. See how resolution impacts spectrum, filtering, and Class-D amplifier design.
image: https://content.redpitaya.com/hubfs/blog%20featured%20image%20-%202026-05-05T152338.466.jpg
---

[![Red Pitaya](https://content.redpitaya.com/hubfs/raw_assets/public/Red_Pitaya_November_2021/images/redpitaya-logo-des.svg "Red Pitaya")](https://redpitaya.com/)

[![Red Pitaya](https://content.redpitaya.com/hubfs/raw_assets/public/Red_Pitaya_November_2021/images/redpitaya-logo.svg "Red Pitaya")](https://redpitaya.com/)

- Products
  
  
  
    - [STEMlab 125-14 Gen 2](https://redpitaya.com/stemlab-125-14-gen2/)
      
      
      
          - [STEMlab 125-14](https://redpitaya.com/stemlab-125-14/)
          - [SIGNALlab 250-12](https://redpitaya.com/signallab-250-12/)
          - [SDRlab 122-16](https://redpitaya.com/sdrlab-122-16/)
          - [STEMlab TI (Texas Instruments)](https://redpitaya.com/stemlab-ti-texas-instruments/)
          - [Multi-channel Solutions](https://redpitaya.com/multi-channel-solutions/)
          - [Accessories](https://redpitaya.com/accessories/)
- [Applications](https://redpitaya.com/applications/)
- Documentation
  
  
  
    - [Technical Documentation](https://redpitaya.com/documentation/)
    - [Teaching materials](https://redpitaya.com/teaching-materials/)
    - [Student projects](https://redpitaya.com/student-projects/)
    - [User forum](https://forum.redpitaya.com/)
- [About](https://redpitaya.com/about-us/)
  
  
  
    - [History](https://redpitaya.com/history/)
      
      
      
          - [Distributors](https://redpitaya.com/distibutors-red-pitaya/)
- [Blog](https://content.redpitaya.com/blog)

[Shop](https://redpitaya.com/shop/)

- [ACADEMIA](https://redpitaya.com/academia/)
- [RADIO AMATEURS](https://redpitaya.com/radio-amateurs/)

- [Home](https://redpitaya.com/)
- Products
  
  
  
    - [STEMlab 125-10](https://redpitaya.com/stemlab-125-10/)
      
      
      
          - [STEMlab 125-14](https://redpitaya.com/stemlab-125-14/)
          - [SIGNALlab 250-12](https://redpitaya.com/signallab-250-12/)
          - [SDRlab 122-16](https://redpitaya.com/sdrlab-122-16/)
          - [Accessories](https://redpitaya.com/accessories/)
- [Applications](https://redpitaya.com/applications/)
- [Resources](https://redpitaya.com/documentation/)
- [Shop](https://redpitaya.com/shop/)
- [About](https://redpitaya.com/about-us/)
- [Blog](https://content.redpitaya.com/blog)
- [Compare](https://redpitaya.com/compare/)
- [Login / Register](https://redpitaya.com/my-account/)

### Red Pitaya Blog

[Home](https://redpitaya.com) » [Case study](https://content.redpitaya.com/blog/tag/case-study)  »

[Case study](https://content.redpitaya.com/blog/tag/case-study)

# PWM Audio Analysis with FPGA + Red Pitaya Gen 2

- Posted by ![Red Pitaya Technical Editorial Team](https://content.redpitaya.com/hubfs/Red-pitaya-fav-ikona.png) [Red Pitaya Technical Editorial Team](https://redpitaya.com/Red-Pitaya-Blog-team/) , May 12, 2026

![](https://content.redpitaya.com/hubfs/blog%20featured%20image%20-%202026-05-05T152338.466.jpg)

***A practical look at spectrum behavior in Class-D–style signals***

Engineers working with audio DSP or power electronics already know the trade-offs in PWM-based systems. What this project does well is make those trade-offs measurable—using real hardware, not just simulation.

In a recent experiment published by [**Pablo Trujillo (ControlPaths)**](https://controlpaths.com/2026/03/15/red-pitaya-gen2-audio-pwm-signal/), Red Pitaya [**STEMlab 125-14 PRO Gen 2**](https://redpitaya.com/stemlab-125-14-gen2) is used as a spectrum analyzer to evaluate how PWM modulation affects an audio signal across different resolutions. The setup combines FPGA signal generation with high-speed analog measurement, offering a compact but capable test bench for real-world validation.

## The Setup: FPGA-Generated PWM, Measured in Hardware

The experiment pairs two platforms:

- Red Pitaya STEMlab 125-14 PRO Gen 2 → used for acquisition and spectral analysis
- Digilent Arty A7 → generates the PWM audio signal

A simple Verilog-based PWM modulator runs at 100 MHz on the FPGA, encoding a 3.9 kHz sine wave. The resulting signal is then captured and analyzed using Red Pitaya’s built-in spectrum analyzer.

This approach is notable because it replaces a traditional lab stack (signal generator + spectrum analyzer) with a single, software-defined instrument that is remotely accessible and FPGA-reconfigurable.

## What’s Actually Being Tested?

The core question is familiar to anyone designing Class-D amplifiers:

**How does PWM resolution affect spectral distribution—and what does that mean for filtering and audio quality?**

PWM encoding introduces a carrier frequency and harmonic structure that must be filtered out to recover clean audio. The position of that carrier depends directly on resolution:

- 8-bit → ~390 kHz carrier
- 9-bit → ~195 kHz
- 10-bit → ~97 kHz

Higher resolution improves amplitude granularity, but compresses the spectral spacing—bringing switching artifacts closer to the audio band.

## What the Measurements Show

Using Red Pitaya as a spectrum analyzer makes the trade-offs immediately visible:

- **8-bit PWM** 
    - Carrier far from audio band
    - Easier filtering
    - Lower amplitude resolution
- **9-bit PWM** 
    - Balanced compromise
    - Harmonics begin entering mid-frequency range
- **10-bit PWM** 
    - Better resolution (1024 levels)
    - Carrier dangerously close to audio band
    - Requires higher-order filtering (LC, multi-stage)

The key takeaway is not theoretical—it is measurable:  
**Resolution and filtering complexity are tightly coupled design parameters.**

Time-domain observations reinforce this. Lower carrier frequencies (higher resolution) introduce visible distortion after reconstruction, especially if filtering is insufficient.

![blog featured image - 2026-05-05T152401.812](https://content.redpitaya.com/hs-fs/hubfs/blog%20featured%20image%20-%202026-05-05T152401.812.jpg?width=1920&height=1000&name=blog%20featured%20image%20-%202026-05-05T152401.812.jpg)

## Why Red Pitaya Gen 2 Matters Here

This type of experiment highlights where Red Pitaya STEMlab Gen 2 fits in an engineering workflow:

- Combines **oscilloscope, spectrum analyzer, and signal generator** in one device
- Provides **125 MS/s ADC/DAC** for mid-frequency analog work
- Enables **FPGA-level customization** for DSP pipelines
- Supports **SCPI, Python, and browser-based control**

For DSP, embedded, or FPGA engineers, it effectively bridges the gap between development board and lab instrumentation.

## Practical Implications for Engineers

If you are working on:

- Class-D amplifier design
- Audio DSP pipelines
- FPGA-based signal processing
- Mixed-signal validation

this experiment reinforces a few operational realities:

- Simulation alone is insufficient for PWM systems
- Spectral verification must include real switching artifacts
- Hardware-in-the-loop testing exposes filter limitations early
- Tooling flexibility (FPGA + measurement) reduces iteration time

## Read the Full Technical Breakdown

This summary only covers the key insights. The original article goes deeper into:

- Verilog PWM implementation
- Spectrum plots across resolutions
- FPGA workflow and deployment
- Detailed measurement methodology

Read the full article here:  
[Red Pitaya Gen 2: Analysis of an audio signal modulated using PWM | controlpaths.com](https://controlpaths.com/2026/03/15/red-pitaya-gen2-audio-pwm-signal/)

---

## FAQ

### **What is PWM audio modulation used for?**

Primarily in Class-D amplifiers, where efficiency is achieved by switching instead of linear amplification.

### **Why does PWM resolution affect frequency spectrum?**

Because resolution determines the division of the system clock, directly setting the carrier frequency and harmonic spacing.

### **Can Red Pitaya replace a spectrum analyzer?**

For many applications up to ~50 MHz bandwidth, yes. It provides sufficient resolution and flexibility for embedded and DSP work.

### **Why not just simulate PWM behavior?**

Simulation cannot capture analog effects such as switching noise, non-ideal filtering, and real hardware constraints.

### **Is this relevant beyond audio systems?**

Yes. The same principles apply to motor control, power electronics, and any PWM-based control system.

### About the Red Pitaya Team

 The Red Pitaya Technical Editorial Team is a cross-functional group of technical communicators and product specialists. By synthesizing insights from our hardware developers and global research partners, we provide verified, high-value content that bridges the gap between open-source innovation and industrial-grade precision.

 Our mission is to make advanced instrumentation accessible to engineers, researchers, and educators worldwide.

##### Categories

- [academia (47)](https://content.redpitaya.com/blog/tag/academia)

##### Recent Posts

- [![MaRCoS: An Open-Source MRI Control System Built with Red Pitaya SDRlab 122-16](https://content.redpitaya.com/hs-fs/hubfs/blog%20featured%20image%20-%202026-08-25T134239.841.jpg?width=767&name=blog%20featured%20image%20-%202026-08-25T134239.841.jpg)](https://content.redpitaya.com/blog/open-source-mri-control-system-sdrlab/)
  
  [MaRCoS: An Open-Source MRI Control System Built with Red Pitaya SDRlab 122-16](https://content.redpitaya.com/blog/open-source-mri-control-system-sdrlab/)
  
   September 15, 2026
- [![Scalable and Portable Fast Neutron Detection: Dual-Channel SiPM Readout with Red Pitaya FPGA DAQ](https://content.redpitaya.com/hs-fs/hubfs/blog%20featured%20image%20-%202026-08-24T092005.711.jpg?width=767&name=blog%20featured%20image%20-%202026-08-24T092005.711.jpg)](https://content.redpitaya.com/blog/scalable-compact-fast-neutron-detection-red-pitaya-sipm)
  
  [Scalable and Portable Fast Neutron Detection: Dual-Channel SiPM Readout with Red Pitaya FPGA DAQ](https://content.redpitaya.com/blog/scalable-compact-fast-neutron-detection-red-pitaya-sipm)
  
   September 8, 2026
- [![Autonomous Sub-100ms Laser Relocking in Trapped-Ion Quantum Experiments: Scaling the BLOOD Lockbox Architecture with Red Pitaya SoCs](https://content.redpitaya.com/hs-fs/hubfs/blog%20featured%20image%20-%202026-08-12T152830.130.jpg?width=767&name=blog%20featured%20image%20-%202026-08-12T152830.130.jpg)](https://content.redpitaya.com/blog/sub-100ms-automated-laser-relocking-red-pitaya-trapped-ion-quantum)
  
  [Autonomous Sub-100ms Laser Relocking in Trapped-Ion Quantum Experiments: Scaling the BLOOD Lockbox Architecture with Red Pitaya SoCs](https://content.redpitaya.com/blog/sub-100ms-automated-laser-relocking-red-pitaya-trapped-ion-quantum)
  
   September 1, 2026

##### Subscribe to our newsletter

![Red Pitaya](https://content.redpitaya.com/hubfs/raw_assets/public/Red_Pitaya_November_2021/images/redpitaya-logo-wh.svg "Red Pitaya")

An open-source solution for hobbyists, professors,  
 radio amateurs and industrial clients.

**Red Pitaya**  
Velika pot 21,  
5250 Solkan  
Slovenia, Europe  
Phone: +386 30 322 719  
Email: [info@redpitaya.com](mailto:info@redpitaya.com)

**Red Pitaya US**  
TX, Dallas - Downtown Republic Center  
325 N. St. Paul Street  
Suite 3100  
Dallas, Texas, 75202  
United States of America  
IMPORTANT: This address does not accept RMAs  
Phone: (888) 637-2706  
Email: [US.office@redpitaya.com](mailto:US.office@redpitaya.com)

- Customer Service 
    - [Customer Support](https://redpitaya.com/customer-support/)
    - [Shipping & Returns](https://redpitaya.com/shipping-returns/)
    - [Contact us](https://redpitaya.com/contact-us/)
    - [Cookie Policy](https://redpitaya.com/cookie-policy/)
- SLO 
    - [O nas](https://redpitaya.com/o-nas/)
    - [Pogoji poslovanja](https://redpitaya.com/pogoji-poslovanja/)
    - [Politika zasebnosti](https://redpitaya.com/politika-zasebnosti/)
    - [Politika piškotkov](https://redpitaya.com/politika-piskotkov/)

##### Follow Us

<https://www.facebook.com/redpitayaspark/> <https://twitter.com/RedPitayaCom> <https://www.youtube.com/c/RedPitayaTV> <https://www.linkedin.com/company/red-pitaya> <https://www.instagram.com/redpitayacom>

#### Subscribe to our newsletter

Get notified about new SW features & updates, news about latest community projects & events and new Red Pitaya products & discounts

[Subscribe](https://go.redpitaya.com/cs/c/?cta_guid=36ccbdc0-0344-49c4-aa91-aa67cf437c09&signature=AAH58kHkxFYTAKU-ILQzHI1jlrdI_co0RA&placement_guid=a24cb732-1dfb-4d0a-8c52-aa6851ce9102&click=556cfaee-eee4-48e4-95e7-c483a4f78883&hsutk=537e15e740555d2fd6a1c1ad931d2b6f&canon=https%3A%2F%2Fredpitaya.com%2Fabout-us%2F&utm_referrer=https%3A%2F%2Fredpitaya.com%2Fcompare%2F&portal_id=7715357&redirect_url=APefjpGj5Dm9poAAzHFGh4S6pJ-2TvNzBdwZZlfbr7toxfw-epFUtzEHOKToHx0i2TYYr39srj9aSERdntJBh8lJqoSXL-pUF2gwhYvOW6IMm28hQVmhYML2AIbbIRrr3YaoyJkZQ0iRxq-uHlFt66i3_8XpQpXT_M2zF9fS7t0f6hlBjGBJ7X_aXDrhBwXcEAqwoWWleG4uxonSGOR-BBp3tpKcySXYELTGHeGn5Yo61r3xrFvqFP5P6BxVwxTi51_ceW9uBzOMvA1rYz4BsIhLSF8n4bhcHqJTvhibH_laJrjDNdEUUrU&__hstc=72355340.537e15e740555d2fd6a1c1ad931d2b6f.1635738083317.1635738083317.1635746314170.2&__hssc=72355340.5.1635746314170&__hsfp=530052575&contentType=standard-page)

**Red Pitaya**  2025 All Rights Reserved.

- [Privacy Policy](https://redpitaya.com/privacy-policy/)
- [Terms of Use](https://redpitaya.com/terms-of-use/)

...

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Red Pitaya Technical Editorial Team",
    "url" : "https://content.redpitaya.com/blog/author/red-pitaya-technical-editorial-team"
  },
  "dateModified" : "2026-05-12T08:15:00.912Z",
  "datePublished" : "2026-05-12T08:15:00.000Z",
  "headline" : "PWM Audio Analysis with FPGA + Red Pitaya Gen 2",
  "image" : [ "https://content.redpitaya.com/hubfs/blog%20featured%20image%20-%202026-05-05T152338.466.jpg" ],
  "mainEntityOfPage" : {
    "@id" : "https://content.redpitaya.com/blog/red-pitaya-gen2-pwm-audio-spectrum-analysis",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://content.redpitaya.com/hubfs/Red-pitaya-logo.jpg"
    },
    "name" : "Red Pitaya d.o.o."
  }
}
```