Project information
- Date: June 10 – June 28, 2023
- Language: Java
- Libraries: Java Swing, javax.sound.midi
- GitHub: zkarim28/MIDIVisualizer
- Demo 1: Wait for It (Hamilton)
- Demo 2: Forever (Chris Brown)
Java
Swing
MIDI
Multi-threading
GUI
Piano
Summary
MIDI Visualizer is a live visual effects program for MIDI keyboards. Notes stream upward from the bottom of the screen with color intensity based on key-press velocity — harder strikes produce brighter, more saturated note bars. The project was originally prototyped in Python as a video overlay concept for piano performances, then rebuilt from scratch in Java for performance and threading control.
Architecture
The application runs two parallel threads to decouple time-sensitive MIDI input from rendering:
- MIDI thread: Listens to the system MIDI device via
javax.sound.midi, processes NoteOn/NoteOff events, and enqueues note state updates using thread-safe data structures - GUI thread: Java Swing event dispatch thread reads note state and repaints the canvas at a fixed frame rate, drawing and animating active note bars
Separating these threads eliminated concurrency exceptions that occurred when MIDI callbacks attempted to directly mutate Swing component state.
Features
- Velocity-mapped color: soft touches render cool blue tones, hard strikes render bright white/yellow
- Smooth upward animation with configurable note scroll speed
- Works with any MIDI keyboard connected as a system MIDI device