Architecture of Sound: Algorithmic Resonance Chambers in py5
2026/7/18
“Algorithmic Resonance Chambers” is a generative media art piece that visualizes the invisible architecture of sound and frequency. The artwork explores the concept of standing waves — mathematical patterns that emerge when specific frequencies perfectly align in a confined space. Rather than building a rigid 3D structure out of polygons and textures, the simulation constructs abstract, glowing architectural spaces out of pure probability and interference. Powered by Python, py5, and NumPy, the piece renders 50,000 individual particles that continuously flow through a shifting landscape of spherical harmonics, creating translucent, geometric structures that hum, twist, and phase out of existence.
Visual & Aesthetic Approach
The aesthetic of “Algorithmic Resonance Chambers” is designed to feel vast, delicate, and deeply mysterious. The simulation places the viewer inside a dark, warm-grey void. Slowly rotating in the center of this space is an intricate, lattice-like structure composed entirely of glowing dust.
Because the structure is built from particles rather than solid surfaces, it has a ghostly, translucent quality. The simulation relies heavily on additive blending (py5.blend_mode(py5.ADD)). Where the mathematical standing waves converge and constructively interfere, the density of the particles increases dramatically, burning brightly against the dark background. The color palette maps to the radius of the structure, shifting smoothly from deep, resonant crimsons in the center to bright, vibrating ambers at the periphery. Occasionally, a particle will glitch into a pure white spark, simulating the unpredictable quantum noise inherent in complex energetic systems.
Code & Technical Breakdown
To construct a shape out of pure frequency, the code relies on spherical coordinates and the mathematical concept of spherical harmonics. First, the 50,000 particles are distributed evenly across the surface of a perfect sphere.
# From setup()
points = np.zeros((NUM_POINTS, 3))
# Random spherical coordinates
theta = np.random.rand(NUM_POINTS) * 2 * np.pi
phi = np.arccos(2 * np.random.rand(NUM_POINTS) - 1)
# Base radius 1
points[:, 0] = np.sin(phi) * np.cos(theta)
points[:, 1] = np.sin(phi) * np.sin(theta)
points[:, 2] = np.cos(phi)Why this works: The initialization uses a specific NumPy technique to ensure the particles are evenly distributed across the 3D surface. Instead of simply generating uniform random numbers for both angles (which would cause clumping at the “poles” of the sphere), `phi` is calculated using an inverse cosine function (np.arccos). This ensures the 50,000 base points create a perfectly uniform, smooth shell of radius 1, providing a clean canvas for the frequency deformations to act upon.
The true shape of the resonance chamber is generated dynamically every frame by applying a chaotic, time-based mapping function to these spherical coordinates.
# From draw()
# We map spherical harmonics
m = int(py5.remap(np.sin(t*0.5), -1, 1, 0, 5))
m2 = int(py5.remap(np.cos(t*0.3), -1, 1, 0, 7))
# Quick spherical to cartesian update based on time
# This is a stylized chaotic mapping rather than strict physics
x = points[:, 0]
y = points[:, 1]
z = points[:, 2]
r = np.abs(np.sin(m * x * t) * np.cos(m2 * y * t) + np.sin(z * t)) * 200 + 100
px = r * x
py = r * y
pz = r * zWhy this works: This block of code is the mathematical heart of the artwork. The variables m and m2 act as the “frequencies” of the standing waves, oscillating slowly over time based on sine and cosine waves. These frequencies are then multiplied against the $(x, y, z)$ coordinates of the particles. Because the math uses absolute values (np.abs) and trigonometric interference (np.sin * np.cos + np.sin), the resulting radius r spikes sharply in certain directions and collapses entirely in others. As m and m2 shift, the “resonance” changes, causing the glowing architectural lobes to organically bloom, split, and merge in 3D space.
Finally, rendering 50,000 3D points efficiently requires careful handling of color and blending within a loop.
# From draw()
for i in range(0, NUM_POINTS, 2):
# Color gradient based on radius
h = py5.remap(r[i], 100, 300, 10, 40) # crimson to amber
s = 80
b = py5.remap(r[i], 100, 300, 40, 100)
alpha = 15
if np.random.rand() < 0.01:
h = 0
s = 0
b = 100 # white sparks
alpha = 50
py5.stroke(h, s, b, alpha)
py5.point(px[i], py[i], pz[i])Why this works: For maximum visual impact, the hue (h) and brightness (b) of every particle are directly mapped to its distance from the center (r[i]). This guarantees that the deepest, most stable parts of the chamber glow with a heavy red, while the energetic, spiking extremities burn bright yellow/amber. The random check `np.random.rand() < 0.01` ensures that roughly 1% of the particles bypass the standard coloring and render as bright white sparks with a higher opacity (alpha = 50). This subtle noise layer adds immense texture and life to the structure, preventing the mathematical curves from feeling too smooth or artificial.

Conclusion
“Algorithmic Resonance Chambers” demonstrates the profound beauty of mathematical interference. By using Python and py5 to map shifting frequencies onto a massive array of spherical coordinates, the artwork reveals the hidden geometry of sound and vibration. The resulting structure is not a fixed architectural model, but a living, breathing visualization of resonance — a delicate cathedral of light that constantly rebuilds itself from the chaos of its own frequencies.
GitHub: https://github.com/asamiile/py5-media-art/tree/main/sketch/algorithmic_resonance_chambers
Purchase assets: Adobe Stock