Shepard Piano

# explanation

Adapted from:



# explanation

Mike Bostock’s Circle Piano block is a wonderful demonstration of the d3 JavaScript library, and really fun to play around with. But as I was exploring the block, I thought -- this would be perfect if it weren't divided into repeating sets of octaves. What if moving a note to the right always went up and a note to the left always went down?

To implement this, all we need to do is change the single oscilator to a Shepard tone. Shepard tones are named after Roger Shepard, who first described them in the 1964 paper: Circularity in Judgments of Relative Pitch. In that paper, he describes how we might construct something like an auditory barber pole. All we have to do is put together a stack of tones so that really low tones and really high tones are almost silent, and middle-range tones are louder. This way, as you move the entire stack of tones higher, low notes will subtly fade in, middle notes will rise clearly, and high notes will subtly fade out. Do it just right, and you can cycle this to make it sound like notes are always rising. Or, always falling if you go the opposite direction.

Here's the diagram from that paper, showing the sound intensity envelope (decibels, or, roughly, loudness) wrapped around notes spaced at regular intervals. (See Ondes Martenot for an explanation of the log scale.)

The formulas are fairly straightforward. Quoting from the paper (p. 2347) --

"In a set consisting of tmax different tones, the frequency of the cth component of the tth tone is

(1) f(t,c) = fmin·2[(c-1)·tmax+t-1] /tmax,

where fmin is the frequency of the lowest component of the first tone. The sound-pressure level of any one component (in decibels) is

(2) L(t,c) = Lmin+[Lmax-Lmin·[1-cosθ(t,c)]/2,

where Lmax and Lmin fix the range of sound levels for the individual components and where the function θ is defined by

(3) θ(t,c) = 2π[(c-1)·tmax+t-1]/[tmax·cmax].

Here, cmax denotes the total number of components in each tone."

Pretty easy, no?

There are a few things to be aware of:

For extra advanced points, you can also use this piano to investigate the Tritone Paradox.

The Tritone Paradox, discovered by UCSD professor Diana Deutsch, uses Shepard tones to investigate how people perceive intervals and pitch height. Let's say you hear a starting note of C. If you go up an octave, you're at C again, and halfway inbetween those notes is F#. This halfway point between any two notes of the same pitch class is called a tritone. If you use Shepard tones instead of single frequencies for your notes, then we reach a connundrum: since every C is going to play the exact same stack of frequencies, moving down from F# to C is going to play the exact same sets of tones as moving up from F# to C. So how do you hear it? Which note sounds higher to you?

Deutsch's work shows (and I think this is fascinating) that different participants hear different combinations of pitch classes as consistently being either ascending or descending! One person might hear C-F# as always ascending, while another person might hear it as always descending. To make things more interesting, whether you hear certain pairs as ascending or descending seems to depend on what language you speak. Even within the same language, people may differ by dialect and geographic region. People from California, for example, hear the direction differently from a lot of other Americans!

Can you guess why? Check out her page for her explanations.

Give it a try for yourself! Try playing an E and an A# one after the other on the piano. Do you hear it ascending or descending? What about C and F#? Try a bunch of different pairs -- see what works!


For more cognitive work involving Shepard Tones, check out Diana Deutsch's page on the topic of Pitch Circularity.