Signal and Sensation

The Shape You Cannot Hear

Draw a spectrum, then rearrange its phases. The waveform becomes unrecognisable, the sound does not change, and the peak moves by six decibels.

Open fullscreen →

What it is

Twenty-four harmonics. Drag across the upper panel to draw their amplitudes. That’s the sound.

The lower panel is one period of the resulting waveform, with the peak marked in red and the loudness, the RMS, as the blue band.

The four buttons change nothing about the spectrum. They only change when each harmonic peaks. Press them while listening.

How it works

The oscillator is a Web Audio PeriodicWave built straight from the drawn amplitudes and a phase for each, with normalisation switched off so the waveform is literally the one computed. The white tick on each bar is that harmonic’s magnitude measured back out of the waveform, so you can watch the analysis agree with the synthesis.

Four phase schemes: all zero, alternating by π, random, and Schroeder’s, where each harmonic’s phase is set by the cumulative power below it. That last one is the standard recipe for a low-peak multitone.

One convention decision mattered more than it looks. With sine phases, “all phases zero” makes a sawtooth, because every harmonic crosses zero together rather than peaking together, and a sawtooth’s peak is low. With cosines, zero phase means every harmonic peaks at the same instant, which is the case worth showing. My first version used sines and reported that aligning the phases reduced the peak. True, and useless.

What surprised me

Three numbers side by side, for one spectrum under four phase schemes:

scheme loudness (RMS) peak headroom needed
all in phase 0.8900 3.3807 11.59 dB
alternating 0.8900 3.3807 11.59 dB
random 0.8900 1.7789 6.01 dB
Schroeder 0.8900 1.8716 6.46 dB

The loudness is identical to four decimal places. It has to be, by Parseval, since the magnitudes are untouched. Every harmonic magnitude agrees across all four schemes to 2 × 10⁻¹⁵.

The peak varies by nearly a factor of two. That’s 5.6 dB of headroom, for a signal that measures the same and sounds the same.

So phase is free and phase is expensive, depending on which part of the chain is asking. Nothing that computes a spectrum can see it. Everything with a ceiling sees only it: a limiter, a converter, a transmitter, a loudspeaker excursion limit.

The effect is far bigger on a flat spectrum, which is what Schroeder’s recipe was built for:

24 flat tones peak headroom
all in phase 24.000 16.81 dB
random 9.481 8.75 dB
Schroeder 6.173 5.02 dB

All in phase, twenty-four unit tones make a peak of exactly twenty-four, every one of them arriving at the same instant. Schroeder’s chirp gets the same energy through a ceiling nearly four times lower.

Getting that recipe right cost me an hour and is worth writing down. Schroeder’s phase is a double sum, φₙ = −2π Σ(n−k)pₖ, and at a glance it reads as a single cumulative one, which is what I wrote. The single sum is its derivative.

It produced phases that looked plausible and passed every test I had about spectra being unchanged, and it gave a crest factor worse than random phases. The only thing that caught it was checking the recipe against the case it was designed for and finding it losing.

Even corrected, a random draw still edges it on the 1/n spectrum, 6.01 dB against 6.46. Schroeder’s is optimal for a flat multitone and a 1/n spectrum isn’t that.

This also completes a pair with day 35. There, an image’s phases carried nearly all of its structure and its magnitudes carried almost none. Flatten every magnitude and you can still read the letter. Here it’s the exact opposite: the magnitudes are the entire percept and the phases are inaudible. Same transform, same two halves, opposite senses reaching opposite conclusions about which half matters.

What I would do next

Modulate the phases slowly instead of switching them, so the waveform morphs while the spectrum sits still. Phase becomes audible the moment it starts moving. That’s what a phaser is, and I’d like to find the rate at which inaudible becomes obvious.