Beams


https://p13i.io/beams

An interactive acoustic simulation. Beams computes what a listener in a small 2D world of walls and sound sources would hear, and plays it.


August 28th, 2026


#engineering #acoustics #webaudio #wasm #simulation

Beams computes what a listener in a small 2D world of walls and sound sources would hear, and plays it. Click the canvas to start the audio, drag to steer the listening beam, and use the arrow keys to move.

Echogram: each arrival's time in milliseconds and level; it fills once the audio is running.

The simulation needs JavaScript and WebAssembly; it did not start in this browser.

Controls

Drag or tap in the canvas to steer the array. Arrow keys move the listener. 1-4 switches scenes (1 walls, 2 cluttered hall, 3 corridor, 4 doorway). R resets the current scene, B toggles the microphone array against an omnidirectional listener, and the layer buttons toggle the overlays. The first click, tap, or arrow key starts the audio. The three ringed markers are sound sources playing a C major chord: C, E, and G. Each one is heard only through the acoustic paths that reach the listener; each arrival’s loudness, stereo direction, and delay come from the model below, steering the array reweights them, and the echogram under the canvas plots each arrival’s time and level.

What you are hearing

Beams computes what a listener in a small 2D world of walls and sound sources would hear, within the model stated at the bottom of this post. Three fixed tones play from the marked sources; how loudly, from which direction, and how late each one reaches the listener is recomputed from the scene geometry whenever you move or steer, and played through a Web Audio graph. A source with no surviving path is silent, and the colored lines on the canvas are the same acoustic paths the audio renders. The corridor and doorway scenes each isolate a single effect.

The model

Geometric acoustics via the image-source method up to two specular reflections, with every reflection point backtracked and every path leg occlusion-tested. One world unit is 2.5 cm, so the 800-unit world spans 20 m; the speed of sound is 343 m/s and each path’s delay is its length over c. Amplitude uses 2D cylindrical spreading with unit gain inside 2.5 m, and walls keep 84 percent of amplitude per bounce, about 30 percent energy absorption. The receiver is an eight-microphone uniform linear array of cardioid elements at 0.4375 m pitch, steered broadside to the aim point; each arrival is weighted by the delay-and-sum array factor times the cardioid element response at its arrival angle for its source’s tone frequency, and the cardioid element removes the front-back ambiguity a bare linear array would have.

Deliberately omitted

Edge diffraction, so occluded sources go fully silent where a real room would leave a faint diffracted remnant; transmission through walls; air absorption; frequency-dependent wall absorption; binaural HRTF rendering, in favor of plain stereo panning; and reflections above second order.

The whole simulation runs client-side: a WebAssembly module computes the acoustics and draws the scene, and the page’s Web Audio graph renders the arrivals, so what you hear is exactly what the model computes.


This site is open source. Improve this page »