Visualizations
316 / 500

316 · Physics

Doppler and Sonic Boom

A jet's wavefronts crowd into a Mach cone, and the boom lands when the cone does.

Every twelfth of a second the jet leaves a circle of sound that grows at 343 m/s, so wavefronts bunch up ahead and spread out behind, and past Mach 1 they overlap into a cone with sin(mu) = 1 / M. What the listener hears is solved, not staged: sound heard at time t left the jet at the retarded time tau where the distance to the recorded flight path equals c (t - tau). Below Mach 1 that equation has one root; above it there are none until the cone arrives, when a pair of roots is born together, and that birth is the boom. Dashed rays show where each sound you hear was emitted, and the panel plots the Doppler factor 1 / (1 - M_r) of every branch. With sound on, the engine's hum and roar are synthesized at the retarded time sample by sample, so the pitch swoops by the true Doppler factor and the approaching branch plays backwards.

Try it. Drag the Mach slider (or use the arrow keys) through the sound barrier, drag the listener along the ground and drag the jet up or down. Click Sound or anywhere in the scene to hear it. Left alone, the autopilot flies passes at different speeds, including one that accelerates through Mach 1.

  • Retarded-time root finding
  • Mach cone envelope
  • Doppler synthesis with Web Audio buffers
  • N-wave sonic boom

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a Doppler effect and sonic boom visualization with JavaScript and the HTML canvas element: a jet emitting circular sound wavefronts that crowd into a Mach cone above the speed of sound. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Make a full-window canvas, sharp on high-DPI screens. Draw a daytime sky gradient and green ground, and map 2,400 meters onto the canvas width.
- Fly a small jet left to right at a fixed altitude with speed M * 343 m/s, where M comes from a slider from 0 to 2. When it leaves the screen, start a new pass.
- Every 1/12 of a second, record the jet's position. Each frame, draw a circle around every recorded point with radius 343 * (now - emission time), in thin white lines that fade as they grow.
- Above Mach 1, also draw the Mach cone: two lines back from the jet at the half angle mu = asin(1 / M).

Once that works, make it beautiful:
- Add a draggable listener on the ground. Store the jet's path every frame and find the retarded times tau where distance(listener, path(tau)) = 343 * (now - tau) by scanning the path for sign changes. Draw a dashed line from the listener to the jet's position at each root: that is where the sound being heard came from.
- Below Mach 1 there is always one root. Above it, there are none until the cone sweeps over the listener and then two at once: flash BOOM at that moment.
- Plot the Doppler factor 1 / (1 - M_r) of each root over the last few seconds, where M_r is the jet's Mach number toward the listener at emission.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as synthesizing the engine sound at the retarded time with the Web Audio API, a vapor cone near Mach 1, or a jet that accelerates through the sound barrier during a pass.
PreviousRoom EchoesClap in a room on a blueprint and hear its exact echoes, from bathroom to cathedral. NextLeapfrogging VorticesSmoke rings take turns slipping through each other, from pure vortex dynamics.

Related visualizations

  • SOFAR ChannelPhysics Sound rays bend into the ocean's deep channel, lighting up caustics and shadow zones.
  • DrumheadSound A floor tom whose sound is sampled live from the 2D wave equation that draws its head.
  • Phased ArrayPhysics Steer and focus a beam of sound with per-speaker delays in a live 2D wave simulation.
  • Oscilloscope MusicRetro A phosphor XY scope draws a 4D tesseract, knots and text from the stereo sound you hear.
  • Rubens' TubeSound Gas flames on a brass pipe rise and dip with the standing sound wave inside.
  • Birdsong SyrinxSound Birdsong from a two-knob nonlinear oscillator, printed live as an ink sonogram.
  • Near Light SpeedPhysics Drive a city street near light speed and see what relativity really does to the view.
  • FM SynthesisSound A four-operator FM synth whose sidebands land exactly where Bessel functions say.
  • ChirpPhysics Two black holes spiral together and ring spacetime, from post-Newtonian formulas.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs