← Back

3D Spatial Audio

How the brain constructs a three-dimensional sound scene from the signals at two ears — and how to recreate that in code.

Every spatial cue the auditory system uses is encoded in the difference between what the left ear hears and what the right ear hears, shaped further by the geometry of your head, ears, and body. Each page in this series isolates one piece of that encoding — starting from simple geometry and building to full binaural and ambisonic rendering.

Sourcedirection & distance
Spacereflections & reverb
Head / EarsHRTF filtering
Auditory cortexlocalisation
Chapter 1
👂

Two Ears — ITD & ILD

The two fundamental horizontal cues: interaural time difference and the head's acoustic shadow. Hear how sound pans as geometry changes.

ITD · ILD · Duplex Theory
Chapter 2
🧠

HRTF & Elevation

Your pinna filters sound differently by direction, resolving the cone of confusion — letting you distinguish front/back and elevation.

HRTF · Pinna · Elevation
Chapter 3
📏

Distance Cues

Level, high-frequency air absorption, and the direct-to-reverberant ratio each carry independent information about source distance.

Inverse Square · Air Absorption
Chapter 4
🏠

Early Reflections

Reflections arriving within ~80 ms fuse with the direct sound, conveying room size and surface character via the Haas effect.

Haas Effect · Precedence · Room
Chapter 5
🔁

Reverberation

The statistical late-reverberant field. RT60, room size, absorption coefficients, and algorithmic vs convolution reverb.

RT60 · Schroeder · Convolution
Chapter 6
🚗

The Doppler Effect

A moving source compresses wavefronts in front and stretches them behind, shifting pitch in proportion to velocity.

Doppler · Frequency Shift
Chapter 7
🌐

Ambisonics

Encode a full-sphere sound field into four B-format channels (W, X, Y, Z) and steer a virtual microphone anywhere in it.

B-Format · HOA · Decoding
Chapter 8
💻

Web Audio Spatial

The browser's built-in 3D audio engine: PannerNode, AudioListener, HRTF panning, and distance models in the Web Audio API.

PannerNode · AudioListener
Chapter 9
🎧

Binaural Rendering

Synthesise the full 3D illusion on headphones by convolving with an HRTF. Comparison with stereo panning and crossfeed for speakers.

Binaural · Crossfeed · Headphones