Portfolio / Computational Design

Room Modes

A room is a resonator. Below a few hundred hertz the air in it rings in standing waves, its modes, and they decide where the bass booms and where it disappears. Room Modes is the sibling of Cymatics: the same idea, a vibrating body with nodal lines, but the body is the air in a box and the nodal lines are surfaces in three dimensions.

Enter a room's width, length and height, or pick a preset, and set its reverberation time. Choose a speaker layout (Mono, Stereo, Quad, 5.1, 7.1 or 7.1.4), placed around the listening position at the standard angles. In the plan, drag the ear or any speaker, and click a speaker to mute it; Sub only mutes everything but the LFE, which is what bass management does below the crossover. Drag the frequency, or click the response along the bottom to tune. One mode sets the speakers aside and shows each standing wave on its own.

The room is filled with sand, as in Cymatics. Grains are thrown about wherever the air moves and come to rest where it is still, so in 3D they draw the null surfaces, and in the plan the null lines at ear height. Peaks inverts the rule and gathers the sand where the bass builds up. Grains still in flight are drawn faint. The plan can also show the Level as ink, animate the pressure as a Wave, or map the Seats. Scatter throws the sand back into the air. Tone plays the frequency on show: through real speakers, it excites the room you are sitting in, and walking about is the quickest way to find its nulls.

Modes

With rigid walls the wave equation separates in all three directions, so a rectangular room has an exact solution. Every mode is a product of three cosines, one per axis, and its frequency follows from the three indices:

ψ(x, y, z) = cos(nπx/Lx) · cos(mπy/Ly) · cos(lπz/Lz)
f = (c/2) · √((n/Lx)² + (m/Ly)² + (l/Lz)²)          c = 343 m/s

A mode with one non-zero index is axial: it bounces between one pair of walls. Two make it tangential, three oblique. In the response they are the long, medium and short ticks. Axial modes are the strongest and the easiest to hear. A pure mode's nulls are flat planes, so its 3D picture is a lattice; the curved, interlocking null surfaces in the Nulls view come from many modes ringing at once.

The driven room

A speaker excites every mode at once, in proportion to how much that mode moves the air where the speaker stands. The pressure everywhere is the room's Green's function, a damped sum over the modes. Several speakers playing the same bass in phase simply add their excitations:

p(r) = Σ_k ψ_k(r) · Σ_s ψ_k(s) / (Λ_k (f_k² − f² + i f B))         B = 2.2 / T60

Λ_k normalises each mode and B is the half-power bandwidth that the reverberation time implies. A speaker in a corner drives every mode; one on a null of a mode cannot drive it at all, and an ear on that null cannot hear it. A symmetric pair, like the stereo L and R, drives the modes that are even across the room twice over and cancels the odd ones, which is one reason multiple subwoofers are placed symmetrically: they smooth the response at the seats by leaving whole families of modes undriven.

The layouts follow ITU-R BS.775 for 5.1 (front pair at ±30°, surrounds at ±110°) and Dolby's guidance for 7.1 (sides at ±100°, rears at ±142°) and 7.1.4 (four top speakers 45° up). Each sits on a circle around the ear, pulled in from the walls where the room is too small, with the LFE on the front wall. All of them play the same signal in phase, which is the honest case for bass. Real systems delay and filter each channel.

The uniform 0 0 0 term, the pressure rise of a perfectly sealed box, is left out because real rooms leak. Only modes up to about one and a half times the frequency are summed, which is plenty for the picture.

Where it stops

The Schroeder frequency, 2000 √(T60 / V), marks where the modes begin to overlap by more than their bandwidth. Below it the room is a handful of separate resonances, and their positions matter. Above it the modes blur together into a statistical reverberant field, and ray tracing and reverberation time describe the room better than any single mode. The response greys the ticks beyond it, and the mode list stops there.

The model is a rigid, empty room. Real rooms have soft walls, doors, windows and furniture, which damp the modes and shift them; for those, a measurement microphone takes over.

Other shapes

Real walls are rarely perfectly parallel, and many rooms are not rectangles at all. Shape offers an L-shaped room, a trapezoid, a room with no parallel walls and one with a bay window, and the plan's corners can be dragged to any outline: double-click a corner to remove it, or a wall to add one.

As long as the floor and ceiling are flat, the wave equation still separates in height, so every mode is a plan shape times a cosine:

ψ(x, y, z) = φ(x, y) · cos(lπz/Lz)        f = (c/2π) · √(k_plan² + (lπ/Lz)²)

