
Digital Chladni
A MIDI keyboard that plays sand.
ROLE
ROLE
Concept, code, sound design and zine by Bryan Chi Hun Lai. The first version was written by hand, section by section, for a course with a no AI rule. The second version was built with the help of Gemini.
THE IDEA
THE IDEA
In 1787 Ernst Chladni bowed a metal plate scattered with sand and showed that sound has shape. Digital Chladni rebuilds that plate in the browser and makes it playable from a MIDI keyboard. The tutorials it began from drew static patterns. This version plays them. Each note is mapped to the just intonation ratio of its interval, and that ratio becomes the plate’s vibration mode, so a perfect fifth draws a 3:2 figure and a major third draws 5:4. Chords superpose into patterns that exist only while the notes are held, figures no physical plate can hold at once. When no one is playing, the sand drifts back to spell the title.
HOW IT WORKS
HOW IT WORKS
Five thousand grains move by random agitation rather than simulated physics. Each frame, a grain reads the plate’s vibration beneath it. Where the plate is loud the grain is thrown, and where it is still the grain barely moves, so over a few seconds the grains collect on the nodal lines the way real sand does. The wave function follows Paul Bourke’s model, with the sign flipped from minus to plus so that patterns along the diagonal fill instead of canceling. Notes arrive over WebMIDI, and a low drone, square wave chords and a gliding lead play through long delays and reverb. Built in p5.js and p5.sound.
WHERE IT WENT
WHERE IT WENT
Made for Craig Fahner’s course, NYU Tandon, Fall 2025. Installed on a CRT monitor with a 25 key MIDI keyboard at Tandon @ The Yard, NYU’s virtual production studio at the Brooklyn Navy Yard, where visitors have used it to play songs they already know and watch them turn into geometry. Accompanied by The Chladni Field Guide, an eight page zine printed on the NYU Risograph.
THE FIELD GUIDE
From The Chladni Field Guide, the zine that accompanies the piece.
The Equation
The patterns are not random. They are the result of a precise mathematical wave function calculated for vibrations on a square plate.
cos(nx) · cos(my)− cos(mx) · cos(ny)
Imagine the equation as a topographic map. The “peaks” are where the plate moves. The “valleys” are where it is still.
Field note: the sign swap. The standard equation uses a minus. However, when n = m, this cancels out to zero along the diagonal. We use a plus to invert the phase, ensuring the diagonal is filled with grid intersections.
Sand Physics
Why does the sand move? It is pushed by constructive interference (loudness) and trapped by destructive interference (silence).
Unlike standard Newtonian physics, which relies on gravity and velocity, this simulation relies on stochastic probability: a system determined by random steps. While we cannot predict the path of a single grain, we can predict the average behavior of the entire swarm.
We do not tell the particles where to go. We simply agitate them. Each frame, a particle checks the “loudness” of the ground beneath it.
1. GET Vibration at (x,y)2. IF Vibration > 0: SHAKE = 25px (Teleport)3. ELSE: SHAKE = 0.5px (Trapped)
If the ground is loud (white), the particle is ejected violently. If the ground is quiet (black), the particle vibrates gently. Over time, order emerges from chaos as particles are naturally trapped in the quiet zones.
Visual Tuning
This is the bridge between sound and sight. We translate musical frequencies into integer modes (m,n).
|
|
|
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
We mapped the white keys (the diatonic scale) using the just intonation ratios found in physics. We plug these ratios directly into the Chladni variables (m,n) to create a visual representation of the pure interval.
Superposition
To visualize a chord, we must look to the principle of superposition. In physics, waves do not collide like solid objects. They pass through one another, their energies adding and subtracting in real time.
Σ (Wave A + Wave B...) / N
Our code uses a Set() data structure to track active notes.
1. Create 'activeNotes' Set.2. On KeyPress, add note to Set.3. Loop through Set.4. Calculate wave for each note.5. Sum all waves and Divide by Count.
Destructive interference: where one wave pushes up and another pushes down, they cancel out to zero. This creates new “safe zones” (nodes) that only exist within the chord.
The Protocol
How does the browser talk to the keyboard? We use the WebMIDI API, a browser standard that allows JavaScript to communicate directly with musical hardware connected to your computer, like USB keyboards.
navigator.requestMIDIAccess().then(onSuccess, onFailure)
It opens a direct data stream (a pipe) between the hardware and the browser tab. When you press a key, the keyboard sends a tiny packet of data.
[144, 60, 100]Note On, C4, Velocity
Our code intercepts this packet instantly and triggers the visual engine.
CREDITS
CREDITS
Mathematics after Paul Bourke. Static pattern approach after tutorials by Pat Valli. WebMIDI and p5.js support from Craig Fahner. Riso printing with Scarlett Wang. Physics after Ernst Chladni, 1787. Second version built with the help of Gemini.
Other Projects
Other Projects
[02]
[02]

