Signal and Sensation

Beats In Your Head

Two steady tones, one per ear. You hear a pulse that exists in neither of them.

Open fullscreen →

What it is

Headphones, or this does nothing. One sine in your left ear, another a few Hz higher in your right. You’ll hear a slow throb. Neither ear is receiving a throb.

Drag across for pitch and up and down for the beat rate. The button sends both tones to both ears instead, which sounds similar and is a completely different phenomenon.

How it works

Two tones close in frequency arriving at the same ear physically interfere. Their peaks drift in and out of alignment and the result genuinely rises and falls in amplitude. That’s acoustic beating and you can measure it in the waveform.

Send them to separate ears and no interference is possible, because the signals never meet. Each ear receives a mathematically constant tone. The throb you hear is assembled somewhere past the cochlea, where the two sides are first compared.

So the page measures both channels as they leave the audio graph, with an AnalyserNode per channel, peak amplitude sampled every frame and scrolled into a two-and-a-half second history, and prints the amplitude modulation it finds.

One tone per ear: both channels read near zero while you’re plainly hearing a pulse. Both tones in both ears: the traces heave and the number jumps.

Mode switching is a crossfade between four gains rather than a rewiring, so there’s no click at the transition. Each oscillator has a gain into its own ear and one into the other. Binaural is 1 and 0, mixed is 0.5 and 0.5.

What surprised me

My test for recovering the beat rate from an envelope kept returning exactly double the right answer.

Autocorrelation finds the lag at which a signal best matches itself, and the envelope of two summed sines is 2|cos(πΔt)|. That shape matches itself just as well at twice its period as at its period, and at three times, and four. Taking the strongest match is a coin flip between the answer and a multiple of it. The fix is to take the smallest lag scoring within ninety percent of the best, which is the standard defence and obvious only afterwards.

The other measured detail worth keeping: the summed signal’s modulation reads 0.92, not 1.0, even though the envelope really does touch zero. The analysis window is about five milliseconds wide, so it straddles the null and catches the peaks either side of it. The dip never reads as true silence.

That isn’t an error to fix, it’s what any window-based loudness measurement does, and worth knowing before trusting one.

What I would do next

Sweep the beat rate slowly upward and find where the throb stops being a throb and becomes roughness, then a second pitch.