Only the 2D problem, ∇²φ + k²φ = 0 inside the outline with no flow through the walls, has to be solved, and for a general polygon there is no formula. It is solved numerically, in a background worker, whenever the outline changes. The plan is covered with about 3,000 square cells; a finite-volume Laplacian on the cells inside it, with no flux across any face that leads outside, is the wall condition. The walls become staircases a few centimetres high, small next to the shortest wavelength in play. The matrix is factored once (banded Cholesky), and Lanczos iteration on its inverse finds the lowest modes first; the small tridiagonal problem that results gives the frequencies and, with the Lanczos vectors, the mode shapes. On a rectangle the solver can be checked against the exact answer: its frequencies agree to better than 0.1% below 100 Hz and to about 2% at 480 Hz, and the response at the ear agrees to within a few tenths of a decibel.

In a room of this kind the modes are labelled j · l: the jth plan shape, and l half-waves in height. A mode with j = 0 is still axial, floor to ceiling; one with l = 0 is horizontal; the rest are oblique. Without parallel walls the plan modes no longer line up into neat families, and the degenerate pairs and triples of a square or cubic room break apart, the same way they do on a stadium-shaped plate. That is why studios avoid square rooms: compare the Cube preset with No parallel walls.

Ceilings

Attic rooms and vaulted living rooms do not have flat ceilings. Ceiling offers one Sloped from the full height at the front wall down to a lower back wall, and a Gable, with eaves on the front and back walls and the ridge across the middle of the room; the slider sets the low side, and H is the highest point.

Over a rectangular plan such a room is still a prism, only lying on its side: its cross-section, the outline of the front-to-back slice, is the same at every point across the room. So the same trick applies in the other direction. Every mode is a shape solved for the cross-section, times a cosine from the left wall to the right:

ψ(x, y, z) = φ(y, z) · cos(lπx/Lx)        f = (c/2π) · √(k_section² + (lπ/Lx)²)

The cross-section is solved by the same solver as a floor plan, and the modes are again labelled j · l: j = 0 is axial, side to side, l = 0 lies in the vertical section, and the rest are oblique. A sloping ceiling has no wall parallel to the floor, so the floor-to-ceiling and front-to-back families of the box merge into modes that lean with the roof, and the sand under a gable draws arches rather than planes. On a rectangle, set up as a cross-section, the solver agrees with the exact answer to within 0.1% in the field and a few tenths of a decibel at the ear; halving the cell size moves the modes of a sloped section below 150 Hz by less than 0.4%.

A shaped plan under a sloping ceiling is no longer a prism in either direction and needs the full three-dimensional problem, which is an order of magnitude heavier, so the two are offered one at a time: picking a shaped plan sets the ceiling flat, and a sloping ceiling sets the plan back to a rectangle. The plan, which is a slice at ear height, ends where a low ceiling comes down through it.

Seats

Seats asks a practical question: where is the bass most even? For each point of the floor at ear height it computes the response from 20 Hz to the Schroeder frequency and takes the standard deviation of the level, in dB. Ink is uneven, blank is smooth, and + marks the smoothest spot that is a sensible place to sit, away from the walls and the speaker.

Plain HTML5 canvas and vanilla JavaScript, built as a handful of web components (<room-view>, <room-response>, <mode-list>, <text-switch>, <theme-switch>), with no libraries; the 3D view is a hand-rolled orthographic projection, and the sand is the Cymatics grain model carried into three dimensions. It follows the site's light and dark themes, or the system setting.

References

  • Morse, P. M., & Ingard, K. U. (1968). Theoretical Acoustics. McGraw-Hill. Chapter 9.
  • Kuttruff, H. (2016). Room Acoustics, 6th ed. CRC Press. Chapter 3.
  • Schroeder, M. R. (1962). Frequency-correlation functions of frequency responses in rooms. J. Acoust. Soc. Am. 34, 1819–1823.
  • Bolt, R. H. (1946). Note on normal frequency statistics for rectangular rooms. J. Acoust. Soc. Am. 18, 130–133.
  • ITU-R BS.775-3 (2012). Multichannel stereophonic sound system with and without accompanying picture.
  • Welti, T., & Devantier, A. (2006). Low-frequency optimization using multiple subwoofers. J. Audio Eng. Soc. 54, 347–364.
  • Lehoucq, R. B., Sorensen, D. C., & Yang, C. (1998). ARPACK Users' Guide. SIAM. (Shift-invert Lanczos.)
  • Louden, M. M. (1971). Dimension-ratios of rectangular rooms with good distribution of eigentones. Acustica 24, 101–104.