🌀 Shepard Tone Illusion

Nine octave-spaced sine partials under a raised-cosine bell envelope — a real Web Audio synth reproducing Roger Shepard's endlessly-rising (or falling) auditory illusion, paired with a spinning 3D barber-pole that rises in sync.

PsychoacousticsInteractiveWebGL
Drag to orbit · scroll to zoom · P pause · R reset · each glowing ring is one octave-spaced sine partial, brightness = its live amplitude envelope

How it Works

A Shepard tone is not one pitch — it is a stack of pure sine tones spaced exactly one octave apart (here, nine partials spanning C1 to roughly C10), each weighted by a bell-shaped amplitude envelope over log-frequency that peaks near the middle of the audible range and fades smoothly to silence at the top and bottom edges. As every partial's frequency is nudged upward together (each staying exactly an octave from its neighbors), the loudest partial gradually approaches the top of the envelope and fades out just as a new partial fades in at the bottom to take its place — because octaves sound so similar (a property called octave equivalence, or chroma), the ear cannot tell that a "hand-off" ever happened. The pattern is perfectly periodic, so the tone appears to climb forever without ever arriving anywhere.

This simulator implements the real construction rather than faking the sound: nine live oscillators are frequency-modulated together and individually gain-shaped by a raised-cosine envelope, exactly as described. Two variants are offered. The classic 12-step Shepard tone advances in discrete one-semitone jumps (12 steps per octave, the original 1964 demonstration), while the continuous Shepard-Risset glissando slides smoothly and is the version used in film scoring to build unresolved tension. The 3D barber-pole spins continuously around its own axis while brightness "travels" up (or down) its fixed rings — a geometric echo of the same bounded-but-endless trick your ears are hearing.

Partial i frequency: f(i,p) = f0 · 2^(((p + i) mod N)) — N=9 octave-spaced partials, f0 = 32.70 Hz (C1)
Amplitude envelope: env(i,p) = sin²(π · ((p + i) mod N) / N) — raised-cosine bell, 0 at the edges, 1 at the center
Position p(t): continuous glissando → p += t/cycleSeconds · direction; classic → p snaps to the nearest 1/12 every cycleSeconds/12
Apparent pitch class: chroma = round(frac(p) · 12) mod 12 (C, C♯, D, … B)

Frequently Asked Questions

What is a Shepard tone and why does it seem to rise forever?

It is an auditory illusion, first demonstrated by psychologist Roger Shepard in 1964, built from a stack of sine waves spaced exactly one octave apart, each weighted by a bell-shaped envelope so the highest and lowest partials are always nearly inaudible. As the whole stack is shifted upward, each partial eventually fades out at the top of the envelope exactly as a new one fades in at the bottom — because the ear treats octave-related tones as almost interchangeable in identity (chroma), the hand-off is inaudible and the tone seems to climb without ever reaching a ceiling.

How is the octave-spaced stack and bell envelope actually constructed here?

Nine real oscillators are tuned so consecutive partials are always exactly one octave apart, spanning roughly C1 (32.7 Hz) to C10. Each partial's gain is set by a raised-cosine (sin²) function of its position in that log-frequency span — maximum in the middle of the range, tapering smoothly to zero at both ends — so no partial ever switches on or off abruptly; it simply crossfades in and out as the whole pattern slides.

Why can't I ever "arrive" at a final pitch?

Pitch has two separable components: chroma (which note name, C through B — its position within an octave) and pitch height (how high or low overall). A Shepard tone gives the brain unambiguous, continuously changing chroma information but deliberately destroys pitch-height information, since the same bell-shaped spectral envelope recurs identically every octave. With no reliable height cue to anchor against, the auditory system reports only relentless directional motion, never a resting point.

What is the difference between the classic 12-step Shepard tone and the continuous Risset glissando?

Shepard's original 1964 tones stepped through 12 discrete equal-tempered semitones per octave, holding each briefly before jumping to the next — a "staircase" illusion. Composer Jean-Claude Risset later showed the same underlying trick works with a perfectly smooth, continuous frequency sweep instead of discrete steps, producing an unbroken glide that seems to accelerate upward forever. This simulator's mode toggle switches the same underlying engine between quantized 1/12-octave steps and continuous motion.

Where is the Shepard-Risset glissando used outside the lab?

Film composers use it deliberately to build tension without ever resolving it, since a listener's ear keeps expecting a climax that never arrives. Hans Zimmer's score for Dunkirk (2017) is a widely cited modern example, built almost entirely around a Shepard-Risset glissando layered under the Shepard tone of a ticking watch, to sustain unbroken dread across the film's runtime.

Why does the envelope need to be bell-shaped rather than a hard cutoff?

A hard on/off cutoff would make each partial's entrance and exit audible as clicks or sudden timbral shifts, breaking the illusion by giving the ear a detectable "seam." A smooth raised-cosine (or Gaussian) taper ensures partials fade in and out gradually enough that no single instant reveals the hand-off, which is essential to make the transition perceptually seamless.

Does the illusion work the same way for a falling tone?

Yes — running the same construction with frequencies shifting downward instead of upward produces an equally convincing endless-descent illusion. The direction toggle here simply reverses the sign of the position update; the octave spacing and bell envelope work identically in either direction because the underlying periodicity is symmetric.

How does the 3D barber-pole visualization relate to the sound?

Each glowing ring in the helix represents one of the nine octave-spaced partials, and its brightness is driven every frame by the exact same envelope value used to set that partial's gain in the Web Audio graph — so a ring that is currently loud in your headphones is also visibly brightest. The whole helix additionally spins around its axis, a classic barber-pole trick: a rotating spiral pattern looks like it is translating infinitely even though the object itself never physically moves anywhere, a close visual cousin of the bounded-yet-endless auditory illusion.