Hearing what isn't there
Five sounds that hearing takes for something else. Each is built here from numbers, drawn from the same numbers, and comes with the switch that takes the trick away.
Nothing sounds until you press Play. Every sound peaks 6 dB below full scale, before the volume above; Stop or Esc ends it. Sections 3 and 4 need headphones.
1Shepard tone: a scale that climbs forever
Press Play. Each tone sounds a semitone higher than the one before. After twelve the sound is back where it began, and it keeps climbing. Roger Shepard built it in 1964 from sines an octave apart under a fixed bell over log frequency.1 A step lifts every sine a semitone. The top one climbs into the quiet edge of the bell as a new one rises out of the quiet at the bottom, so twelve steps up arrive at the same sound.
Jean-Claude Risset made the steps a glide:2 the sines rise together without stopping (here an octave every eight seconds), and the glissando never arrives.
The bell is the trick. Make it flat and the seam shows: once an octave the top sine stops, a low one starts, and the pitch falls back. With one octave there is one sine, rising and starting over; each octave added hides the seam better. The picture is a spectrogram of the samples playing, two loops side by side, and at its right the bell.
The glide in code, with the audio library: one sine per octave, each as loud as the bell says at its place.
// Risset's glissando: sines an octave
// apart, rising an octave every 8 s,
// each as loud as a bell says
let octaves = 8, period = 8
let low = 440 / 2 ** (octaves / 2)
audio.from(t => {
let s = 0
for (let k = 0; k < octaves; k++) {
let u = k + t / period % 1 // octaves up
let bell = Math.sin(Math.PI * u / octaves) ** 2
let phase = 2 * Math.PI * low * period / Math.LN2 * 2 ** u
s += bell * Math.sin(phase)
}
return s
}, { duration: 24 }).normalize(-6)
octaves to 1, or bell to 1, and play again: the seam shows. The phase is the integral of the rising frequency, low · 2u, so a sine that reaches the next one's place meets it in phase.2Risset rhythm: a beat that speeds up forever
The same trick in time. One pulse plays in layers, each twice as fast as the one below. All of them speed up together, doubling in about ten seconds. As the fastest grows too fast it fades out, and a new slowest fades in. After a cycle every layer is where the one above it began, so the loop never runs out of speeding up. Risset described rhythmic counterparts of his pitch paradoxes in 1986;3 Dan Stowell showed how to build such an eternal accelerando from a recorded loop, played at several rates at once.4
Every beat of a layer is also a beat of the layer above, so the layers never flam; the cycle holds a whole number of the slowest layer's beats, so the loop closes on a beat. Flat levels give it away: once a cycle the fastest layer stops dead, a slow one starts, and the tempo you were following halves. With a ratio of 3 each layer is in triplets against the one below. The picture has tempo going up, on a log scale: each dot a beat, as big as it is loud, each layer a rising line; under them, the samples.
3Deutsch's scale illusion
Each ear gets its own sound in this section and the next. Press “Left, then right” first: the knocks should come from the left, then from the right, and nowhere else.
In 1975 Diana Deutsch played each ear a melody that jumps: the left C′ D A F F A D C′, the right C B E G G E B C.5 Together they are the C major scale going up and going down at once, its notes passed from ear to ear. None of her 70 listeners heard a scale, and none heard the notes by ear. All grouped them by pitch: a high melody that falls and rises again, and for some a low one that rises and falls. Right-handers tended to hear the high melody on the right, and to keep hearing it there with the headphones turned round.
The sound is the paper's: sines at one level, 250 ms a note with no gaps, C 259, D 290, E 326, F 345, G 388, A 435, B 488 and C′ 517 Hz (equal temperament at A = 435 Hz), the eight notes ten times without a pause, 20 seconds in all. Here each ear is one sine whose frequency steps at every note without breaking phase, so the steps don't click. The paper played it at 75 dB SPL; set the volume to what is comfortable.
Hear one ear alone and its jumps are plain. Swap the channels: if the high melody stays where it was, your brain placed it, not the headphones. The picture is each ear's notes as measured from its samples, joined by ear, as they are played, or by pitch, as they are heard.
4Binaural beats
Play 250 Hz in the left ear and 254 Hz in the right. Neither ear gets a beat: each wave is steady, as the lanes show. Yet a slow throb, four times a second, sounds inside the head. The beat is made in the brain from the timing of the two ears' waves,6 whose phase difference turns a full circle four times a second; the lower panel shows the two waves at the playhead sliding past each other. It takes low tones, up to about 1 kHz, and a small difference, up to about 30 Hz; past either limit the throb is gone.7
Set the ears to “both tones in both” and the beat is in the air: the waveform swells and fades four times a second. That is an ordinary beat, and it is what any mono output turns binaural beats into.
Which browser plays binaural beats?
Any browser with the Web Audio API: Chrome, Edge, Firefox and Safari, on computers and phones, all of them since April 2021 at the latest.8 The browser is not what breaks them; mixing the two channels is. Binaural beats need the left channel in the left ear only and the right in the right only. They become the ordinary beat above when
- the system plays stereo as mono: on a Mac, Accessibility › Audio › “Play stereo audio as mono”;9 on iPhone, iPad, Android and Windows, the accessibility setting called Mono audio;
- the sound comes from one speaker, or from two across a room, where each ear hears both;
- a Bluetooth headset's microphone is in use, as on a call: the headset then switches to the hands-free profile, which plays one channel.10
Press “Left, then right”. Knocks on the left, then on the right: the output is stereo. From the middle, or from both sides at once: something on the way is mono. A page can't see the system's mono setting; it can only ask what the browser reports: . One more trap: on an iPhone with the silent switch on, Safari mutes Web Audio unless the page declares itself playback;11 this page does, where Safari supports it.
Do they change brainwaves?
The usual claim is entrainment: that the brain's own rhythm falls in step with the beat, so a 10 Hz beat would bring 10 Hz alpha waves. A 2023 systematic review found fourteen EEG studies of that: five in line with it, eight against, one mixed, their methods too varied to compare.12 A 2019 meta-analysis of 22 studies of memory, attention, anxiety and pain found a medium average effect (g = 0.45), larger with longer listening and with listening before the task.13 That measures performance, not whether the brain follows the beat. The beat you hear is certain; that your brainwaves follow it is not established.
5The missing fundamental
A note at 200 Hz from a voice or a string is a stack of sines at 200, 400, 600, 800 Hz and on: its harmonics. Take away the 200 and the pitch stays at 200. Take away the 400 and the 600 as well: the tone thins, and the pitch holds. Schouten called the pitch heard from harmonics without their fundamental the residue.14 What the harmonics share is their period: the wave below still repeats every 5 ms, though nothing in it runs at 200 Hz. Whether hearing reads that period or the pattern of the harmonics is still argued.15
Raise the lowest harmonic a step at a time and compare with a plain sine at f₀. The bars are the levels of the harmonics, and an editor: drag them, or focus them and use the arrow keys. Behind the bars, the spectrum measured from the samples; below, the samples, three periods of them.
6Additive synthesis
The bars above are an additive synthesizer: one sine per harmonic, each as loud as its bar, summed. Any periodic wave is such a sum.16 Levels of 1/n make a sawtooth; the odd harmonics alone at 1/n, a square. Every sine here starts at phase zero, so the bars are the whole recipe. In code it is one loop; here, the missing fundamental again:
// Harmonics 2 to 10 of 200 Hz, none at
// 200 Hz: the pitch heard is 200 Hz
let f0 = 200, from = 2, to = 10
audio.from(t => {
let s = 0
for (let k = from; k <= to; k++)
s += Math.sin(2 * Math.PI * k * f0 * t)
return s
}, { duration: 3 }).normalize(-6)
from to 1, then to 4: the spectrogram loses its lowest lines, the pitch stays. Opened in the playground, its pitch readout says G3 + 36 cents: 200 Hz, a frequency the sound does not contain. Divide each sine by k for a sawtooth.7Where to hear more
- Diana Deutschthe scale illusion and her other musical illusions, from their source
- audio playgroundthe scripts above and any sound of yours, to edit and hear
- R. N. Shepard, “Circularity in judgments of relative pitch,” JASA 36 (1964), 2346–2353.
- J.-C. Risset, “Pitch control and pitch paradoxes demonstrated with computer-synthesized sounds,” JASA 46 (1969), 88 (abstract).
- J.-C. Risset, “Pitch and rhythm paradoxes: Comments on ‘Auditory paradox based on fractal waveform’,” JASA 80 (1986), 961–962.
- D. Stowell, “Scheduling and composing with Risset eternal accelerando rhythms,” Proc. International Computer Music Conference, Huddersfield (2011).
- D. Deutsch, “Two-channel listening to musical scales,” JASA 57 (1975), 1156–1160: the stimulus (Fig. 1a, its frequencies and timing), 41 right- and 29 left-handed listeners, their reports. PDF.
- G. Oster, “Auditory beats in the brain,” Scientific American 229(4) (1973), 94–102.
- J. C. R. Licklider, J. C. Webster & J. M. Hedlun, “On the frequency limits of binaural beats,” JASA 22 (1950); D. R. Perrott & M. A. Nelson, “Limits for the detection of binaural beats,” JASA 46 (1969); the limits as the review in 12 sums them up.
- MDN, Web Audio API: Baseline, available across browsers since April 2021.
- Apple, Change Audio settings for Accessibility on Mac: “Play stereo audio as mono”.
- Microsoft, Bluetooth Classic Audio: A2DP plays stereo; the Hands-Free Profile plays and records one channel, and is chosen when an application opens the headset's microphone.
- J. Noble, WebKit bug 252746 (2023): iOS treats Web Audio as ambient sound, which obeys the mute switch; MDN, Audio Session API.
- R. M. Ingendoh, E. S. Posny & A. Heine, “Binaural beats to entrain the brain? A systematic review of the effects of binaural beat stimulation on brain oscillatory activity, and the implications for psychological research and intervention,” PLOS ONE 18 (2023), e0286023.
- M. Garcia-Argibay, M. A. Santed & J. M. Reales, “Efficacy of binaural auditory beats in cognition, anxiety, and pain perception: a meta-analysis,” Psychological Research 83 (2019), 357–372.
- J. F. Schouten, “The residue and the mechanism of hearing,” Proc. Koninklijke Nederlandse Akademie van Wetenschappen 43 (1940); J. F. Schouten, R. J. Ritsma & B. L. Cardozo, “Pitch of the residue,” JASA 34 (1962), 1418–1424.
- A. J. Oxenham, “Questions and controversies surrounding the perception and neural coding of pitch,” Frontiers in Neuroscience 16 (2023).
- J. Fourier, Théorie analytique de la chaleur (1822).