A Python-based audio visualizer that generates reactive graphics from audio files. It supports real-time visualization and rendering to video files.
- Audio Analysis: Uses
librosaandnumpyfor FFT-based frequency analysis. - Visuals: Renders a circular bar visualizer with smooth gradients and customizable aesthetics using
pygame/pyglet. - Configuration: Fully configurable via
src/config.py(resolution, colors, smoothing, FFT size, etc.). - Video Export: Capability to render the visualization to an MP4 video file.
- GPU Acceleration: Includes a helper script for NVIDIA PRIME offloading on Linux.
- Python 3.x
- FFmpeg (required for video export audio merging)
-
Clone the repository (if you haven't already):
git clone https://github.com/volt-l18/audio_visualizer.git cd audio_visualizer -
Create and activate a virtual environment:
python -m venv .env source .env/bin/activate # On Linux/macOS # .env\Scripts\activate # On Windows
-
Install dependencies:
pip install -r requirements.txt
-
Install FFmpeg:
- Linux (Arch):
sudo pacman -S ffmpeg - Linux (Debian/Ubuntu):
sudo apt install ffmpeg - Windows: Download from ffmpeg.org and add to PATH.
- Linux (Arch):
-
Add Audio: Place your audio files (mp3, wav, flac, etc.) in the
assets/audio/directory. The application will automatically pick the first supported file found. -
Configuration: Edit
src/config.pyto adjust settings:EXPORT_VIDEO: Set toTrueto save an MP4,Falsefor real-time window only.WINDOW_WIDTH/WINDOW_HEIGHT: Set render resolution.BAR_COLOR_START/BAR_COLOR_END: Change color gradients.
-
Run:
Standard run:
python src/main.py
On Linux with NVIDIA GPU (PRIME offloading):
./run_visualizer.sh
If video export is enabled, the resulting video will be saved to outputs/output.mp4.