Skip to content

GPU-powered batch FFT analysis of instrument audio samples using CUDA and cuFFT. Visualizes both time and frequency domains with Python—fast, scalable, and beautifully plotted.

Notifications You must be signed in to change notification settings

aditiisaxena/CUDA-Audio-FFT-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎧 CUDA Audio FFT Analysis

📌 Overview

This project demonstrates high-performance parallel processing of audio signals using NVIDIA CUDA and cuFFT, implemented in C++ and compiled via nvcc. The workflow automates the process of reading .wav audio files, computing their Fast Fourier Transform (FFT) on the GPU, and outputting both time-domain and frequency-domain representations as plots using Python and Matplotlib.

The core idea is to showcase GPU-accelerated signal processing at scale, enabling fast and efficient transformation and visualization of audio data.

🚀 Features

✅ GPU-based FFT using cuFFT

✅ Header-only WAV parsing (no external dependencies)

✅ Time and Frequency domain signal export

✅ Beautiful Python dual-domain plots

✅ Supports batch processing of multiple audio files

🧠 CUDA + Signal Processing

The CUDA component of the project loads audio samples into GPU memory and performs cuFFT on each signal buffer. Output is collected in CSV format for both:

  • Time Domain: Raw waveform amplitude values
  • Frequency Domain: FFT magnitudes for each frequency bin

Each audio sample is processed in parallel, making it scalable across multiple .wav files.

📊 Signal Visualization

The script/plot_signal.py script generates side-by-side visualizations for each audio file:

🎼 bachfugue.wav

Bach Fugue Plot

  • Time Domain: Shows a dynamic and expressive waveform with strong amplitude peaks—expected from a rich polyphonic piece.
  • Frequency Domain: Captures broad harmonic content, dense frequency components indicating musical complexity.

🎸 bass.wav

Bass Plot

  • Time Domain: Sparse waveform with decaying low-frequency vibrations—typical for a bassline.
  • Frequency Domain: Dominant low-end frequencies, validating expected frequency distribution for bass instruments.

⚙️ How to Build & Run

  1. Clean and Compile the CUDA Project
make clean
make
  1. Run the Full Audio FFT Pipeline
bash run.sh

This step runs the compiled program, processes all audio .wav files, and saves FFT output as .csv files in the output/ directory.

  1. Plot All FFT Signals
make plot

This visualizes each signal’s time and frequency domains, saving PNG plots to the plot/ directory with names matching the original audio files.

🔁 Automation

You can also execute the full pipeline using:

./run.sh

This compiles, processes audio files, and generates plots in one go.

📦 Dependencies

CUDA/C++

  • nvcc
  • cuFFT

Python

  • matplotlib
  • numpy
  • sys / os

Install Python dependencies via:

pip install matplotlib numpy

📸 Credits & Acknowledgments


Made by Aditi Saxena

About

GPU-powered batch FFT analysis of instrument audio samples using CUDA and cuFFT. Visualizes both time and frequency domains with Python—fast, scalable, and beautifully plotted.

Topics

Resources

Stars

Watchers

Forks