You know how video games can make sound effects sound 3D, even on stereo headphones? There’s some neat science and maths behind it!

You don’t need fancy 5.1 surround sound to hear in 3D. After all, your ears are just a pair of stereo receivers. Instead, your brain does a bunch of calculations, using tiny differences between them to work out where a sound is coming from.

Put on headphones for this one.

1. Time

A sound off to your right reaches your right ear first. So if we play a sound in your left ear a tiny bit later than in your right, your brain puts it on your right.

Good old geometry tells us how long that delay should be. Treat your head as a sphere of radius \(r\). To reach the far ear, a sound at angle \(\theta\) has to travel a little further: a straight bit, plus a curved bit as it bends around your head. Divide that extra distance by the speed of sound \(c\) and you get the delay,

\[\Delta t = \frac{r}{c}\,(\theta + \sin\theta).\]

For a sound directly to your right, that works out at about 0.65 ms. Your brain can pick up differences as small as 10 µs.

Timing only. Both ears get the same volume.

2. Tone and level

Your head also muffles sound on its far side. Not to call you thick-headed, but your head is big compared with a high-pitched sound wave. Low notes have long wavelengths and bend around it easily, while high notes mostly get blocked. It’s the same reason you can hear the bass of your neighbour’s music through a wall but not the vocals. So the far ear hears a quieter, duller version of the sound.

Again, a little trigonometry tells us how strong this is: it depends on how far round your (roughly spherical) head the far ear sits from the sound.

Timing plus head shadow. The far ear loses the highs.

3. Front and back

Oh, but there’s a catch: so far everything is symmetric. A sound 30° to your front right sounds exactly like one 30° behind your right shoulder, with the same delay and the same level.

Luckily, our ears aren’t symmetrical. They face forwards, and their folds bounce sound from in front of us into our ear canals. Sound from behind has to get past the back of the ear first.

Those reflections carve notches into the sound in the 6–12 kHz range which reduce the volume of certain frequencies. These notches move depending on where the sound comes from. Everyone’s ears are a little different, but enough people have had theirs measured to build an average model, called a head-related transfer function (HRTF). See if it makes a difference for you!

Put the sound behind you, then switch the HRTF off. The ring marks the mirror position.

4. Putting it together

Maths in sound design is pretty cool! There’s lots of other cool stuff you can do!

Sound travels over four times faster in water but is thicker and takes more energy out of the sound, so for underwater sound you shrink the delay and muffle the high energy frequencies more than the low.

Or keep re-solving as something moves past you, and you get the Doppler effect!

You can change how underwater the Travelers are, drag them around quickly to hear the Doppler effect, or just relax and hear the music dance :)

Drag to move, tap to mute. The slider goes underwater.
"Travelers" by Andrew Prahlow, from Outer Wilds (Mobius Digital, 2019)

The only new effects here are about distance: each instrument gets quieter the further away it is (the inverse square law), and its sound takes longer to reach you.

References

  • Woodworth, R. S. (1938). Experimental Psychology. Henry Holt.
  • Wightman, F. L., & Kistler, D. J. (1989). Headphone simulation of free-field listening. II: Psychophysical validation. The Journal of the Acoustical Society of America, 85(2), 868–878. doi:10.1121/1.397558
  • Wenzel, E. M., Arruda, M., Kistler, D. J., & Wightman, F. L. (1993). Localization using nonindividualized head-related transfer functions. The Journal of the Acoustical Society of America, 94(1), 111–123. doi:10.1121/1.407089