Outrun Your Own Sound
Drag a source about and its sound leaves from where it was, not where it is. Push it past the speed of sound and the waves pile onto a cone that nothing in the code draws.
What it is
A thing making a steady 300 Hz note, and you, listening. Drag it about, or hit the speed buttons and let it fly past.
Every ring is one moment of sound, leaving from wherever the source happened to be when it left, and travelling on its own from there. Warm rings were emitted coming towards you, cool ones going away, so the colour is the pitch shift.
Push past the speed of sound and the rings pile onto a wedge with a hard edge. Nothing in this page draws that wedge. It’s the envelope of circles, and it appears the instant the source outruns them.
How it works
One equation does all of it:
|x(te) - you| = c (now - te)
The distance the sound had to cover equals the time it had to cover it in. Solve for te and
you know which moment of the source’s past is arriving right now. Everything else - the shift,
the bunching, the cone, the bang - is a consequence.
Below the speed of sound there is one answer. Above it there are two, because two different moments arrive together, and that’s what a boom is.
A source somebody is dragging has no formula, so the page scans its own history for sign changes and bisects. To know whether the scan is right, a source on a straight line does have a formula: squaring both sides gives a quadratic. The tests solve it both ways and compare, below the speed of sound and above it, on both roots.
The shift only counts the part of the motion aimed at you, which is why a pass isn’t a clean glide down:
| mach | head-on | receding | rises by | falls by | cone |
|---|---|---|---|---|---|
| 0.12 | 341 Hz | 268 Hz | 41 | 32 | none |
| 0.35 | 462 Hz | 222 Hz | 162 | 78 | none |
| 0.62 | 789 Hz | 185 Hz | 489 | 115 | none |
| 0.90 | 3000 Hz | 158 Hz | 2700 | 142 | none |
| 1.70 | infinite | 111 Hz | - | 189 | 36.0° |
At Mach 0.62 the pitch rises by 489 Hz and falls by 115. The rise is more than four times the fall, from the same speed, because the denominator shrinks towards zero on the way in and only grows on the way out.
The cone is sin θ = 1 / M, so it opens towards a right angle at the speed of sound and
narrows from there. 36.0 degrees at Mach 1.7, 19.5 at Mach 3.
The sound goes through kit’s new master chain, which is the other half of this day. A high pass, a compressor, a makeup gain, a limiter and a soft clip, in that order, before anything reaches a speaker. Measured on a peaky test signal: 4.37 LUFS louder, crest factor 16.87 dB down to 14.08, and the peak pinned at exactly -1.00 dBFS even when the thing feeding it’s driven six times hotter.
The source is a horn rather than a sawtooth, built from odd harmonics with the top rolled off, and the bang is an N wave: pressure jumps up at the leading shock, falls straight through ambient, and snaps back at the trailing one. That shape is what makes a boom a double crack instead of a thud, and it’s the shape the pressure actually takes.
What surprised me
I put the makeup gain in the wrong place and measured the chain clipping. The first version went compressor, limiter, makeup. That’s the obvious order and it’s wrong: a gain after the limiter simply undoes the limiting. Measured, it peaked at +1.68 dBFS, which is not a peak, it’s clipping.
Moving the makeup in front of the limiter fixed the ordering, and it still wasn’t enough. Web Audio’s compressor has no lookahead, so a fast enough transient gets through whatever the attack is set to. The only thing that actually keeps the promise is a tanh curve behind it, which can’t exceed full scale however hard it’s driven, and that’s what the numbers above are measuring.
Worth saying plainly: the chain sounded fine at every stage of being wrong. It took a measurement to notice, on a page whose whole subject is measurement.
The readout was printing my own clamp as if it were a result. The oscillator needs a finite frequency, so the shift was clamped at 6000 Hz. That clamp then went straight onto the screen, and the first good poster of this day says “hearing 6000 Hz” underneath a picture of a shock wave.
The real answer there is that there is no answer. At the shock the closing speed reaches the speed of sound, the denominator hits zero, and every wave the source emitted along that stretch lands at the same instant. The page now says all at once, and clamps only where an oscillator needs a number.
My own compressor flattened the thing the page is about. The first version of the master chain was set at a 3 to 1 ratio from -22 dB with 4 dB of makeup, which isn’t outrageous, and it took the finished clip down to a 6.63 dB crest factor. That’s a wall of level.
The way I found out wasn’t by listening. Measuring the biggest sudden rise anywhere in eighteen seconds of a page about sonic booms, the loudest event turned out to be the sound switching on. Every boom had been squashed flat by a compressor whose entire job was supposed to be making the page easier to hear.
Easing it to 2.2 to 1 from -16 with 2.5 dB of makeup, and giving the horn less level so the bang has somewhere to go, puts the crest back to 9.44 dB and the four biggest events in the clip become the four booms, at +64 dB over the moment before each one.
Protecting against clipping is the job. Flattening what is being demonstrated is not, and a chain that does the second while doing the first is easy to write and sounds fine at every stage of being wrong.
You hear it 207 metres after it has gone past. Flying the page’s own path, Mach 1.7 at 150 m overhead, the source is directly above you at 0.652 seconds and the first sound of any kind reaches you at 1.006. By then it’s 207 metres down the road.
And what arrives isn’t the start of the note, it’s two moments at once: at 1.10 seconds the two arrivals were emitted 289 metres apart, one from behind you and one from in front. The silence beforehand isn’t the aircraft being quiet, it’s every bit of sound it has made still being behind it.
One more thing about the look, since it’s the same lesson. The first version drew the wavefronts as uniform hairlines and it was a diagram. They’re drawn additively now, with the weight of each ring following the 1/r its energy actually falls off by, so the crowded edge of the cone blazes and the open water fades. That’s the physics doing the lighting rather than a glow painted over the top, and it cost less code than the version that looked worse.
What I would do next
Give the listener a position you can drag as well. The cone sweeps past at one angle for one observer, and the whole geometry changes if you stand somewhere else, which is a thing you can only feel by moving. The maths is already general, it’s one more pointer.
The other gap is that the two arrivals get one oscillator each with a frequency and a level, which is an approximation that stops being honest right at the shock. The proper version resamples the emitted waveform at the retarded times, so the arriving sound is genuinely the source’s own past, stretched. That’s a delay line indexed by a solved equation rather than a constant, and it’s the difference between a pitch that shifts and a sound that arrives.