Digital Chladni
A MIDI keyboard that plays sand.
ROLE
ROLE
Concept, code, sound design and zine by Bryan Chi Hun Lai. The first version was written by hand, section by section, for a course with a no AI rule. The second version was built with the help of Gemini.
THE IDEA
THE IDEA
In 1787 Ernst Chladni bowed a metal plate scattered with sand and showed that sound has shape. Digital Chladni rebuilds that plate in the browser and makes it playable from a MIDI keyboard. The tutorials it began from drew static patterns. This version plays them. Each note is mapped to the just intonation ratio of its interval, and that ratio becomes the plate’s vibration mode, so a perfect fifth draws a 3:2 figure and a major third draws 5:4. Chords superpose into patterns that exist only while the notes are held, figures no physical plate can hold at once. When no one is playing, the sand drifts back to spell the title.
HOW IT WORKS
HOW IT WORKS
Five thousand grains move by random agitation rather than simulated physics. Each frame, a grain reads the plate’s vibration beneath it. Where the plate is loud the grain is thrown, and where it is still the grain barely moves, so over a few seconds the grains collect on the nodal lines the way real sand does. The wave function follows Paul Bourke’s model, with the sign flipped from minus to plus so that patterns along the diagonal fill instead of canceling. Notes arrive over WebMIDI, and a low drone, square wave chords and a gliding lead play through long delays and reverb. Built in p5.js and p5.sound.
WHERE IT WENT
WHERE IT WENT
Made for Craig Fahner’s course, NYU Tandon, Fall 2025. Installed on a CRT monitor with a 25 key MIDI keyboard at Tandon @ The Yard, NYU’s virtual production studio at the Brooklyn Navy Yard, where visitors have used it to play songs they already know and watch them turn into geometry. Accompanied by The Chladni Field Guide, an eight page zine printed on the NYU Risograph.
THE FIELD GUIDE
From The Chladni Field Guide, the zine that accompanies the piece.
The Equation
The patterns are not random. They are the result of a precise mathematical wave function calculated for vibrations on a square plate.
cos(nx) · cos(my)− cos(mx) · cos(ny)
Imagine the equation as a topographic map. The “peaks” are where the plate moves. The “valleys” are where it is still.
Field note: the sign swap. The standard equation uses a minus. However, when n = m, this cancels out to zero along the diagonal. We use a plus to invert the phase, ensuring the diagonal is filled with grid intersections.
Sand Physics
Why does the sand move? It is pushed by constructive interference (loudness) and trapped by destructive interference (silence).
Unlike standard Newtonian physics, which relies on gravity and velocity, this simulation relies on stochastic probability: a system determined by random steps. While we cannot predict the path of a single grain, we can predict the average behavior of the entire swarm.
We do not tell the particles where to go. We simply agitate them. Each frame, a particle checks the “loudness” of the ground beneath it.
1. GET Vibration at (x,y)2. IF Vibration > 0: SHAKE = 25px (Teleport)3. ELSE: SHAKE = 0.5px (Trapped)
If the ground is loud (white), the particle is ejected violently. If the ground is quiet (black), the particle vibrates gently. Over time, order emerges from chaos as particles are naturally trapped in the quiet zones.
Visual Tuning
This is the bridge between sound and sight. We translate musical frequencies into integer modes (m,n).
|
|
|
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
We mapped the white keys (the diatonic scale) using the just intonation ratios found in physics. We plug these ratios directly into the Chladni variables (m,n) to create a visual representation of the pure interval.
Superposition
To visualize a chord, we must look to the principle of superposition. In physics, waves do not collide like solid objects. They pass through one another, their energies adding and subtracting in real time.
Σ (Wave A + Wave B...) / N
Our code uses a Set() data structure to track active notes.
1. Create 'activeNotes' Set.2. On KeyPress, add note to Set.3. Loop through Set.4. Calculate wave for each note.5. Sum all waves and Divide by Count.
Destructive interference: where one wave pushes up and another pushes down, they cancel out to zero. This creates new “safe zones” (nodes) that only exist within the chord.
The Protocol
How does the browser talk to the keyboard? We use the WebMIDI API, a browser standard that allows JavaScript to communicate directly with musical hardware connected to your computer, like USB keyboards.
navigator.requestMIDIAccess().then(onSuccess, onFailure)
It opens a direct data stream (a pipe) between the hardware and the browser tab. When you press a key, the keyboard sends a tiny packet of data.
[144, 60, 100]Note On, C4, Velocity
Our code intercepts this packet instantly and triggers the visual engine.
CREDITS
CREDITS
Mathematics after Paul Bourke. Static pattern approach after tutorials by Pat Valli. WebMIDI and p5.js support from Craig Fahner. Riso printing with Scarlett Wang. Physics after Ernst Chladni, 1787. Second version built with the help of Gemini.
Other Projects
Other Projects
[02]
[02]

Digital Chladni
A MIDI keyboard that plays sand.
ROLE
ROLE
Concept, code, sound design and zine by Bryan Chi Hun Lai. The first version was written by hand, section by section, for a course with a no AI rule. The second version was built with the help of Gemini.
THE IDEA
THE IDEA
In 1787 Ernst Chladni bowed a metal plate scattered with sand and showed that sound has shape. Digital Chladni rebuilds that plate in the browser and makes it playable from a MIDI keyboard. The tutorials it began from drew static patterns. This version plays them. Each note is mapped to the just intonation ratio of its interval, and that ratio becomes the plate’s vibration mode, so a perfect fifth draws a 3:2 figure and a major third draws 5:4. Chords superpose into patterns that exist only while the notes are held, figures no physical plate can hold at once. When no one is playing, the sand drifts back to spell the title.
HOW IT WORKS
HOW IT WORKS
Five thousand grains move by random agitation rather than simulated physics. Each frame, a grain reads the plate’s vibration beneath it. Where the plate is loud the grain is thrown, and where it is still the grain barely moves, so over a few seconds the grains collect on the nodal lines the way real sand does. The wave function follows Paul Bourke’s model, with the sign flipped from minus to plus so that patterns along the diagonal fill instead of canceling. Notes arrive over WebMIDI, and a low drone, square wave chords and a gliding lead play through long delays and reverb. Built in p5.js and p5.sound.
WHERE IT WENT
WHERE IT WENT
Made for Craig Fahner’s course, NYU Tandon, Fall 2025. Installed on a CRT monitor with a 25 key MIDI keyboard at Tandon @ The Yard, NYU’s virtual production studio at the Brooklyn Navy Yard, where visitors have used it to play songs they already know and watch them turn into geometry. Accompanied by The Chladni Field Guide, an eight page zine printed on the NYU Risograph.
THE FIELD GUIDE
From The Chladni Field Guide, the zine that accompanies the piece.
The Equation
The patterns are not random. They are the result of a precise mathematical wave function calculated for vibrations on a square plate.
cos(nx) · cos(my)− cos(mx) · cos(ny)
Imagine the equation as a topographic map. The “peaks” are where the plate moves. The “valleys” are where it is still.
Field note: the sign swap. The standard equation uses a minus. However, when n = m, this cancels out to zero along the diagonal. We use a plus to invert the phase, ensuring the diagonal is filled with grid intersections.
Sand Physics
Why does the sand move? It is pushed by constructive interference (loudness) and trapped by destructive interference (silence).
Unlike standard Newtonian physics, which relies on gravity and velocity, this simulation relies on stochastic probability: a system determined by random steps. While we cannot predict the path of a single grain, we can predict the average behavior of the entire swarm.
We do not tell the particles where to go. We simply agitate them. Each frame, a particle checks the “loudness” of the ground beneath it.
1. GET Vibration at (x,y)2. IF Vibration > 0: SHAKE = 25px (Teleport)3. ELSE: SHAKE = 0.5px (Trapped)
If the ground is loud (white), the particle is ejected violently. If the ground is quiet (black), the particle vibrates gently. Over time, order emerges from chaos as particles are naturally trapped in the quiet zones.
Visual Tuning
This is the bridge between sound and sight. We translate musical frequencies into integer modes (m,n).
|
|
|
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
We mapped the white keys (the diatonic scale) using the just intonation ratios found in physics. We plug these ratios directly into the Chladni variables (m,n) to create a visual representation of the pure interval.
Superposition
To visualize a chord, we must look to the principle of superposition. In physics, waves do not collide like solid objects. They pass through one another, their energies adding and subtracting in real time.
Σ (Wave A + Wave B...) / N
Our code uses a Set() data structure to track active notes.
1. Create 'activeNotes' Set.2. On KeyPress, add note to Set.3. Loop through Set.4. Calculate wave for each note.5. Sum all waves and Divide by Count.
Destructive interference: where one wave pushes up and another pushes down, they cancel out to zero. This creates new “safe zones” (nodes) that only exist within the chord.
The Protocol
How does the browser talk to the keyboard? We use the WebMIDI API, a browser standard that allows JavaScript to communicate directly with musical hardware connected to your computer, like USB keyboards.
navigator.requestMIDIAccess().then(onSuccess, onFailure)
It opens a direct data stream (a pipe) between the hardware and the browser tab. When you press a key, the keyboard sends a tiny packet of data.
[144, 60, 100]Note On, C4, Velocity
Our code intercepts this packet instantly and triggers the visual engine.
CREDITS
CREDITS
Mathematics after Paul Bourke. Static pattern approach after tutorials by Pat Valli. WebMIDI and p5.js support from Craig Fahner. Riso printing with Scarlett Wang. Physics after Ernst Chladni, 1787. Second version built with the help of Gemini.





