🎵 Integrated audio reactive LED controller for WS2812B/WS281x LED strips with support for multiple input sources and real-time effects.
# Clone the repository (as Glimmer)
git clone https://github.com/LiquenOpS/Glimmer-NeoPixelController.git Glimmer
cd Glimmer
# Run setup
./setup.sh- 🎨 Multiple LED Effects: 15+ audio-reactive effects including spectrum bars, VU meter, fire, waterfall, and more
- 📡 Multiple Input Sources:
- UDP: EQ Streamer format (32 bands)
- UDP: WLED Audio Sync format (V1/V2, 16 bands)
- 💡 Hardware Support: Real WS2812B LED strips via rpi_ws281x
- 🔮 Emulator Mode: Terminal-based simulator for development without hardware
- 🌐 HTTP API: RESTful API for remote control and configuration
- ⚙️ Flexible Configuration: JSON-based configuration with hierarchical structure
- 🔄 Playlist System: Automatic effect rotation with playlist-based configuration
- 🎛️ Dual Mode Control: Playlist mode (auto-rotation) and manual mode (direct effect switching)
- 🎛️ Real-time Control: Keyboard controls and HTTP API for live adjustments
- Python 3.7+
- Raspberry Pi (for real LED hardware) or any Linux/macOS system (for emulator mode)
numpy- Audio processingFlask- HTTP API serverFlask-CORS- CORS support for APIrpi-ws281x- LED control (Raspberry Pi only, optional for emulator)
Run the setup script to create a virtual environment and install dependencies:
./setup.shThis will:
- Create a Python virtual environment
- Install all required dependencies
- Create
config/fromconfig.example(contains config.jsonc)
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# For Raspberry Pi (real LEDs):
pip install rpi-ws281x
# Copy config template
cp -r config.example configReal LED Mode (Raspberry Pi):
./run.sh
# Or with sudo for GPIO: sudo ./run.shEmulator Mode (Development/Testing):
./run.sh --simulatorLED Options:
-n, --num-leds N Number of LEDs (default: 60 for simulator, 420 for real)
-p, --pin PIN GPIO pin (default: 18)
-e, --effect EFFECT LED effect (default: spectrum_bars)
Simulator Options:
--simulator Use terminal emulator instead of real LEDs
--display MODE Display mode: horizontal, vertical, grid (default: horizontal)
--curses Enable curses UI (simulator only)
Audio Input Options:
--audio-port PORT Audio input UDP port (default: 31337)
--format FORMAT UDP protocol: auto, wled, eqstreamer (default: auto)
HTTP API Options:
--api-port PORT HTTP API port (default: 1129)
--no-api Disable HTTP API server
# Run with emulator, 60 LEDs, horizontal display
python3 main.py --simulator --num-leds 60 --display horizontal
# Run with real LEDs, custom GPIO pin
python3 main.py --pin 13 --num-leds 420
# Run with specific effect
python3 main.py --effect fire
# Run with custom audio input port
python3 main.py --audio-port 5000
# Run without HTTP API
python3 main.py --no-apiWhen running (non-curses mode):
n- Next effect (switches to manual mode)p- Previous effect (switches to manual mode)r- Resume playlist mode (auto-rotation)1-9, 0- Jump to specific effect (0 = first effect, 1-9 = effects 2-10)h- Show helpq- Quit
Note: Manual switching (n/p keys or number keys) exits playlist mode. Use r key or POST /api/playlist/resume to return to auto-rotation.
Configuration is stored in config/config.jsonc (JSONC: JSON with // comments). Copy config.example to config (run ./setup.sh) and customize:
{
"runtime": {
"effects_playlist": ["spectrum_bars", "vu_meter", "fire"],
"rotation_period": 10.0
},
"audio": {
"volume_compensation": 1.0,
"auto_gain": false
},
"effects": {
"rainbow": {
"speed": 10,
"brightness": 255
}
},
"network": {
"audio_port": 31337,
"audio_format": "auto",
"api_port": 1129
},
"simulator": {
"display_mode": "horizontal"
},
"hardware": {
"num_leds": 420,
"pin": 18,
"supported_effects": ["off", "rainbow", "spectrum_bars", ...]
}
}runtime.effects_playlist: Array of effects to rotate automatically (rotation enabled when >1 effect)runtime.rotation_period: Seconds between effect changeshardware.supported_effects: List of effects this hardware supportsaudio.*: Audio processing settings (applies to all audio-reactive effects)effects.*: Effect-specific settings (e.g.,effects.rainbow.speed)network.*: Network settings (audio port, API port)simulator.*: Simulator display settingshardware.*: Hardware settings (LED count, GPIO pin)
⚠️ Breaking Changes: If upgrading from v2025-11-29, see Breaking Changes Guide for migration instructions.
The controller exposes a RESTful HTTP API on port 1129 (default).
Get current status and statistics.
Get current configuration.
Update configuration. Supports hierarchical structure and dot notation:
# Set playlist with multiple effects
curl -X POST http://localhost:1129/api/config \
-H "Content-Type: application/json" \
-d '{"runtime": {"effects_playlist": ["spectrum_bars", "vu_meter"], "rotation_period": 10.0}}'
# Update nested config (hierarchical)
curl -X POST http://localhost:1129/api/config \
-H "Content-Type: application/json" \
-d '{"effects": {"rainbow": {"speed": 10, "brightness": 200}}}'
# Update using dot notation
curl -X POST http://localhost:1129/api/config \
-H "Content-Type: application/json" \
-d '{"runtime.rotation_period": 15.0, "audio.volume_compensation": 2.0}'Set effect directly (exits playlist mode):
curl -X POST http://localhost:1129/api/effect/set \
-H "Content-Type: application/json" \
-d '{"effect": "fire"}'Resume playlist mode (switch back to auto-rotation):
curl -X POST http://localhost:1129/api/playlist/resumeAdd effect to playlist:
curl -X POST http://localhost:1129/api/playlist/add \
-H "Content-Type: application/json" \
-d '{"effect": "waterfall"}'Remove effect from playlist:
curl -X POST http://localhost:1129/api/playlist/remove \
-H "Content-Type: application/json" \
-d '{"effect": "waterfall"}'Use the test script:
python3 tests/test_api.pyMake sure the controller is running first!
spectrum_bars- Frequency spectrum barsvu_meter- VU meter stylerainbow_spectrum- Rainbow spectrum visualizationfire- Fire effectfrequency_wave- Frequency wave visualizationblurz- Blur effectpixels- Pixel-based effectpuddles- Puddle effectripple- Ripple effectcolor_wave- Color wavewaterfall- Waterfall visualizationbeat_pulse- Beat pulse effectwhite_segments- White segmentswhite_arrow- White arrowwhite_marquee- White marquee
Run ./setup.sh and choose "Install systemd service", or manually:
sed 's|@INSTALL_DIR@|/path/to/Glimmer|' ops/systemd/glimmer.service | sudo tee /etc/systemd/system/glimmer.service
sudo systemctl daemon-reload
sudo systemctl enable --now glimmerCheck status:
sudo systemctl status glimmer- View logs:
# Real-time logs
sudo journalctl -u glimmer -f
# Recent logs (last 100 lines)
sudo journalctl -u glimmer -n 100.
├── main.py # Main application
├── run.sh # Start Glimmer (manual or systemd)
├── setup.sh # One-time setup
├── ws281x_emulator.py # Terminal LED emulator
├── config.example/ # Config template (copy to config/)
│ └── config.jsonc
├── ops/
│ └── systemd/glimmer.service
├── requirements.txt
├── tests/
└── archive/
The emulator (ws281x_emulator.py) provides a terminal-based visualization of LED effects, perfect for development without hardware:
# Run emulator demo
python3 ws281x_emulator.py
# Use in main application
python3 main.py --simulatorTest scripts are located in the tests/ directory:
# Test HTTP API
python3 tests/test_api.py
# Test LED control
python3 tests/ws2812_control.pyIf you get Can't open /dev/mem: Permission denied errors:
Option 1: Add user to gpio group:
sudo usermod -a -G gpio $USER
# Log out and back inOption 2: Run with sudo:
sudo $(which python3) ./main.py- Check firewall settings
- Verify audio input port is correct (default: 31337)
- Test with:
nc -u -l 31337on another machine