The Scene
How does one pressure wave become a scene of separate voices, and why do counterpoint's rules follow?
Send an ascending and a descending scale to the two ears, note by note alternately, and listeners hear two smooth melodies that neither ear was given (Deutsch's scale illusion, in stereo). The part builds the rules of auditory scene analysis and their consequences: ABA- streaming heard at four settings, and a competition model of ours (a tone captures the next with a strength falling exponentially in time and on the ERB scale) whose one constant fits van Noorden's coherence boundary, read from his figure, within 0.28 semitone, with the fission boundary and the ambiguous region between; interleaved melodies (Frère Jacques hidden, crossing its distractor 15 times, then released by register) and implied polyphony; simultaneous grouping by harmonicity (a mistuned harmonic popping out), common onset, common fate and place; the continuity illusion; Huron's derivation of voice-leading rules from these principles, with parallel fifths fusing and crossing lines heard as bouncing; a timbre space of the series' own 13 instruments by MDS on five measurements; Shepard tones and Risset's glide, the octave-scrambled Tune, the tritone paradox; absolute pitch and everyday pitch memory. The Tune is hidden in another line and released by timbre.
What you need. Part 4 for the ear and its ERB scale; Part 5 for roughness and fusion; Part 14 for melody and contour; Part 16 for counterpoint; Part 17 for chorales; Part 41 for timbre. Gestalt principles, MDS.
- Ideas, mathematics and history
- auditory scene analysis, streaming, timbre space, absolute pitch, the great illusions
- What we build, compute and hear
- a streaming model; the Tune hidden in another melody, then heard
What you will be able to do
Foundations
- Hear the scale illusion, ABA- streaming and its build-up, and a tune vanish in another and return.
- Hear a mistuned harmonic, an early harmonic and a vibrating group of harmonics come apart from a tone.
- Hear the continuity illusion, Shepard tones and the octave-scrambled Tune.
Full course
- Derive the competition model's straight-line boundary and fit it to published points.
- Measure attack, brightness, odd/even balance, jaggedness and decay, and build a timbre space by MDS.
- Construct grouping stimuli: interleaved melodies, mistuned complexes, Shepard tones.
Research
- Design a test of whether networks trained on natural sound reproduce human streaming boundaries.
Practice
- Separate parts by register and timbre; voice-lead for independence or fusion as the texture requires.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Foundations 25 min · Full course 32 min · Research 34 min · Practice 32 min.
- 0Two scales, two earsFoundations2 min
- 1StreamingFoundations3 min
- 2A model of the boundaryFoundations4 min
- 3Melodies hidden in melodiesFoundations3 min
- 4Sounds at the same momentFoundations4 min
- 5What fills a gapFoundations2 min
- 6Counterpoint as scene analysisPractice3 min
- 7A timbre space of our instrumentsPractice3 min
- 8Pitch and its illusionsFoundations3 min
- 9Absolute pitch and pitch memoryFoundations3 min
- 10Frontier: machines that hear scenesResearch2 min
- Variation 45, recap and problemsAll tracks2 min
Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.
Two scales, two earsFoundations2 min
Put on headphones for this one. Each ear will get its own stream of notes, both at once. Listen to what you hear on the right: does that melody move smoothly by step, or does it jump around?
A common report is a smooth melody on the right, going down and back up, and another on the left, going up and back down. Side assignment and grouping vary across listeners. But look at what each ear was actually given: notes jumping by semitones on average, an ascending and a descending scale chopped up and dealt alternately to the two ears. What you heard was regrouped by pitch: the higher notes, wherever they came from, made one smooth line, moving semitones a step, and the lower notes another. Diana Deutsch found this scale illusion in 1975: the brain prefers a melody that moves by small steps to the truth about which ear heard what.
Check it. Here is the left ear's part alone, and then the right ear's.
Alone, each ear's part is a jagged, leaping line. Together, the brain trades them: it would rather hear two smooth melodies than believe each ear.
The ear receives one pressure wave on each side, every voice and instrument summed together. The mind returns a scene: separate voices, each with its own pitch, timbre and place. Albert Bregman called the process auditory scene analysis, in his book of 1990. Its rules can be measured, modelled and turned into music, and they help explain some voice-leading conventions under a goal of perceptual independence.
Here is the plan. Streaming: when a sequence of notes splits into two. A model of the streaming boundary, fitted to the classic data. Interleaved melodies, and what releases them. Simultaneous grouping: harmonicity, onsets and continuity. Counterpoint as scene analysis, and a timbre space of our own instruments. And the pitch illusions, absolute pitch and pitch memory.
1StreamingFoundations3 min
When does one line of notes become two?
Here is the classic stimulus, from Leon van Noorden's thesis of 1975. A tone A, a tone B, A again, then a rest, over and over. Hear four versions. B three semitones above A, slowly: one line that gallops. Twelve semitones, slowly. Six semitones, slowly. And six semitones, fast.
With a small interval you hear a gallop, da-di-da, da-di-da. With a large one the gallop falls apart into two separate rhythms, the A tones twice as fast as the B tones, as if two players were tapping. And the same six semitones that gallop when slow split into two when fast. Whether a sequence is one line or two depends on both how far apart the notes are, and how quickly they come.
Now a case near the boundary: six semitones, ninety milliseconds apart, thirty times over. Listen for how it changes as it goes on.
Many listeners hear a gallop at first, and then, after a few seconds, two streams; some hear it flip back and forth. The sound never changed. That slow build-up, and the flipping, are the next thing to explain.
Bregman organised the findings as principles of grouping. Proximity in pitch: near notes group, and a leap invites a new stream. Proximity in time: the faster the notes, the smaller the leap that splits them. Similarity of timbre and loudness: like sounds group, chapter three's subject. Good continuation: a smooth path is followed across a gap, chapter five's. These are the Gestalt principles of vision, found again in hearing.
Streaming is not only human. Starlings trained on these patterns treat them as we do, Scott MacDougall-Shackleton and colleagues found in 1998, and goldfish, bats and monkeys show it too. It is a sensible design: in the wild, one source rarely jumps far in pitch from one moment to the next, so a big, fast jump is good evidence of a second source. Music borrows a mechanism built for finding animals and voices.
Streaming also takes time. A sequence often starts as one line and splits after a few seconds. Stuart Anstis and Shinsuke Saida measured this build-up in 1985, and a change of ear or a pause resets it. Between the boundaries perception flips back and forth, because the sequence is ambiguous, and attention can hold one organisation, within limits. Chapter two asks where exactly the boundaries lie, and models them.
2A model of the boundaryFoundations4 min
Can the split be predicted?
Van Noorden mapped two boundaries against the tone repetition time, from one onset to the next. Above the temporal coherence boundary two-stream reports dominated under the tested instructions. Below the fission boundary, about one to two semitones and nearly flat, one-stream reports dominated in those conditions. Between them either can be heard: the ambiguous region. And the coherence boundary climbs as the tones slow down.
Here is the other side. The fast tempo, but B only one semitone above A. Try to hear two streams.
Many listeners find these B tones difficult to segregate; your percept can depend on attention, duration and individual hearing. That is the fission boundary: below it, attention cannot pull the sequence apart.
Here is a small model of ours, built on Bregman's idea that grouping is a competition. Let each tone capture the next with a strength that falls with time and with distance in pitch. Strength is e to the minus time over tau, times e to the minus the distance over w, with distance measured on the ear's own frequency scale, the ERB-number scale of Part 4. In the triplet, the next A is two repetition times away at the same pitch; B is one away at another pitch. Two streams form when A captures the next A more strongly than it captures B. Work it through and the boundary is a straight line in the repetition time, with a single constant, w over tau, to fit.
Fit it. In pink, points on van Noorden's coherence boundary, read from his figure as Bregman's book reproduces it, good to about a semitone. In gold, the model, with its one constant fitted: ERB-numbers a second. On the same digitized points used to fit it, it misses by of a semitone on average. The dashed line is the fission boundary; between the two lies the region where either organisation can be heard. A one-line model of competition between nearness in time and nearness in pitch captures the boundary's shape.
Where does the build-up come from? In 2005 Christophe Micheyl and colleagues recorded neurons in monkeys' primary auditory cortex while ABA sequences played. The responses to B faded over seconds when B was far from A, and less when it was near, and the fading predicted the time course of human reports of two streams. Some of streaming's build-up may be neural adaptation, early in the cortex, and a model with adaptation in it would build up as listeners do.
The model is a sketch. It has no build-up, no attention and no ambiguity: it says one stream or two, never both. Fuller models add neural adaptation, competition between populations of neurons, and noise, which produce the flipping back and forth. One family of explanations is peripheral channelling: tones that excite different auditory filters segregate. Another is temporal coherence: features that rise and fall together are bound into one source. Chapter three turns to the scene analysis inside a melody.
3Melodies hidden in melodiesFoundations3 min
Can a familiar tune vanish in plain hearing?
A question for your ears. A well-known tune is hidden here, its notes alternating with the notes of another line. Name it if you can. You will hear it twice, and then once more, changed.
It is Frère Jacques. In the same register the two lines cross times in sixteen notes, and most people cannot pick out the tune at all, even knowing it is there. The third time, the other line moved an octave and a half lower, and the tune stepped out at once.
This is W. Jay Dowling's experiment of 1973. He interleaved two familiar tunes at about eight notes a second, and in the same register listeners could not name them. Separate them in pitch range, or in loudness or timbre, and both came out. But knowing which tune to listen for helped even when they overlapped: expectation steers grouping. Variation 45, at the end of this part, uses timbre alone.
Streaming can also be used on purpose. Here is one line of ours that alternates between a moving lower part and a repeated high C. Hear it slowly, then fast.
Slowly it is a single zig-zag line. Fast, it splits: a melody below and a high pedal note above, two voices from one instrument playing one note at a time.
The reverse works too. Two players alternating notes can make one melody: medieval hocket, from Part 23, and the interlocking parts of Part 37's mbira and gamelan. For the parts to fuse into one line they often benefit from compatible register, timbre and timing; none is an absolute necessary condition for every listener and passage. The same rules, read backwards: proximity binds what was played apart. Chapter four turns to sounds that arrive at the same moment.
Composers knew this long before the experiments, and called it implied polyphony, or compound melody. Bach's suites for solo cello and partitas for solo violin write two and three voices for a single line. Baroque lute music and Telemann's fantasias for solo flute do the same. The composer controls the split with leap size and speed, exactly van Noorden's two variables. And the trick can be reversed.
4Sounds at the same momentFoundations4 min
Which partials belong to which sound?
Sounds that arrive together pose a different problem. A chord, a voice and a drum arrive as one spectrum, hundreds of partials at once, and the ear must decide which partials belong together before it can hear any of the sources. It uses cues: harmonicity, a common onset, common change, which Bregman called common fate, and a common location. Part 41's Boléro trick works because instruments placed on harmonics pass the first test. Each cue can be broken on purpose, and heard.
Harmonicity first. Ten equal harmonics of two hundred hertz, then the same with the fourth harmonic pulled sharp by one, three and eight per cent. Listen for the moment a separate, thin tone pops out of the buzz.
At one per cent the tone is still one sound, perhaps a little rough. By three per cent, about fifty cents, most listeners hear the fourth harmonic as a second tone on its own; at eight per cent it is plainly separate. Brian Moore, Brian Glasberg and Robert Peters measured the threshold in 1986: a low harmonic mistuned by a few per cent stands apart. The ear groups partials by a harmonic template, and rejects what does not fit.
Now onsets. The same ten harmonics, all in tune, starting together; then with the fourth starting eighty milliseconds before the rest.
With the early start, the fourth harmonic is heard as a separate tone at the beginning, and some listeners keep hearing it as separate throughout. Chris Darwin's experiments showed that a harmonic starting a few tens of milliseconds early contributes less to the vowel or pitch of the rest: partials that start together belong together. That is why ensembles work so hard to play together, and why a slightly early note stands out.
Common fate, heard. Ten harmonics held still; then the same, with harmonics three, five and seven given a vibrato after one second, all moving together.
When the three start to wobble together, they leave the buzz and form a second sound of their own, a voice floating above a drone. Nothing else changed: the same partials, at the same levels, only moving in common.
And place. The same ten harmonics, all in the centre; then with the fourth moved to the right ear alone.
With headphones the fourth harmonic becomes a thin tone on the right, beside a sound in the middle that has lost a little of its colour. Location groups too, though in rooms, with echoes everywhere, it is the weakest of the cues.
Two more cues. Common fate: partials that change together group together. Stephen McAdams showed in 1984 that giving one set of a mixture's partials a vibrato makes a voice emerge from the blend, which helps a singer carry over an orchestra: the voice's partials move together, and the orchestra's do not. And location: the differences between the two ears group partials by direction, Part 55's subject. Chapter five asks what fills a gap.
5What fills a gapFoundations2 min
Does the ear hear what is not there?
A rising glide with a gap of milliseconds in the middle, first left silent, then filled with a burst of louder noise. Listen to the glide in the second version: does it stop?
With silence the glide plainly breaks. With noise in the gap most people hear the glide carry straight on through it, though in the noise there is no glide at all. The ear fills in what was probably masked: if a louder sound could have hidden a continuing one, it assumes it did.
The same works for a melody. The Tune's first phrase on a flute, with a hundred and twenty milliseconds cut out of three of its notes: first left silent, then filled with noise.
With silence the notes stutter. With noise, the flute seems to play straight through, the noise lying on top.
The same happens with speech. In 1970 Richard Warren played sentences with one speech sound cut out and replaced by a cough. Listeners heard the missing sound, and could not say where the cough had been: phonemic restoration. In music, a melody continues behind a drum hit or a cough in the hall, but only if the interruption is loud enough to have hidden it.
Bregman summed up such cases as the old-plus-new heuristic. If a sound changes, first assume the old sound continues and something new has begun, then subtract the old, and what remains is the new source. A held organ chord plus a new note: we hear the chord continue and a melody note arrive. Scene analysis is inference, the most likely world that would produce this wave. Chapter six derives counterpoint from these rules.
6Counterpoint as scene analysisPractice3 min
Why are parallel fifths forbidden?
Now the payoff. In 2001 David Huron published a long paper, Tone and Voice, that derives the rules of voice leading from how hearing groups sound. Assume one goal: several lines, each heard as a line, none lost and none merged with another. Several voice-leading conventions can then be interpreted as promoting perceptual independence, alongside historical and stylistic explanations, and his counts in the repertoire showed composers obeying the rules more strictly where that goal mattered more. These are Part 16's rules, seen from the listener's side.
Hear two violin duets with the same upper line. In the first, the lower part follows a fifth below in parallel. In the second, it moves the other way. Ask yourself how many voices you hear in each.
In parallel fifths the two lines lock together into something like one richer line: every lower note puts its harmonics under the upper note's, and both move at the same moments in the same direction, harmonicity and common fate at once. In contrary motion the two lines stay two. That is the perceptual reason behind the oldest rule in counterpoint.
Why do voices avoid crossing? Hear a rising scale and a falling scale played together on the same kind of tone, crossing in the middle.
Most people do not hear the scales cross. They hear a high line that comes down and bounces back up, and a low line that rises and falls back, each staying in its own range: the scale illusion again, without the ears. Tougas and Bregman studied this in 1985. Contrasting timbres can help preserve crossing-line identity, alongside rhythm, articulation and prior context.
Here is the mapping. Avoid parallel fifths and octaves, because fusion and common fate would merge the voices. Move by step and recover from leaps, because pitch proximity keeps each line one stream. Avoid crossing voices, because crossed lines regroup by pitch, as in the scale illusion. Keep voices apart, but not too far: too close they fuse, too far they stop being one texture. And stagger entries, because a voice entering alone is heard as new.
Rhythm matters as well. Voices that always start their notes together begin to sound like one. Huron's counts showed that in Bach's polyphony, voices begin notes together less often than chance would give: rhythmic independence is the twin, in time, of contrary motion. Chorales, from Part 17, move together on purpose, one sound of four voices. The texture a composer wants decides which rules apply.
The derivation also predicts when the rules relax. Where independence is not wanted, composers break them on purpose. Part 41's Boléro mixtures and the organ's stops move in parallel to fuse, and rock power chords, from Part 40, are parallel fifths, one thick voice rather than two. A style's rules encode its goal; change the goal and the rules change. Chapter seven turns to the dimension the old rules never mention: timbre.
7A timbre space of our instrumentsPractice3 min
Can timbre be mapped?
Part 41 placed our orchestra on two axes. Now do it properly. Here are of the instruments this series has built: the piano and plucked string models, the additive orchestra, Part 44's chip, and the model voice. Hear one note of each.
Measure each sound five ways. Attack time: how long it takes to rise from ten to ninety per cent of its peak, on a logarithmic scale. Brightness: the spectral centroid over the fundamental, as in Part 41. The balance of odd and even harmonics, the clarinet's hollowness. Spectral jaggedness, how much neighbouring harmonics differ, and decay, how fast the level falls. Five numbers per instrument, each measured from its sound.
Now let multidimensional scaling, the method Grey used, find the two axes that best preserve the distances between the instruments' five measurements. Here is the map. The first axis carries per cent of the variation and lines up most with and ; the second carries per cent and lines up with and . Grey and McAdams, asking listeners rather than measuring sounds, found attack time, brightness and how the spectrum changes over time. Our map is built from measurements, not judgements; testing it against listeners is the obvious next experiment.
Timbre streams on its own. One pitch, G above middle C, alternating between the piano and the chip's thin pulse: first slowly, then fast.
Slowly, one line alternating colour. Fast, the pitch never changes, yet the sequence splits into a piano part and a chip part, each at half the rate.
Maps of timbre leave things out. McAdams and colleagues found shared dimensions, and also what they called specificities, features unique to one instrument, like a harpsichord's release thump: things no common axis captures. Different groups of listeners weigh the dimensions differently: musicians and non-musicians share the map, but not its scales. Timbre is many things at once, a few shared dimensions plus a signature. Part 52 builds instruments to match a target timbre.
Timbre also groups. Notes far apart in timbre space stream apart: Paul Iverson found in 1995 that the more different two timbres are judged, the more readily they segregate. A melody of timbres, Part 41's Klangfarbenmelodie, works against this, and a line passed between very different timbres can fall apart. Orchestrators use the effect both ways: one timbre to bind a line, contrasting timbres to separate layers. Chapter eight turns to pitch itself, and its illusions.
8Pitch and its illusionsFoundations3 min
Can a sound rise forever?
Pitch is built by the brain from a spectrum, as Part 4's missing fundamental showed. It has two dimensions: height, which rises steadily, and chroma, which repeats every octave. Roger Shepard drew it as a helix: C above C above C. Octave equivalence, notes an octave apart sharing a name, is widespread but its strength and musical use vary across populations and tasks. Pull height and chroma apart, and pitch can go round in a circle.
If chroma were all that mattered, a melody would survive having its notes moved by octaves. Hear a familiar tune with every note put in a random octave, and then as written.
Scrambled, it is very hard to recognise, though every note has the right name. As written, it is our Tune. Diana Deutsch showed this in 1972 with Yankee Doodle: melody lives in height and contour, not in chroma alone.
Inharmonic sounds have pitches too. A bell's strike note, Part 9 found, is often not any of its partials. The brain fits a harmonic template to whatever partials it finds and reports the best fit, which for a bell can sit an octave below the loudest partial, or between two. Pitch is an inference, like every grouping in this part, and sometimes two inferences compete: some listeners hear a bell an octave away from others.
A question for your ears. Twenty-five tones, each a semitone higher than the one before: twenty-four steps up. Is the last tone two octaves above the first?
No. The last tone is exactly the first. Each tone is a set of partials an octave apart, and their loudness is set by a bell-shaped curve that never moves. Each step slides every partial up a semitone: the ones climbing out of the top fade away while new ones fade in at the bottom. Chroma keeps rising; height never gets anywhere. Shepard built these tones in 1964, and Jean-Claude Risset made a continuous glide of the same kind.
Jean-Claude Risset made the same trick continuous: a glide that rises for ever. Twelve seconds of rising, two octaves' worth, and it ends where it began. Film composers use the effect to build tension that never resolves.
Shepard tones also make a paradox. Play two of them a tritone apart, half an octave, where there is no height to tell them by. Diana Deutsch found in 1986 that some listeners hear the pair rise and others fall, consistently, depending on the pitch class, and that the pattern varies with where people grew up and the speech they heard. Even the most basic judgement, up or down, is partly learned. Chapter nine turns to remembering pitch itself.
9Absolute pitch and pitch memoryFoundations3 min
Can you name a note without a reference?
Some people can name a note with no reference tone at all. Population prevalence is uncertain and depends on the definition and sample; absolute pitch is uncommon in many Western unselected samples, and more common among musicians who began very early. Diana Deutsch and colleagues found in 2006 that it was far more common among conservatory students who spoke a tone language, such as Mandarin, and had trained early. Early training and a critical period matter, and genes probably do too. It is a labelling skill: possessors still hear a melody by its intervals.
Try holding a pitch yourself. In each trial you will hear a tone, then six other tones, then a last tone. Is the last one the same as the first, or different?
The first was the same; the second was a semitone higher. Diana Deutsch showed in 1970 that the tones in between are what make this hard: a comparable silent delay often interferes less, six intervening tones disturb it, most of all when one of them is close in pitch to the tone being held. Pitch memory is fragile, and it is disturbed by other pitches.
Everyone else remembers more than they think. In 1994 Daniel Levitin asked people without absolute pitch to sing familiar pop songs from memory, and many reproduced the recording's pitch within one or two semitones. With Perry Cook he showed in 1996 that familiar recordings can also support useful tempo memory. Many listeners retain useful pitch and tempo information for familiar recordings, without necessarily having precise note labels or uniformly accurate recall. A familiar tune's remembered key can reflect particular recordings and exposure; not everyone recalls its first-learned key.
Music mostly needs something else. Relative pitch, hearing intervals and scale degrees whatever the key, as in Part 15, is what melodies need: the Tune is the Tune in any key. Infants already recognise a melody transposed, and adults remember contour first and exact intervals later, as Part 14 found. Musical training is mostly training relative pitch. And language shapes pitch too.
Language shapes pitch too. In tone languages, Mandarin, Cantonese, Yoruba, Vietnamese, pitch changes the meaning of a word, so speakers track pitch contours every day, and some musical pitch skills come easier. Brainstem responses follow pitch more faithfully in both musicians and tone-language speakers. But tone languages do not make music easier in every way: in speech, contours carry the meaning, not exact intervals. Chapter ten turns to machines that hear scenes, and Part 47 asks what music and language share.
10Frontier: machines that hear scenesResearch2 min
Do deep networks hear the way we do?
The frontier asks whether machines hear scenes as we do. In 2018 Alexander Kell, Josh McDermott and colleagues trained a deep network to recognise words and musical genres in noise, and its layers predicted responses in human auditory cortex: early layers the primary cortex, later layers the regions beyond. Networks trained on natural sounds show some human illusions and miss others. A model that matches the brain is a hypothesis about how it works, testable with new sounds, for example model metamers: sounds a network treats as identical, which people may not.
A related frontier is source separation. Machines now undo the mixture: voice from band, violin from piano, using learned cues that may overlap with human grouping cues, without assuming the same internal mechanism. A separated stem is the machine's scene analysis, written out as audio, Part 64's subject. Whether they separate where people do, and fail where people fail, is open. The scale illusion is a test case: which melodies would a network report?
Scene analysis also matters when it fails. Colin Cherry named the cocktail party problem in 1953: following one voice among many. With hearing loss or a cochlear implant, difficulty separating sources can be a major challenge, alongside reduced audibility and spectral or temporal resolution. Implants carry only a few channels, so pitch and timbre cues blur and streams merge. Hearing aids now try to separate sources for the listener, with the methods of Part 64, and music is often their hardest test: many sources, all of them wanted.
A concrete version. Take the classic demonstrations of this part: streaming, interleaving, mistuning, continuity, the scale illusion. Ask a trained network what it hears in each, by reading out the streams it separates. Compare its boundaries with van Noorden's, and its answers with listeners'. Do networks trained on natural sound reproduce human streaming boundaries? If they do, the boundaries may follow from the statistics of natural sound; if not, something else shapes them.
Variation 45, recap and problemsAll tracks2 min
Every part ends by doing something to the Tune with what it built. Here, the Tune's first two phrases interleaved with a line of ours that crosses it at almost every note, both on the piano: the Tune should vanish. Then the other line moves to the chip's thin, buzzing pulse, at the same pitches: timbre alone. Then it drops two octaves as well.
Row forty-five of the ledger: seconds; the measurement is how hidden the Tune was: of its notes interleaved with as many others, the two lines crossing times.
What did we find? The ear groups by pitch proximity before it trusts which ear heard what. One line becomes two when the notes are far apart and fast. A model with one constant, a competition between nearness in time and nearness in pitch, fits the streaming boundary. Harmonicity, common onset, common fate and continuity group partials into sources. Counterpoint's rules protect those groupings. And pitch has height and chroma, and many listeners retain approximate pitch information for familiar music without explicit labels.
Five problems. One to compute, one to prove, one for your ears, one to build, and a research problem, marked with a star. Solutions are in this part's notes. Pause here.
Where does this come back? In expectation and emotion. In origins and universals, what is shared across cultures. In rooms and space, where a sound comes from. In machine transcription. And in source separation.
And in practice. Arrangers separate parts by register and timbre so each can be followed. Mix engineers carve each source its own band and its own place in the stereo field. Composers use implied polyphony, and Shepard-like endless rises, on purpose. And teachers train relative pitch, because absolute pitch is a label, not a requirement.
The books and papers this part follows. The full list, with notes, is in the README.
Where it goes next. Expectation and emotion in Part 46; origins and universals in Part 47; rooms and space in Part 55; transcription in Part 61; source separation in Part 64.
Key results
The part's results in one place, for revision.
Try it
Lab 45 · The auditory scene, computed
Fit the competition model to the streaming boundary and use it to predict your own ABA- sequences; hide a melody in another and release it; and map timbre from measurements.
python -m videos.music.labs 45
needs numpy, scipy, matplotlib · download lab45.py ·
source on GitHubfitted w / tau (ERB-numbers a second); rms miss (semitones) 32.4; 0.28
model boundary at 60, 90, 120, 150 ms (semitones) 4.3, 6.5, 8.5, 10.6
HIDDEN against the distractor: crossings 13 in 14 notes
timbre space: share of variation on two axes 0.37, 0.31
ear problem: one stream or two? (listen first) 13 st at 100 ms: model says two; 9 st at 60 ms: model says two; 5 st at 60 ms: model says two
Two streams form when A captures the next A more strongly than it captures B; with exponential fall-offs in time and on the ERB scale, the boundary is a straight line in the repetition time.
The code (74 lines; it asserts its own result)
"""Lab 45: the auditory scene, computed: the streaming model against van Noorden's boundary, interleaved melodies,
a mistuned harmonic, and a timbre space you can extend."""
import numpy as np
from videos.coursekit import labs
from explainer.music.monochord import SR, Clip, concat, mix
from explainer.music.monochord import scene as S
from videos.music.music45 import compute as C
TITLE = "The auditory scene, computed"
GOAL = ("Fit the competition model to the streaming boundary and use it to predict your own ABA- sequences; hide a "
"melody in another and release it; and map timbre from measurements.")
TASKS = [
"Change POINTS (the boundary data) or F_A. How does the fitted constant change? Predict a sequence, then listen.",
"Edit HIDDEN and the distractor rule. How few crossings are enough to hide a tune?",
"Add a feature to FEATURES (scene.features returns more than the map uses) and redraw the timbre space.",
]
POINTS = S.VAN_NOORDEN_TCB
F_A = 1000.0
HIDDEN = [67, 67, 74, 74, 76, 76, 74, 72, 72, 71, 71, 69, 69, 67] # the Tune's first two phrases, in G
FEATURES = S.FEATURE_KEYS
def run(seed=0):
rng = np.random.default_rng(seed)
lab = labs.Lab()
fit = S.fit_boundary(POINTS, F_A)
lab.row("fitted w / tau (ERB-numbers a second); rms miss (semitones)", f"{fit['k']:.1f}; {fit['rms_st']:.2f}")
trts = [0.06, 0.09, 0.12, 0.15]
lab.row("model boundary at 60, 90, 120, 150 ms (semitones)", ", ".join(f"{float(S.boundary(t, F_A, 1.0, fit['k'])):.1f}" for t in trts))
scale = [x for x in range(min(HIDDEN) - 6, max(HIDDEN) + 7) if x % 12 in (0, 2, 4, 5, 7, 9, 11)]
distr = [scale[scale.index(m) + (2 if i % 2 == 0 else -2)] if m in scale else m + 3 for i, m in enumerate(HIDDEN)]
lab.row("HIDDEN against the distractor: crossings", f"{S.crossings(HIDDEN, distr)} in {len(HIDDEN)} notes")
feats = {k: S.features(np.asarray(y, float), float(f0)) for k, (y, f0) in list(C.instruments().items())}
sp = S.timbre_space(feats, keys=FEATURES)
assert len(sp["coords"]) == len(feats)
lab.row("timbre space: share of variation on two axes", f"{sp['share'][0]:.2f}, {sp['share'][1]:.2f}")
# sound: the interleaved tune, then released; ear problem: ABA- at random settings
ioi = 0.12
def line(shift):
p = []
for i, (x, y) in enumerate(zip(HIDDEN, distr)):
p.append((Clip(C.piano(x, 0.22, 0.7), SR), 2 * i * ioi, 0.0))
p.append((Clip(C.piano(y + shift, 0.22, 0.7), SR), (2 * i + 1) * ioi, 0.0))
return Clip(mix(p, duration=2 * len(HIDDEN) * ioi + 0.5).y, SR)
clips = [line(0), line(-19)]
answers = []
for i in range(3):
st = float(rng.choice([2.0, 5.0, 9.0, 13.0]))
trt = float(rng.choice([0.06, 0.1, 0.15]))
clips.append(Clip(S.aba(st, trt, max(6, int(2.4 / (4 * trt))), f_a=F_A), SR))
answers.append(f"{st:.0f} st at {1000 * trt:.0f} ms: model says {'two' if S.streams(st, trt, F_A, 1.0, fit['k']) else 'one'}")
lab.audio = concat(clips, gap=0.9)
lab.row("ear problem: one stream or two? (listen first)", "; ".join(answers))
fig, (ax1, ax2) = labs.figure(2)
t = np.linspace(0.04, 0.17, 50)
ax1.plot(1000 * t, S.boundary(t, F_A, 1.0, fit["k"]), color=labs.GOLD, label="model")
ax1.plot([1000 * p[0] for p in POINTS], [p[1] for p in POINTS], "o", color="C3", label="van Noorden (read from figure)")
ax1.axhline(S.VAN_NOORDEN_FB, color="C0", ls="--", lw=1, label="fission boundary")
ax1.set_xlabel("tone repetition time (ms)")
ax1.set_ylabel("semitones")
ax1.legend(fontsize=7)
xy = np.array(sp["coords"])
ax2.plot(xy[:, 0], xy[:, 1], "o", color=labs.GOLD)
for n, (x, y) in zip(sp["names"], xy):
ax2.annotate(n, (x, y), fontsize=6)
ax2.set_title("timbre space of the series' instruments")
lab.fig = fig
lab.note = ("Two streams form when A captures the next A more strongly than it captures B; with exponential fall-offs "
"in time and on the ERB scale, the boundary is a straight line in the repetition time.")
return lab
Now change it
- Change POINTS (the boundary data) or F_A. How does the fitted constant change? Predict a sequence, then listen.
- Edit HIDDEN and the distractor rule. How few crossings are enough to hide a tune?
- Add a feature to FEATURES (scene.features returns more than the map uses) and redraw the timbre space.
Problems, with solutions
Try each problem before opening its solution.
-
Compute. With the fitted model, at what tone repetition time do 7 semitones at 1 kHz split into two streams?
Solution
Seven semitones above 1 kHz is 1,498 Hz; the ERB-number distance is 21.4 log₁₀(1 + 0.00437 × 1498) − 21.4 log₁₀(1 + 0.00437 × 1000) = 18.79 − 15.62 = 3.16. Two streams when 3.16 > 32.4 T, so T < 0.098 s: faster than about 100 ms onset to onset.
-
Prove. Prove that the competition model's boundary is a straight line in T, and find its slope in ERB-numbers.
Solution
The next A is 2T away at the same pitch, B is T away at distance Δz. Two streams when e^(−2T/τ) > e^(−T/τ) e^(−Δz/w), that is e^(−T/τ) > e^(−Δz/w), that is Δz > (w/τ) T: a line through the origin with slope w/τ, fitted at 32.4 ERB-numbers a second.
-
Ear. The lab plays ABA- triplets at random intervals and speeds; say one stream or two.
Solution
The lab prints the model's verdicts. Compare yours: the model has no build-up, so near the boundary you may hear one stream for the first seconds and two afterwards.
-
Build. Add a sixth measurement to the timbre space (say, spectral flux) and redraw it.
Where to look.
scene.featurescomputes the measurements andtimbre_spacetakes a list of keys; add the flux (the mean change of the normalised spectrum between successive frames) tofeatures, pass the longer key list, and see which axis it joins. -
★ Do networks trained on natural sound reproduce human streaming boundaries?
Where the frontier is. Read out the streams a trained separation network produces for ABA- sequences across interval and speed; map its boundary; compare with van Noorden's and with listeners' build-up curves; if they agree, test whether training on artificial sound changes the boundary.
Notes and sources
Sources
- A. S. Bregman, Auditory Scene Analysis (1990); D. Deutsch (ed.), The Psychology of Music (3rd ed., 2013).
- D. Deutsch, "Two-channel listening to musical scales", JASA (1975); "Tones and numbers: specificity of interference in immediate memory", Science (1970); "Octave generalization and tune recognition", Perception & Psychophysics (1972); "A musical paradox", Music Perception (1986); D. Deutsch and others on absolute pitch and tone language (2006).
- L. P. A. S. van Noorden, Temporal Coherence in the Perception of Tone Sequences (thesis, 1975); S. Anstis and S. Saida (1985); C. Micheyl and others, Neuron (2005); J. Rankin and others, PLoS Computational Biology (2015).
- W. J. Dowling, "The perception of interleaved melodies", Cognitive Psychology (1973); D. Huron, "Tone and voice: a derivation of the rules of voice-leading from perceptual principles", Music Perception (2001).
- B. C. J. Moore, B. R. Glasberg and R. W. Peters (1986); C. J. Darwin on onset asynchrony; S. McAdams, "Spectral fusion, spectral parsing and the formation of auditory images" (1984); R. M. Warren, "Perceptual restoration of missing speech sounds", Science (1970).
- J. M. Grey (1977); S. McAdams and others (1995); P. Iverson, "Auditory stream segregation by musical timbre", JEP: HPP (1995); R. N. Shepard, "Circularity in judgments of relative pitch", JASA (1964); D. J. Levitin (1994) and D. J. Levitin and P. R. Cook (1996).
- A. J. E. Kell and others, Neuron (2018); E. C. Cherry, JASA (1953); S. A. MacDougall-Shackleton and others (1998).
About this partfrom its README
Part 45 of a sixty-eight-part course in music (see the series plan and
the syllabus), the first part of Act VIII, The Mind. Send jumping notes to each ear and the listener
hears two smooth scales, one on each side, which neither ear was given (Deutsch, 1975; headphones). The ear receives one
pressure wave and the mind returns a scene of separate voices. This part builds the rules of that separation, models the
streaming boundary, and shows the rules of Part 16 falling out of them. The tools are Monochord's
(explainer/music/monochord/scene.py). The demonstrations are built as the classic experiments built theirs (sine
tones, harmonic complexes, noise, Shepard tones), with the series' own instruments where a real timbre matters. Published
findings are the ones listed under Sources.
- Two scales, two ears. An ear question (headphones: does the right ear's melody step or leap?); each ear alone; one wave, a whole scene; the plan.
- 1. Streaming. ABA- triplets at four settings, heard; six semitones at 90 ms, thirty times (the split builds up); principles of sequential grouping; streaming in other animals; build-up.
- 2. A model of the boundary. Van Noorden's two boundaries; one semitone, fast (below the fission boundary), heard; a competition model of ours (capture strength e^(−Δt/τ) e^(−|Δz|/w), two streams when Δz > (w/τ) T); fitted to points read from van Noorden's figure: w/τ = 32.4 ERB-numbers a second, 0.28 semitone rms; streaming in neurons; what the model leaves out.
- 3. Melodies hidden in melodies. An ear question (a tune interleaved with another line, crossing it 15 times in 16 notes: name it); Dowling's experiment; implied polyphony, one line slow and fast, heard; Bach's solo suites; hocket, the trick reversed.
- 4. Sounds at the same moment. Simultaneous grouping; a harmonic mistuned by 0, 1, 3 and 8%, heard; a harmonic starting 80 ms early, heard; common fate (three harmonics given a vibrato), heard; place (one harmonic to one ear), heard; common fate and place.
- 5. What fills a gap. A glide through silence and through noise, heard; the Tune's first phrase interrupted, heard; phonemic restoration; old plus new.
- 6. Counterpoint as scene analysis. Huron's derivation; parallel fifths and contrary motion, heard; crossing scales heard as bouncing; the rules and their principles; onsets and independence; when the rules relax.
- 7. A timbre space of our instruments. Thirteen of the series' instruments, heard; five measurements; their space by multidimensional scaling (two axes carrying 37% and 31% of the variation); streaming by timbre alone, heard; beyond the map; timbre and grouping.
- 8. Pitch and its illusions. Height and chroma; the octave-scrambled Tune, heard; the pitch of a bell; an ear question (24 Shepard steps up: two octaves higher?); Risset's endless glide, heard; the tritone paradox.
- 9. Absolute pitch and pitch memory. Absolute pitch; two pitch-memory trials after Deutsch (1970), heard; everyday pitch memory (Levitin); relative pitch; pitch in tone languages.
- 10. Frontier: machines that hear scenes. Deep networks as models of auditory cortex; machines that separate; when scene analysis fails (implants, hearing aids); ★ research problem: do networks trained on natural sound reproduce human streaming boundaries?
- Variation 45, recap and problems. The Tune's first two phrases interleaved with a line crossing it 13 times on the same piano, then released by timbre (the other line on the chip's thin pulse) and by register; the ledger; what we found; five problems; where it comes back; in practice; references; Part 46.
What is computed and built
python -m videos.music.music45.compute (under a minute) fills .cache/music45/.
| Item | What it computes | Checked against |
|---|---|---|
hook, each |
the scale illusion (stereo), each ear alone | each ear leaps, the heard lines step (tests) |
aba, fission, ambig, boundary |
streaming stimuli; the fitted model | the model's straight-line boundary (tests) |
inter, compound, tune |
interleaved melodies; implied polyphony; Variation 45 | crossings counted (tests) |
mistune, onset, fate, place |
grouping stimuli | the mistuned harmonic's frequency (tests) |
cont, melcont |
the continuity illusion | the gap is silent (tests) |
fuse, bounce |
parallel and contrary duets; crossing scales | — |
timbre, tstream |
features of 13 instruments; MDS; streaming by timbre | attack, decay and odd/even on test signals (tests) |
shepard, risset, octaves, memory |
pitch illusions and memory trials | Shepard tones return to the start (tests) |
Monochord's tools are held in tests/music/test_scene.py; this part's claims and clips in tests/music/test_music45.py.
Sounds. Sine tones, harmonic complexes, noise, Shepard tones and the chip are synthesized; Part 7's piano and Part 38's plucked bass are physical models; the additive orchestra and Part 17's voice as before. Two clips are stereo and want headphones. There are no recordings.
What the models are, and are not. The streaming model is ours: two exponentials and a competition, one constant, no build-up, attention or ambiguity. Van Noorden's points were read from a reproduction of his figure, good to about a semitone. The timbre space is built from measurements, not listeners' judgements. The fission boundary is quoted as a single typical value.
Notes
Illusion reports, side assignments and streaming boundaries vary with listener, attention, stimulus and task. The boundary error is an in-sample fit to approximate digitized points, not a held-out prediction. Grouping principles help explain selected voice-leading goals without deriving every historical convention. The timbre map uses standardized acoustic features, not listener similarity ratings. Absolute-pitch prevalence is sample-dependent; familiar-song memory is approximate. Source-separation models need not implement the same mechanisms as human hearing.
Companion material in this repository
The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
- Hook: an ear question (the scale illusion, in stereo); each ear alone; one wave, a whole scene; the plan.
- Streaming: ABA- at four settings heard; a long ambiguous sequence heard; principles; other animals; build-up.
- A model of the boundary: van Noorden's boundaries; below the fission boundary heard; a competition model; the fit; neurons; limits.
- Melodies hidden in melodies: an ear question (name the hidden tune); Dowling; implied polyphony heard; Bach; hocket.
- Sounds at the same moment: the cues; a mistuned harmonic heard; an early harmonic heard; common fate heard; place heard; fate and place.
- What fills a gap: a glide through silence and noise heard; a melody behind noise heard; restoration; old plus new.
- Counterpoint as scene analysis: Huron; parallel and contrary duets heard; crossing scales heard; rules and principles; onsets; when rules relax.
- A timbre space of our instruments: thirteen heard; five measurements; the space; streaming by timbre heard; beyond the map; grouping.
- Pitch and its illusions: height and chroma; the octave-scrambled Tune heard; bells; an ear question (Shepard steps); Risset's glide heard; the tritone paradox.
- Absolute pitch and pitch memory: absolute pitch; two memory trials heard; everyday memory; relative pitch; tone languages.
- Frontier: networks as models of hearing; machines that separate; when scene analysis fails; the research problem.
- Variation 45: the Tune hidden in another line, then released by timbre and register. Outro: problems, payoffs.
Covers: sequential and simultaneous grouping; streaming and its boundary; continuity; timbre space; pitch
models; octave equivalence; absolute and relative pitch; pitch memory; the illusions.
Built and computed: monochord/scene.py: the scale illusion; a competition model of streaming (capture falling
exponentially in time and on the ERB scale, so the boundary is a straight line in the repetition time) fitted to points
read from van Noorden's coherence boundary with one constant (32.4 ERB-numbers a second, 0.28 semitone rms); interleaved
melodies and their crossings; mistuned, early, vibrating and displaced harmonics; the continuity illusion; Shepard tones
and Risset's glide; a timbre space of the series' own 13 instruments by MDS on five measured features (two axes, 37%
and 31%).
Variation 45: the Tune interleaved with a line crossing it 13 times and inaudible, then released by timbre and by
register.
Frontier: deep networks as models of auditory cortex; absolute pitch (open: do trained networks reproduce human
streaming boundaries?).
Reading: Bregman, Auditory Scene Analysis; Deutsch (ed.), The Psychology of Music; McAdams.
Build the film
python -m videos.music.music45.compute # the part's numbers, into .cache/music45
python tools/build.py music45 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py music45 Hook # one chapter, silent, with a contact sheet
Scenes: videos/music/music45. Setup: see the course page. Source of these notes: the README and the scenes' narration.
Build it
python -m videos.music.music45.compute # numbers and sounds (under a minute)
EXPLAINER_TTS=silent python tools/build.py music45 -q l --fps 15 # a silent-narration preview, with the sounds
python tools/qa_sound.py music45 --sync # the sound gates
python tools/dead_air.py renders/music45_480p.mp4 --sound music45 # no empty screen; no sound over a still one
python tools/lecture_length.py music45 # 30 to 60 minutes, listening included
python tools/build.py music45 # 1080p30, narrated
python -m pytest -q tests/music # Monochord against its references; this part's claims and clips
python -m videos.music.labs 45 # the lab (writes a figure and a short WAV)