Build log · Music & Audio
How I built Strandfall
A drum toy where synthesized hits light a warehouse full of LED strands

1.Why I built it
Strandfall is a dark warehouse hung with LED strands, with dot-matrix data raining down each strand and spilling into glowing cable coils on the floor. You play the drums and the room responds: the kick washes the hall and sends a wave through every strand, the snare throws red glitches, hats sparkle, toms reshuffle the hanging counter panels, and the crash lights the room, swaps the palette and re-syncs the wall.
I wanted it to work as a toy on its own and as a visualizer, so it has a groove sequencer for when you don't want to play, a text box to feed your own words into the stream, and a mic Listen mode that reacts to whatever music is playing nearby.
2.How it works
Drums from oscillators and filtered noise
Every drum is two helpers combined. tone is an oscillator with an exponential pitch sweep and an exponential gain envelope. noiseHit plays a slice of a two second white noise buffer through a biquad filter. The kick is a sine sweeping from 165 Hz to 42 Hz plus a tiny highpassed click, the snare is bandpassed noise at 1900 Hz over a short triangle tone, the hat is noise highpassed at 7600 Hz, and the crash layers two noise bands with a low sine thump.
All of it runs through a dynamics compressor, and some sounds also go to a 270 ms feedback delay with a lowpass in the loop. Brushing a strand plays a soft triangle note picked from a pentatonic table by how high up the strand you touched.
Patterns as strings, scheduled ahead
The four grooves (Breaks, Motorik, Halftime, Rush) are stored as 16 character strings per drum, like x...x...x...x..., with a BPM each. The sequencer walks a step index and schedules every step whose time falls within the next 0.12 seconds of the audio clock. If the tab was hidden and the next step is far in the past, it jumps forward instead of firing a burst.
The visual effect for a scheduled hit is pushed onto a queue with its audio time, and the simulation pops it only once currentTime reaches it. That keeps the lights in sync with what you hear even though sounds are scheduled ahead. The drum pads are lit by direct DOM writes, since the sequencer fires far too often to route through React state.
LED strands as decaying pixel buffers
Each strand is a column five LEDs wide with LEDs 4.5 cm apart on a 5.3 m rig. Characters come from a hand-written 5x7 bitmap font where each row is a binary string parsed with parseInt(row, 2). Falling glyphs stamp their bits into a per-strand brightness buffer, and every frame that buffer decays by exp(-dt * 7.5), which produces the trailing glow without storing any history.
Whatever reaches the bottom row is injected into a 150 cell coil buffer that shifts along with copyWithin at 34 cells per second and decays much more slowly, so data visibly flows off the strand and around the cable on the floor. Strands swing as damped pendulums, integrating -g/L * sin(theta) with a damping term and clamping the angle, so dragging through them pushes them and they settle back.
Drawing thousands of LEDs cheaply
Changing fillStyle is one of the slower things you can do in Canvas 2D, so LEDs are bucketed by palette colour and one of ten brightness levels before drawing. Each frame then needs only a few dozen fill style changes regardless of how many LEDs are lit. The whole scene is projected with a small yaw and perspective function from a fixed camera height.
Bloom is done by drawing the LED layer into an offscreen canvas at a quarter of the resolution, then downsampling that again to a twelfth, and drawing both back over the scene scaled up with image smoothing on. The backdrop is a warehouse image I generated with gpt-image-2.5, with a procedural fallback that draws the floor, rig bar and roof trusses in the same projection if the image fails to load.
Listening to the mic
Listen mode opens the mic with echo cancellation, noise suppression and auto gain turned off, then reads an AnalyserNode with an FFT size of 1024. It averages three bands, 40 to 160 Hz for kicks, 1200 to 3500 Hz for snares and 6000 to 14000 Hz for hats.
Each band keeps a running average updated as avg * 0.93 + energy * 0.07. A hit fires when the current energy exceeds 1.3 times that average plus a small constant, with a short refractory window per band. It is a crude onset detector but it is enough to make the room follow a beat.
3.Try it
Hit A S D F G (or the pads) for kick, snare, hat, tom and crash, start a groove pattern, type words to feed the strands, drag to brush them, or turn on Listen to react to the mic.


