GitHunt
JU

JuanCantu1/fpga-trumpet-dsp

Real-time trumpet audio enhancement system with note detection, frequency analysis, and live DSP effects implemented across the DE1-SoCโ€™s ARM processor and Cyclone V FPGA.

๐ŸŽบ FPGA-Based Digital Signal Processor for Trumpet Audio Enhancement

๐Ÿ“ Overview

This project develops a real-time audio enhancement system for trumpet using the DE1-SoC FPGA.
It combines Python-based frequency detection with Verilog-based DSP modules to enhance live trumpet sound in hardware.
The system currently simulates all DSP modules in Vivado and interfaces through Python for signal analysis and audio verification.

๐ŸŽฏ Goal: Create a modular FPGA pipeline capable of real-time autotune, reverb, compression, noise gating, and tonal enhancement โ€” optimized for brass performance.


๐Ÿงฉ System Architecture

Each block can be toggled independently from the top-level module audio_processor.v, enabling flexible experimentation and effect chaining.


๐ŸŽฌ Demonstration

๐ŸŽฅ Watch the system in action
๐Ÿ“ Demo.mp4 โ€” Demonstrates live pitch detection, note mapping, and real-time graphing.
๐Ÿ”Š Make sure your volume is on!

Demo.mp4


๐Ÿ”ง Design Summary

The system is composed of modular Verilog DSP blocks and a Python-based front end for preprocessing and analysis.
The FPGA operates entirely in fixed-point arithmetic, streaming one 16-bit audio sample per clock cycle.

Module Description Control Signal
noise_gate Suppresses background noise below threshold enable_noise_gate
autotune Detects pitch and corrects to nearest musical note enable_autotune
tone_filter Smooths transitions, reduces harsh tones enable_tone_filter
reverb Adds room ambience and spatial depth enable_reverb
compressor Balances dynamic range of performance enable_compressor
resonator Adds formant resonance to enhance brightness enable_resonator
trumpet_warmer Adds analog-style harmonic warmth enable_warmer
harmonic_exciter Restores lost overtones in filtered signals enable_exciter

Each module has adjustable parameters (thresholds, hold times, gain factors, mix ratios), allowing easy customization.


๐Ÿง  Simulation and Analysis Workflow

  1. Audio Preprocessing (Python)

    • Convert .wav โ†’ .mem for Verilog simulation.
    • Normalize amplitudes and segment test samples.
  2. FPGA Simulation (Vivado XSIM)

    • Feed .mem vectors into audio_tb.v.
    • Enable or disable modules via control signals.
    • Output processed audio as .mem.
  3. Post-Processing (Python)

    • Convert .mem โ†’ .wav for playback.
    • Plot waveform and spectrogram comparisons.

๐ŸŽง Example: Trumpet C Scale Processing

A real trumpet C scale recording was used as a test case for pipeline validation.
Below are waveform and spectrogram comparisons before and after DSP processing.

๐Ÿ“‰ Waveform Comparison

๐ŸŒˆ Spectrogram Comparison


๐Ÿ”ฉ RTL Architecture

RTL Schematic of Audio Processor

Each module is instantiated within the top-level audio_processor.v as a streaming DSP chain, operating at 48 kHz sample rate.
Simulation results confirm sub-15 ms latency across the entire path, suitable for real-time performance.


๐Ÿงฐ Development Environment

Domain Tools / Frameworks
FPGA Design Verilog, Vivado 2023.1, Quartus (DE1-SoC)
Audio Processing Python, NumPy, Librosa, Matplotlib
Conversion Tools Custom .wav โ†” .mem converters
Simulation Vivado XSIM testbench (audio_tb.v)
Platform Cyclone V SoC with WM8731 audio codec

โš™๏ธ Parameters and Tuning

Parameter Description Typical Range
THRESHOLD Noise gate level 100 โ€“ 2000
MIX_SHIFT Reverb/Tone mix coefficient 0 โ€“ 15
FRAME_SIZE Autotune window 512 โ€“ 2048
SAMPLE_RATE Audio sample rate 48 000 Hz
HOLD_TIME Noise gate release cycles 5 โ€“ 15

๐Ÿงช Performance Goals & Target Metrics

Metric Target / Goal Description
Latency < 15 ms end-to-end Maintain imperceptible delay for real-time playability in live trumpet performance.
SNR (Signal-to-Noise Ratio) > 60 dB Achieve clean output with effective noise gating and dynamic range compression.
Pitch Accuracy ยฑ1 semitone Autotune should stabilize pitch within one semitone of target note for live input.
Fixed-Point Precision 16-bit Maintain high-quality DSP processing using resource-efficient arithmetic.
Resource Utilization < 70 % LUT, < 60 % FF Ensure design fits comfortably within Cyclone V FPGA fabric for real-time operation.
Sample Rate 48 kHz Match standard audio rate for compatibility with WM8731 codec and real-time systems.
System Throughput 1 sample/clk Fully pipelined design enabling continuous audio streaming without stalls.

๐Ÿ“‚ Repository Structure

fpga-trumpet-dsp/
โ”œโ”€ verilog/
โ”‚  โ”œโ”€ src/           # All DSP modules (autotune, tone_filter, compressor, etc.)
โ”‚  โ””โ”€ sim/           # audio_tb.v + sample .mem data
โ”‚
โ”œโ”€ python/
โ”‚  โ”œโ”€ io/            # wav_to_mem.py, mem_to_wav.py converters
โ”‚  โ”œโ”€ analysis/      # waveform, spectrogram, and pitch comparison scripts
โ”‚  โ””โ”€ synth/         # sinewave and trumpet-scale generators
โ”‚
โ”œโ”€ sub_project_iot/   # IoT project that started the DSP
โ”‚  โ”œโ”€ Client Folder/  # Python client for frequency visualization
โ”‚  โ”œโ”€ Server Folder/  # Server collecting frequency data
โ”‚  โ”œโ”€ media/          # Preliminary_Design.jpg, any figures
โ”‚
โ”œโ”€ docs/
โ”‚  โ”œโ”€ IoT_Frequency_Analysis_System_for_Musical_Instruments.pdf
โ”‚  โ”œโ”€ schematic.pdf
โ”‚  โ”œโ”€ rtl.jpg
โ”‚  โ””โ”€ System_Diagram.png
โ”‚
โ”œโ”€ media/
โ”‚  โ””โ”€ Demo.mp4        # IoT Sub Project Demo
โ”‚
โ”œโ”€ LICENSE
โ””โ”€ README.md


๐Ÿ“ก Frequency Analysis & Visualization Framework

A complementary system for real-time frequency detection, TCP/IP data logging, and visualization.
Originally developed as the prototype for HPS-side pitch tracking on the DE1-SoC, it now serves as a front-end analysis and validation tool for the FPGA DSP pipeline.
It provides live spectral feedback and note mapping used during the early development phase of the trumpet audio processor.

๐Ÿ“„ Read the Paper: IoT Frequency Analysis System for Musical Instruments (PDF)


๐Ÿ“š Technologies

Verilog ยท Python ยท Vivado ยท NumPy ยท Librosa ยท Cyclone V FPGA ยท Audio DSP ยท Embedded Systems


๐Ÿ“œ License

MIT License โ€” open for academic, educational, and research use.

JuanCantu1/fpga-trumpet-dsp | GitHunt