Real-Time Audio Visualization

ColorfulSound

Transform your music into a mesmerizing light show with real-time FFT audio analysis and Arduino-controlled RGB LEDs

2048 Sample Buffer
7 Rainbow Colors
60 FPS Analysis

Powerful Features

Everything you need to create stunning audio-reactive lighting

Real-Time FFT Analysis

2048-sample buffer FFT processing using the Minim audio library for precise frequency decomposition

Minim Library

Beat Detection

Dual-mode detection combining overall energy onset with frequency-range beat analysis for accurate rhythm tracking

100ms Sensitivity

Rainbow Color Blending

Maps 7 rainbow colors (ROYGBIV) to frequency bands with smooth weighted averaging for seamless transitions

ROYGBIV Spectrum

Cross-Platform

Runs seamlessly on Windows, Linux, macOS, and Raspberry Pi with automatic platform detection

Java 8+

Arduino Integration

Direct serial communication with Arduino boards via RXTX library for real-time LED control

9600 Baud

Visual Debugging

Optional Processing-based visualization window for real-time monitoring of beat detection and frequency analysis

Processing

How It Works

From sound waves to RGB brilliance in milliseconds

01

Audio Input

Captures stereo audio via Minim with 2048 sample buffer

02

FFT Analysis

Decomposes audio into frequency spectrum for band isolation

03

Beat Detection

Identifies beats using energy onset and frequency analysis

04
ROYGBIV

Color Mapping

Maps frequencies to rainbow spectrum with smooth blending

05

RGB Output

Sends RGB values to Arduino via serial at 9600 baud

Frequency to Color Mapping

Low Frequencies High Frequencies
Red Bass
Orange
Yellow
Green Mids
Blue
Indigo
Violet Treble

System Architecture

A robust multi-threaded design for real-time performance

Input Layer
Audio Input (Minim)
Processing Layer
Beat Detection
FFT Analysis
Color Mapping
Output Layer
System Tray UI
Visualization
RGB LEDs

Threading Model

Audio Thread Minim
  • Sample capture
  • Beat detection
  • Color calculation
Queue Worker Executor
  • Process queue
  • Serial write
  • Order guarantee
Update Thread 15ms Loop
  • Decay radius
  • Refresh LEDs
  • State sync
BlockingQueue<Runnable>

Quick Start

Get your lights dancing in minutes

Prerequisites

Java 8+
Arduino IDE
RGB LED Strip
Arduino Board
1

Upload Arduino Firmware

C++ colorfulsound.ino
int redPin = 11;    // PWM pin for red
int greenPin = 10;  // PWM pin for green
int bluePin = 9;    // PWM pin for blue

// For common anode LEDs, uncomment:
// #define COMMON_ANODE
2

Wire Your Circuit

Arduino Uno
D11
D10
D9
GND
RGB LED

Use 220-330 ohm current limiting resistors

3

Configure Audio Input

Enable Stereo Mix in Recording devices

  1. Right-click speaker icon
  2. Sounds > Recording tab
  3. Enable Stereo Mix
  4. Set as Default Device
pactl load-module module-loopback

Use BlackHole or Soundflower

4

Run ColorfulSound

Bash Terminal
# Cross-platform JAR
java -jar exe/ColorfulSound.jar

# Windows executable
exe/ColorfulSound.exe
Your LEDs should now react to audio!

Live Demo

Watch ColorfulSound transform audio into mesmerizing light shows

RGB LEDs in Action

Full color spectrum responding to music beats

Frequency Visualization

Real-time beat detection and color mapping

Technology Stack

Java 8 Core Application
Arduino Firmware
Processing Visualization
Minim Audio & FFT
RXTX Serial Comm

Ready to Light Up Your Music?

Star the repo, contribute, or sponsor the project