Progressions
Does harmony have a syntax, and how did composers learn it?
In eighteenth-century Naples the conservatories were orphanages that turned boys into the most employable composers in Europe, by having them play harmony above bass lines, partimenti, thousands of times. Harmony has a syntax, and the part measures it on Bach's chorales. Chords have jobs, tonic, subdominant, dominant, and the jobs come in an order: 3,446 moves go round the cycle T, S, D, T against 1,038 the other way, and dominant to subdominant is rarest of all. Roots fall by fifths 39 times in a hundred, and the forward motions (falling fifths and thirds, rising steps) are 69 in a hundred. The next chord costs 3.4 bits when the last is known, against 4.9 for the same chords shuffled and 6.1 if all were equally likely; a deceptive cadence costs about four. Sequences repeat a step; new chords land on strong beats and speed up into cadences. Campion's rule of the octave (1716) gives a chord for every note of a rising or falling scale; a few lines of code realize an unfigured bass with it, and Bach's own chords on stepwise basses fall within it about half the time. Gjerdingen's galant schemata (Romanesca, Prinner, Fonte, Monte, Ponte and others) are stock phrases; a strict detector finds almost none in the chorales, which belong to an older practice, but their melodies are everywhere in the series' tunes, and the Tune's second half is a Prinner. Ground basses, from the lament to la Folia, freeze a progression into a piece. The frontier asks whether harmony is a chain, a tree or a stock of phrases, for listeners as well as analysts. The Tune is heard over three basses.
What you need. Part 13 for chords and Roman numerals; Part 14 for information and bits; Part 15 for functions and cadences; Part 17 for the chorales and voice leading. Conditional probability and cross-entropy.
- Ideas, mathematics and history
- tonic, predominant, dominant; root motion; sequences; the rule of the octave; partimento and the galant schemata; ground basses
- What we build, compute and hear
- a harmonic transition model from the chorales; the Tune over the Folia
What you will be able to do
Foundations
- Label chords by function and root motion, and hear a falling fifth from a rising one.
- Play the rule of the octave up and down in C major, and realize a simple unfigured bass.
- Name and recognize the Romanesca, Prinner, Fonte, Monte and the common ground basses.
Full course
- Count function transitions and root motions in a corpus, with a shuffled control.
- Measure the predictability of a chord sequence as cross-entropy on held-out pieces.
- Write a schema detector and estimate its false-positive rate by shuffling.
Research
- Compare chain, tree and construction-grammar accounts of harmonic syntax, and what evidence would decide between them.
- Say what corpus studies of rock, Billboard songs and Beethoven show about the universality of the syntax.
Practice
- Harmonize a bass at the keyboard by the rule of the octave, and vary a ground.
- Build an arrangement from schemata: an opening, a reply, a sequence, a cadence.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Foundations 18 min · Full course 29 min · Research 32 min · Practice 20 min.
- 0Orphans, and a bassFoundations2 min
- 1Three jobs, in orderFoundations2 min
- 2How roots moveFoundations3 min
- 3How predictable is harmony?Full course3 min
- 4The same step, againFull course2 min
- 5When chords changeFoundations2 min
- 6Naples and the partimentoFoundations2 min
- 7Bach and the ruleFull course2 min
- 8Galant schemataFoundations1 min
- 9A phrase from partsPractice2 min
- 10Where the schemata areFull course2 min
- 11Ground bassesFoundations2 min
- 12Frontier: harmony at scaleResearch3 min
- Variation 18, recap and problemsAll tracks3 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.
Orphans, and a bassFoundations2 min
In eighteenth-century Naples there were four conservatories. These institutions grew from charitable foundations: places that kept poor and orphaned boys, fed them, and trained them in a trade, and developed specialized musical training, also admitting students under other arrangements. From them came Pergolesi, Paisiello, Cimarosa, and dozens of composers who ran the opera houses and chapels of Europe. How do you turn a ten-year-old into a working composer? The answer was a bass line. The master wrote one out; the boy played harmony above it at the keyboard, at sight. Thousands of these exercises, called partimenti, were copied and played and learned by heart.
Here is the simplest one of all: a bass that climbs a scale and comes down again. First alone, and then with the harmony a student was taught to play above it, a chord for every note of the scale.
Notice that the chords are not all the same kind. On some notes the bass carries a plain triad; on others the chord's third or seventh is in the bass. That recipe, which chord goes over which note of the scale, going up and going down, was called the rule of the octave, and students practiced versions of it extensively. It is a piece of grammar: not a melody, not a chord, but a rule for how chords follow one another.
Part 17 counted which chord follows which in Bach's chorales, and used the table without asking why. This part asks. We sort chords by the job they do and see that the jobs come in an order. We measure how predictable the next chord is. We hear sequences, and find where in the bar chords change. We go back to Naples for the rule of the octave and for the patterns, called schemata, that galant composers built their music from. And we hear the ground basses that musicians have repeated for four centuries.
1Three jobs, in orderFoundations2 min
Do chords come in an order?
Part 15 sorted chords by the job they do, using a simplified root-based classification inspired by later functional teaching; Riemann’s theory was more nuanced. The tonic is home. Chords that share two of its notes, six and three, can stand in for it. The subdominant moves away from home: four, and two, which shares two of four's notes. The dominant holds the tension that wants to go home: five, and seven, which is most of a five chord. The question now is whether the jobs come in an order.
Count, in Bach's major chorales, how often a chord with one job is followed by a chord with another. The thick gold arrows go one way round the triangle: tonic to subdominant, subdominant to dominant, dominant home to tonic. moves go that way, and more go straight from tonic to dominant, skipping a step; only go against the cycle. The rarest move of all is from dominant back to subdominant: times. That return is uncommon under this classifier in the selected chorales, rather than universally forbidden. That is the first fact of harmonic syntax: away, tension, home. The minor chorales show the same order. And the commonest move against the cycle, subdominant straight to tonic, is the plagal cadence, the Amen at the end of hymns: four to one, a softer arrival without the dominant's leading note.
Hear it. The same three chords, in two orders. Which one sounds finished, A or B?
A illustrates the common-practice authentic ending; preferences for these examples have not been measured here. It goes away, builds tension, and resolves it: one, four, five, one. B plays the same chords with the middle two swapped: the tension of five is raised and then abandoned for four, and the last chord arrives without having been prepared. Rock and blues use B's order freely, as the frontier will show; in Bach's style it is rare.
2How roots moveFoundations3 min
Why falling fifths?
Now forget the jobs and follow the roots. From each chord to the next, how far does the root move? The commonest move by far is a falling fifth: five to one, two to five, six to two. It is moves in a hundred. Then rising steps and falling thirds. Their inverses, the rising fifth, the rising third and the falling step, are all rarer. Walter Piston's textbook of 1941 printed this as a table of usual root progressions, which generations of students learned by heart: five usually goes to one, four usually goes to five. Here it is counted. Nicolas Meeùs grouped them this way in 2000: falling fifths, falling thirds and rising steps carry harmony forward, the others form his contrasting category; these labels are analytical conventions, and in Bach the forward kind is in a hundred.
Hear the difference. Four chords, twice. In one the roots fall by fifths; in the other the same kind of chords rise by fifths. Which one arrives home, A or B?
A. Its roots fall A, D, G, C, and each chord leads into the next until the last one lands on home. B starts at home and climbs away, and its last chord, six, leaves the question open. The same four kinds of chord; root direction contributes to these examples’ tonal effect, alongside their endpoints, voicing and context.
Why the falling fifth? Look at five going to one. The new root, C, lies a fifth below G, and G is the third harmonic of C: the old root’s pitch class appears among the new root’s harmonics; the entire old chord need not fit that series, as if the music were falling home through its own overtones. And the voices move as Part 17 liked: G held, B up a semitone to C, D down a step. Rameau made the falling fifth the model of all harmony in 1722: the real bass of every progression, he said, wants to move like a dominant to its tonic. And a chain of falling fifths visits every chord of the key: chapter four hears one.
3How predictable is harmony?Full course3 min
How many bits does the next chord carry?
A game first. A chorale in a major key plays its home chord, then four. What comes next? Make a guess before the answer.
The answer, from two hundred and eighty chorales: most often the home chord again, times in a hundred; then five; then two, which leads to five. After two the field is open. After five, home: more than half the time. The next chord is never certain, but it is far from random.
Information theory, as in Part 14, puts a number on it: the bits needed, on average, to say which chord comes next. Bach's major chorales use about different chords. If every one were equally likely, each would cost bits. Knowing only how common each chord is brings that to . Knowing the chord before brings it to : that measures predictive sequential dependence under this label vocabulary and model, on chorales whose tunes the model never saw. Shuffle the same chords into a random order and the cost rises to : this trained model’s cross-entropy increases by more than a bit per chord under that shuffle; this is not a universal entropy difference. Two chords back helps less, not because it carries nothing but because two hundred and eighty chorales are too few to learn every triple. For comparison, Part 14's melodies cost two point six bits a note given the note before, from a vocabulary of about twenty notes.
Bits also measure surprise, chord by chord. After a dominant, the home chord comes with probability : hearing it carries only about one bit of news. The chord on six comes with probability : about four bits. That is the deceptive cadence of Part 15, and its effect can involve learned expectations for home, without equating this model’s probabilities with every listener’s. A composer who knows the probabilities can place a surprise where it will be felt. Leonard Meyer argued in 1956 that this is where much of the emotion in music comes from: an expectation set up, then delayed, or denied, or fulfilled at last.
4The same step, againFull course2 min
What is a sequence?
Take the falling fifth and do it again, and again. From C to F, F to B, B to E, and on round the key until G falls home to C. Every chord of the key is visited once, and the bass zigzags, down a fifth and up a fourth, the same step again and again. A pattern repeated at another pitch is a sequence; this one, the descending-fifths sequence, is the commonest in Baroque music. One step of it is not exact: F to B is a diminished fifth, because the key has no B flat.
Sequences can climb too. Here the bass rises by step, and over each bass note an upper voice moves from a fifth above it to a sixth: C with G, then with A; D with A, then with B; and so on. Each pair of chords is the same move, a step higher. It is called the rising five-six sequence, and it is how a piece climbs steadily without leaving the key.
How often does Bach do it? Count runs of chords whose roots keep falling by fifths. Runs of three chords, two falling fifths in a row, are everywhere: about of them. Runs of four or more are rarer, in all, and the longest go round six or seven chords. In a chorale a phrase is short, so the full circle is rare; in the concertos and suites of the same years it can run for bars on end.
5When chords changeFoundations2 min
Where in the bar does harmony move?
Chords also have a rhythm. In a chorale nearly every beat has a chord, but not always a new one. Count, for each beat of the bar, how often the chord there differs from the one before. On the first beat, times in a hundred; on the third, ; on the weak second and fourth beats, and . New harmony lands where Part 11 found the strongest beats, and the weak beats more often keep the chord while the voices move inside it. The pace of chord change is called harmonic rhythm, and composers set it against the rhythm of the notes: quick notes over slow harmony, as in these chorales, or the other way round.
Could that pattern be chance? Every claim of this kind needs a control. Take each chorale's own chords and shuffle them among its beats, twenty times over: the same chords, the same metre, but the order lost. Shuffled, every beat brings a new chord about times in a hundred, strong or weak alike. So the strong beats are not unusual; they change chord about as often as a random order would. What Bach's order adds is the weak beats holding on: and instead of about . The metre shows up as harmony that waits for the next strong beat.
Harmonic rhythm also changes within a phrase. Over the whole of the chorales, a beat brings a new chord times in a hundred. In the two beats before a fermata, . Approaching a cadence, Bach changes chord on almost every beat, two to five to one, rarely holding a chord over: the harmony speeds up into the end, and a listener can feel the close coming before it arrives, even without knowing the tune.
6Naples and the partimentoFoundations2 min
How did a bass become a composition?
The rule of the octave was first printed under that name in Paris, in 1716, by the guitarist and theorbo player François Campion. In Naples it became the backbone of a whole training. Masters such as Francesco Durante and Leonardo Leo wrote partimenti, bass lines, sometimes with figures, sometimes without, for students to realize at the keyboard. A student who had played through hundreds of them knew, without thinking, what goes above any bass. Pergolesi, Paisiello and Cimarosa came out of this training. Recent work by Gjerdingen, Sanguinetti and others renewed broad interest, building on earlier scholarship and continuing practices.
Here is the rule, rising and falling, with its figures under the bass. Listen for the two pillars: only the first and the fifth notes of the scale carry a plain triad. In this selected realization, the other degrees carry inverted chords, its root somewhere above the bass, which pulls toward the next pillar.
And the chords are not the same going up and coming down. On the sixth degree, rising, a plain first-inversion chord; falling, a chord with a raised sixth that leans toward the fifth degree, the dominant of the dominant. The rule knows the direction of travel. That is why it was learned in both directions, in every key, until the hands knew it.
The rule turns harmonizing a bass into something a beginner, or a program, can do. Here is a bass with no figures at all. Monochord's partimento player looks at each note: where the bass moves by step, it takes the rule's chord for that degree and direction; where it leaps, a plain triad; and it moves the upper voices the shortest way, avoiding parallels. Hear the bass, and then what the program plays.
This program gives a deliberately plain realization under its chosen rules; that does not describe every historical student’s first attempt. The art came afterwards: the teacher's next lessons added suspensions, passing notes and imitation over the same bass, until the exercise became a piece. Chapter nine will hear one of those additions.
7Bach and the ruleFull course2 min
Did Bach harmonize a scale the Neapolitan way?
Did Bach harmonize a moving bass the way Naples taught? He was not a Neapolitan, and the rule was a teaching device. Take every place in his major chorales where the bass passes by step through a note, and ask whether his chord there belongs to the rule's chord for that degree and direction. Rising through the seventh degree, the leading note, most often: times in a hundred, a dominant chord over its third. Falling through the third and the seventh, often. Elsewhere, much less: on the second degree Bach often prefers a chord the rule does not offer. Over all such beats, his labeled chord’s pitch classes are contained in the chosen rule chord times in a hundred. The rule describes a common core of the style, the part a beginner can learn first; the remaining cases reflect alternatives and labeling limits, not simply errors against a rule.
Look closer at a degree where they part company: the second, with the bass rising through it. The rule gives a dominant seventh chord with its fifth in the bass. Bach's commonest choice there, the diminished triad on seven in first inversion, is that same chord with its root left out: the rule, in effect. But nearly as often he plays a chord on two itself, two or two-seven, treating D as a root of its own on the way to the dominant. The rule hears the second degree as part of the dominant; Bach often hears it as a step before the dominant. Both are good grammar.
8Galant schemataFoundations1 min
What were composers' building blocks?
Robert Gjerdingen, reading the partimenti and the music of the galant style, the polite music of the mid-eighteenth century, found that composers built their phrases from a few dozen stock patterns. A schema is a short bass and a short melody that move together, a few notes each. Gjerdingen named them, some after old treatises and teachers: Joseph Riepel, writing in 1755, called three of them the Monte, the Fonte and the Ponte, the mountain, the fountain and the bridge. Each had its place: some open a piece, some answer an opening, some come after the double bar, some lead to the end. A composer learned them as a speaker learns the phrases of a language, and could improvise with them.
Here are eight of them, each realized in four voices in C major, the melody on top. Three that open a piece: the Do-Re-Mi, the Romanesca and the Meyer. The Prinner, which answers an opening, its melody falling six, five, four, three. The Fonte and the Monte, sequences that come after the double bar, one falling a step, one climbing. The Ponte, a bridge over a held dominant. And the Quiescenza, a settling after the end. Listen to each.
9A phrase from partsPractice2 min
Can schemata make a piece?
Put them in the order Gjerdingen found again and again. Open with a Do-Re-Mi; answer it with a Prinner. After the double bar, a Fonte, stepping down; a Monte, climbing; a Ponte, a held dominant that waits for the return; and a cadence. The example was assembled from selected patterns; choosing, ordering and realizing patterns is itself compositional work. Every chord comes from a stock pattern, chained to the next by the shortest way.
It sounds like the music of 1760, in a deliberately reduced teaching realization: the skeleton of a minuet by nobody. A Neapolitan student would now decorate it, with a tune, rhythms and ornaments, and the listeners of the time, who knew the schemata as well as the composer did, would hear each one go by, and enjoy how it was dressed. Gjerdingen's claim is that much of the style really was made this way, and that this is why so much of it sounds alike.
How did a skeleton become music? By diminution: the long notes of the schema's melody are divided into quicker ones that pass between them. Here is the Prinner plain, and then with each melody note broken into four, the chord notes on the beats and passing notes between.
Treatises of the time listed hundreds of such figures for each interval, and students copied them out. The schema is what stays the same; the diminution is what makes one minuet sound different from another, and it is the same art as the passing notes of Part 17's chorales.
10Where the schemata areFull course2 min
Can a machine find them?
A formal schema template can be searched for, though any detector captures only part of an interpretive category. Write each one as its bass and melody notes, and search the chorales' beats for them, in order. As a control, search the same chorales with their beats shuffled. The result is nearly empty: schemata in major chorales, against a handful by chance. Bach's chorales are not galant music. Their tunes are older, given in advance, and set one chord to a note; the schemata belong to the instrumental and operatic music of Bach's younger contemporaries and the generation after, and a detector this strict, demanding every note in place, misses the ornamented forms in which they usually appear.
The schemata's melodies are another matter. Search the series' fifty-one major tunes, from Part 14, for them. The Prinner's falling six, five, four, three is in tunes, against fewer than one if their notes were shuffled. A melody falling four, three, two, one is in . These are the stepwise descents of Part 14, and they are the melodies that schemata were built on. And the Tune has one: A, A, G, F, F, E, E, from the end of its first phrase into its second, is six, five, four, three. This fragment matches the Prinner’s melodic descent; melody alone does not establish a complete historical schema.
So give it its bass. Here is the Tune from its fifth note, A, A, G, F, F, E, E, and then D, D, C, with a Prinner's bass under the first four chords, F, E, D, C, and a cadence after it. The nursery tune turns out to speak the galant language.
11Ground bassesFoundations2 min
What happens when a progression repeats forever?
Some progressions were repeated over and over, while melodies and variations changed above them: ground basses. Here are four, each played twice round. Three are in minor keys, one in major. Which is the major one: A, B, C or D?
C. It is the Romanesca's descending bass in a major key, the progression Johann Pachelbel put under his famous canon: one, five, six, three, four, one, four, five. The other three are minor: the lament, la Folia, and the passamezzo antico.
What did musicians do with a ground? They varied what went above it, round after round, while the bass and the chords stayed fixed. Here is the Folia once with its chords alone, and once more with the chords broken into running notes above it: the simplest of the thousands of variations written on it.
Corelli's twenty-three variations do this with every resource of the violin: quick runs, double stops, slow lyrical rounds, a gigue. A listener familiar with the ground may track their place in its cycle, because the ground never changes, and the pleasure is in the distance between what stays and what moves.
These grounds have long histories. The lament is a bass falling four steps from home to the dominant; Monteverdi set his Lament of the Nymph over it in 1638, and Purcell's Dido sings her lament in 1689 over a chromatic form of it, falling by semitones. La Folia began as a wild Portuguese dance; Corelli wrote twenty-three variations on it in 1700, and composers from Vivaldi to Rachmaninoff returned to it. The passamezzo antico carried sixteenth-century dances. The Romanesca's bass is Pachelbel's, and its descending line runs under many popular songs. The chromatic lament still turns up in rock, a bass falling by semitones under a held chord. A ground is harmonic syntax frozen into a single sentence, repeated: the progression is fixed, and the art is in what goes over it.
12Frontier: harmony at scaleResearch3 min
Is there one syntax of harmony, or many?
This part counted one composer's chorales. Recent work counts harmony at scale. In 2011 Trevor de Clercq and David Temperley annotated every chord of roughly one hundred rock songs in the original 2011 study; the same year, the McGill Billboard corpus annotated hundreds of chart songs; in 2018 a team led by Martin Rohrmeier annotated all sixteen of Beethoven's string quartets. The syntax is not the same everywhere. In rock, four and flat seven are everywhere, and four going to one is among the commonest moves of all: the backward root motions that Bach used sparingly. Beethoven's quartets stay closer to Bach's forward syntax, with more chromatic chords.
Is harmonic syntax only a description of what composers do, or something listeners process? In 1998 Aniruddh Patel and colleagues found that a chord from a distant key, in the middle of a progression, evokes a late positivity with similarities to a response in some language tasks, measured on the scalp, associated with syntactic difficulty in sentences; a similar scalp response does not by itself establish identical neural computations. In 2000 Stefan Koelsch and colleagues found an earlier response, about a fifth of a second after a chord that breaks the expected order, which they called the early right anterior negativity. It appears in listeners with no musical training at all: consistent with implicit musical learning; the response is task- and stimulus-dependent. It is strongest when a cadence that should end on the tonic ends on a chord that does not belong there.
Is harmony a chain, each chord depending on the last, or a tree? Martin Rohrmeier proposed in 2011 a generative grammar of harmony, like the grammars linguists write for sentences: a phrase is a tonic that is prolonged, and a dominant inside it is prepared by a subdominant, which can itself be prepared, and so on. In a tree, a chord can depend on one far away, which a table of pairs, like this part's, cannot represent. Gjerdingen's schemata suggest a third picture: a construction grammar, in which the units are not single chords but stock phrases, learned whole.
What remains open is which picture is right, for listeners rather than analysts. Do people hear harmony as a chain of pairs, as a tree, or as a stock of learned phrases, and does it depend on the music they grew up with? And could a machine, given a large corpus and no theory, discover the galant schemata for itself, as the Neapolitan boys learned them, from examples alone?
Variation 18, recap and problemsAll tracks3 min
Every part ends by doing something to the Tune with what it has built. This part built a grammar of basses. So the Tune's two phrases are played three times, over three of them: the Romanesca, Pachelbel's falling bass, with a cadence; the chromatic lament, the Tune now in a minor key; and two pedals, the bass holding the tonic and then the dominant while the harmony changes above it. One melody, and three ways of supporting it.
Row eighteen of the ledger. seconds. The measurement: twenty-four chords, every one holding the Tune's note at that moment, and not one pair of voices moving in parallel fifths or octaves. The melodic pattern is retained with the stated minor adaptation; the bass decides what it means.
What did we find? Chords have jobs, and in Bach the jobs come in an order: away, tension, home. Roots fall by fifths more than they move any other way. The next chord costs about bits when the last one is known, a bit and a half less than if the order were random. Sequences repeat a step; new chords land on strong beats. The Neapolitans taught harmony as a rule for every note of the scale, and about half of the selected stepwise-bass cases have pitch-class inclusion in this chosen rule realization. And composers of the galant style spoke in stock phrases, schemata, while for four centuries musicians have improvised over grounds, a single progression repeated.
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? At once, in chromatic harmony, which bends this syntax to travel far. In canon and fugue, and in form, which is this syntax stretched over minutes. The galant style returns in the parts on the classical era, and the syntax of other traditions, jazz's two-five-one and pop's four chords, in parts of their own.
And in practice. Keyboard players still learn the rule of the octave, as partimento teaching comes back into conservatories. Songwriters borrow grounds. Improvisers think in stock phrases, a Prinner or a two-five-one. And arrangers put new harmony on the strong beats.
The books and papers this part follows. The full list, with notes, is in the README.
Where it goes next. Chromatic harmony in Part 19; canon and fugue in Part 20; form as a journey between keys in Part 21; the Baroque and the classical style in Parts 25 and 26; jazz's ii-V-I in Part 39 and pop's four chords in Part 40.
Key results
The part's results in one place, for revision.
Try it
Lab 18 · Progressions, counted
Measure the order of harmonic functions and the motion of roots in Bach's chorales, see how predictable the next chord is, realize an unfigured bass by the rule of the octave, search for galant schemata, and hear root motion.
python -m videos.music.labs 18
needs numpy, scipy, matplotlib · download lab18.py ·
source on GitHubmajor chorales: T>S, S>D, D>T / S>T, D>S, T>D 1246, 788, 1412 / 748, 290, 913
root motion (in a hundred) fifth down 39, step up 16, fifth up 16, third down 10, step down 9, third up 5, same 3, tritone 2
bits per chord: uniform, frequencies, pairs, triples 6.13, 4.05, 3.43, 3.91
the same chords shuffled: pairs, triples 4.85, 5.36
the bass, realized 72-67-64-48 72-67-64-52 72-69-62-53 71-67-62-55 72-66-62-57 71-67-62-55 72-69-65-53 74-69-65-50 74-71-67-55 76-72-67-48
how each chord was chosen leap: a triad (5/3); rule, up (6); rule, up (6/5); rule, up (5/3); rule, down (4/3); rule, down (5/3); leap: a triad (5/3); leap: a triad (5/3); leap: a triad (5/3); leap: a triad (5/3)
parallel fifths or octaves none
schemata in 185 major chorales (shuffled) Romanesca 0 (0), Prinner 3 (0), Do-Re-Mi 7 (2), Meyer 0 (0), Fonte 3 (0), Monte 0 (0), Ponte 0 (0), Quiescenza 0 (0)
ear problem, the eight progressions (listen first) step; fifth down; fifth up; step; fifth up; fifth up; fifth up; step
Harmony has an order: away, tension, home; roots fall by fifths more than anything else; the chord before saves more than a bit per chord; a scale's worth of rules realizes a bass; and the galant schemata are hardly in the chorales, which belong to an older practice.
The code (105 lines; it asserts its own result)
"""Lab 18: the syntax of harmony measured on Bach's chorales, a partimento bass realized by the rule of the octave,
galant schemata found (or not) by a detector, and root motion by ear."""
import numpy as np
from videos.coursekit import labs
from explainer.music.monochord import Clip, concat
from explainer.music.monochord import chorales as BC
from explainer.music.monochord import chords as CH
from explainer.music.monochord import fourpart as F
from explainer.music.monochord import progression as P
from explainer.music.monochord.partkit import organ_tone
TITLE = "Progressions, counted"
GOAL = ("Measure the order of harmonic functions and the motion of roots in Bach's chorales, see how predictable the "
"next chord is, realize an unfigured bass by the rule of the octave, search for galant schemata, and hear root "
"motion.")
TASKS = [
"Set BASS to a bass of your own in C major (key numbers from 40 to 60). Where does the realizer use the rule, and where a plain triad? Does it make parallels?",
"Set ALPHA to 0.01 and to 1.0. How does the smoothing change the bits per chord of the models of pairs and triples, and why does the triple model suffer most?",
"Add a schema of your own to SCHEMATA (bass and melody degrees in semitones) and count it in the chorales and in shuffled ones.",
]
BASS = [48, 52, 53, 55, 57, 55, 53, 50, 55, 48] # C E F G A G F D G C, unfigured
ALPHA = 0.1 # add-alpha smoothing of the chord models
SCHEMATA = dict(P.SCHEMATA)
SR = 48_000
def run(seed=0):
rng = np.random.default_rng(seed)
lab = labs.Lab()
book = BC.load()
# 1. functions and root motion
f = P.function_transitions(book, "major")
lab.row("major chorales: T>S, S>D, D>T / S>T, D>S, T>D", f"{f['TS']}, {f['SD']}, {f['DT']} / {f['ST']}, {f['DS']}, {f['TD']}")
m = P.root_motions(book, "major")
tot = sum(m.values())
lab.row("root motion (in a hundred)", ", ".join(f"{k} {100 * v / tot:.0f}" for k, v in m.most_common()))
assert m.most_common(1)[0][0] == "fifth down"
# 2. how predictable
train, test = BC.split(book, offset=2)
p = P.predictability(train, test, "major", alpha=ALPHA)
lab.row("bits per chord: uniform, frequencies, pairs, triples", f"{p['uniform']:.2f}, {p['n1']:.2f}, {p['n2']:.2f}, {p['n3']:.2f}")
lab.row("the same chords shuffled: pairs, triples", f"{p['n2_shuffled']:.2f}, {p['n3_shuffled']:.2f}")
# 3. a partimento: the bass realized by the rule of the octave
real = P.realize_bass(BASS)
lab.row("the bass, realized", " ".join("-".join(str(x) for x in r["chord"]) for r in real))
lab.row("how each chord was chosen", "; ".join(f"{r['how']} ({r['figure']})" for r in real))
par = [k for k, (a, b) in enumerate(zip(real, real[1:])) if F.parallels(a["chord"], b["chord"])]
lab.row("parallel fifths or octaves", str(par or "none"))
# 4. schemata in the chorales, real and shuffled
real_c, shuf_c = {}, {}
for c in book:
if c.mode != "major":
continue
ev = P.degree_events(c)
for name, _ in P.find_schemata(ev, SCHEMATA):
real_c[name] = real_c.get(name, 0) + 1
for name, _ in P.find_schemata([ev[i] for i in rng.permutation(len(ev))], SCHEMATA):
shuf_c[name] = shuf_c.get(name, 0) + 1
lab.row("schemata in 185 major chorales (shuffled)", ", ".join(f"{n} {real_c.get(n, 0)} ({shuf_c.get(n, 0)})" for n in SCHEMATA))
# 5. Problem 3, for the ear: eight two-chord progressions
kinds = {"fifth down": 5, "fifth up": 7, "step": 2}
answers, clips = [], []
for _ in range(8):
kind = list(kinds)[int(rng.integers(0, 3))]
r0 = int(rng.integers(0, 12))
r1 = (r0 + kinds[kind]) % 12
y = np.zeros(int(2.6 * SR))
for t, r in enumerate((r0, r1)):
notes = [36 + r, 48 + r, 52 + r if t == 0 else 52 + r, 55 + r]
notes = [n if n < 72 else n - 12 for n in notes]
tone = sum(organ_tone(CH.hz(n), 1.1, partials=6, rolloff=0.7, decay=1.2) for n in notes)
i = int(t * 1.0 * SR)
y[i:i + len(tone)] += tone[: len(y) - i]
clips.append(Clip(y, SR).fade(0.01, 0.2).at_level(-20.0))
answers.append(kind)
lab.audio = concat(clips, gap=0.9)
lab.row("ear problem, the eight progressions (listen first)", "; ".join(answers))
fig, (a, b) = labs.figure(2)
keys = [k for k, _ in m.most_common()]
a.bar(range(len(keys)), [100 * m[k] / tot for k in keys], color=[labs.GOLD if P.MOTION_KIND[k] == "forward" else "#888" for k in keys])
a.set_xticks(range(len(keys)))
a.set_xticklabels(keys, rotation=30)
a.set_ylabel("in a hundred")
a.set_title("How roots move in Bach's major chorales")
names = ["uniform", "frequencies", "pairs", "triples"]
b.bar(np.arange(4) - 0.2, [p["uniform"], p["n1"], p["n2"], p["n3"]], width=0.4, color=labs.GOLD, label="held-out chorales")
b.bar(np.arange(4)[2:] + 0.2, [p["n2_shuffled"], p["n3_shuffled"]], width=0.4, color="#888", label="the same, shuffled")
b.set_xticks(range(4))
b.set_xticklabels(names)
b.set_ylabel("bits per chord")
b.set_title("How predictable the next chord is")
b.legend(frameon=False)
lab.fig = fig
lab.note = ("Harmony has an order: away, tension, home; roots fall by fifths more than anything else; the chord "
"before saves more than a bit per chord; a scale's worth of rules realizes a bass; and the galant "
"schemata are hardly in the chorales, which belong to an older practice.")
return lab
Now change it
- Set BASS to a bass of your own in C major (key numbers from 40 to 60). Where does the realizer use the rule, and where a plain triad? Does it make parallels?
- Set ALPHA to 0.01 and to 1.0. How does the smoothing change the bits per chord of the models of pairs and triples, and why does the triple model suffer most?
- Add a schema of your own to SCHEMATA (bass and melody degrees in semitones) and count it in the chorales and in shuffled ones.
Problems, with solutions
Try each problem before opening its solution.
-
Compute. Write the descending-fifths sequence in G major, roots and bass. Where is the one diminished fifth, and why must it be there?
Solution
G, C, F♯, B, E, A, D, G: I, IV, vii°, iii, vi, ii, V, I. The step from C down to F♯ is a diminished fifth (six semitones); every other step is a perfect fifth (seven). It must be there because the cycle stays in the key: seven perfect fifths down from G would reach C, F, B♭, … and leave G major after the second chord. Seven steps of a fifth span 7 × 7 = 49 semitones in all, four octaves and a semitone, so to come back to G after seven steps (48 semitones) exactly one step must be a semitone short.
-
Prove. Show that a cycle of seven falling fifths through a major key visits every degree once, and that it cannot be done with perfect fifths only.
Solution
Falling by a fifth within the scale means moving four degrees down (or three up), so after k steps the root is degree 1 + 3k (mod 7). Since 3 and 7 share no factor, k = 0, …, 6 give seven different degrees, and k = 7 returns to the start. With perfect fifths only, k steps move 7k semitones, which is a multiple of 12 only when k is a multiple of 12; after seven steps the root is 49 mod 12 = 1 semitone away from where it began, a pitch class different from the starting tonic (the direction is reversed for falling fifths). So one step must be diminished, as in problem 1.
-
Ear. The lab plays eight two-chord progressions. For each, say whether the root falls a fifth, rises a fifth, or moves by step.
Solution
The lab prints the answers. A falling fifth sounds like a small arrival (V–I, ii–V); a rising fifth like a step away (I–V); a move by step changes every note of the chord (IV–V) and has no common tone.
-
Build. Extend the schema detector to allow the melody notes to be ornamented (other notes between them). How many more schemata does it find in the chorales, and how many in shuffled ones?
Where to look. Replace the consecutive match in
progression.find_schemataby a subsequence match within a window (for example, the schema's events in order within twice as many beats), and keep the bass events consecutive. The count rises, but so does the shuffled count, and the ratio between them is what matters. Allowing gaps quickly lets chance produce "schemata", which is why published detectors constrain metre and voice leading as well. -
★ Chains, trees or phrases? Design an experiment to tell whether listeners hear harmony as a chain of pairs, as a tree, or as stock phrases.
Where the frontier is. The three accounts predict different things when a progression is interrupted or rearranged. A chain predicts that what matters is only the last chord; a tree predicts that a chord far back (an opening tonic, say) still shapes expectations at the end, so swapping two distant chords changes judgements; a phrase account predicts that intact schemata are recognized as units, so cutting one in half is worse than cutting between two. Experiments with reordered and interrupted progressions, probe chords and reaction times (Bigand and Parncutt 1999; Woolhouse, Cross and Horton 2016; Rohrmeier and Cross 2014) give partial and mixed answers; the question is open, and may have different answers for listeners raised on different music.
Notes and sources
Sources
Books: R. O. Gjerdingen, Music in the Galant Style (2007) and Child Composers in the Old Conservatories (2020); G. Sanguinetti, The Art of Partimento (2012); F. Campion, Traité d'accompagnement et de composition selon la règle des octaves de musique (1716); J.-P. Rameau, Traité de l'harmonie (1722); J. Riepel, Grundregeln zur Tonordnung insgemein (1755); H. Riemann, Vereinfachte Harmonielehre (1893); S. G. Laitz, The Complete Musician (4th ed., 2015).
Papers: N. Meeùs, "Toward a post-Schoenbergian grammar of tonal and pre-tonal harmonic progressions", Music Theory Online 6 (2000); M. Rohrmeier, "Towards a generative syntax of tonal harmony", Journal of Mathematics and Music 5 (2011); T. de Clercq and D. Temperley, "A corpus analysis of rock harmony", Popular Music 30 (2011); J. A. Burgoyne, J. Wild and I. Fujinaga, "An expert ground truth set for audio chord recognition and music analysis", ISMIR (2011); M. Neuwirth, D. Harasim, F. C. Moss and M. Rohrmeier, "The Annotated Beethoven Corpus (ABC)", Frontiers in Digital Humanities 5 (2018); R. O. Gjerdingen and J. Bourne, "Schema theory as a construction grammar", Music Theory Online 21 (2015); E. Bigand and R. Parncutt, "Perceiving musical tension in long chord sequences", Psychological Research 62 (1999); M. Rohrmeier and I. Cross, "Modelling unsupervised online-learning of artificial grammars: linking implicit and statistical learning", Consciousness and Cognition 27 (2014).
Additional papers cited in the frontier: A. D. Patel, E. Gibson, J. Ratner, M. Besson and P. J. Holcomb, “Processing syntactic relations in language and music: an event-related potential study”, Journal of Cognitive Neuroscience 10 (1998), 717–733; S. Koelsch, T. Gunter, A. D. Friederici and E. Schröger, “Brain indices of music processing: ‘Nonmusicians’ are musical”, Journal of Cognitive Neuroscience 12 (2000), 520–541.
- W. Piston, Harmony (1941; 5th ed., rev. M. DeVoto, 1987): the table of usual root progressions that chapter 2 counts.
About this partfrom its README
Part 18 of a sixty-eight-part course in music (see the series plan and
the syllabus), the third part of Act III. Part 17 counted which chord follows which and used
the table without asking why; this part asks. It measures the syntax of harmony on Bach's chorales (the order of
harmonic functions, root motion, how predictable the next chord is, sequences, harmonic rhythm), then goes to
eighteenth-century Naples for the rule of the octave and the galant schemata, builds a detector for schemata,
and ends with four centuries of ground basses. The syntax is Monochord's
(explainer/music/monochord/progression.py), measured on Part 17's chorales
(explainer/music/monochord/chorales.py); the galant examples are realized in compute.py and played on a
plucked string over Part 7's soundboard. Published findings are the ones listed under Sources.
- Orphans, and a bass. Naples's four conservatories, orphanages that trained musicians; partimenti; a bass climbing and falling a scale, alone and with the rule of the octave above it, heard; the plan.
- 1. Three jobs, in order. Riemann's tonic, subdominant and dominant (1893); in Bach's major chorales T→S 1,246, S→D 788, D→T 1,412 (3,446 round the cycle), T→D 913, against the cycle 1,038 (D→S only 290); an ear question (I–IV–V–I against I–V–IV–I).
- 2. How roots move. Root motion in the major chorales: falling fifths 39 in a hundred, then rising steps and falling thirds; Meeùs's forward and backward progressions (2000): forward 69 in a hundred; an ear question (vi–ii–V–I against I–V–ii–vi); why the falling fifth: the overtones, the voices, Rameau's fundamental bass (1722).
- 3. How predictable is harmony? The guessing game (after IV: I 33 in a hundred, V 14, ii 9; after V: I 52); bits per chord on 84 chorales whose tunes the model never saw: 6.1 if all chords were equally likely, 4.0 from their frequencies, 3.4 from the chord before, 4.9 for the same chords shuffled; in minor 3.8 (5.5); two chords back, too little data to help.
- 4. The same step, again. The descending-fifths sequence in C major, heard (F to B the one diminished fifth); runs of falling fifths in the chorales: 770 of three chords, 205 of four, 68 of five, 21 of six or seven.
- 5. When chords change. A new chord on beat 1 of a bar of four 78 times in a hundred, beat 3 79, beats 2 and 4 65 and 60, against about 77 on every beat when each chorale's chords are shuffled: the weak beats hold the chord, and harmonic rhythm follows the metre of Part 11.
- 6. Naples and the partimento. Campion's rule of the octave (1716); Durante, Leo, Fenaroli; Pergolesi, Paisiello, Cimarosa; Gjerdingen (2007) and Sanguinetti (2012); the rule up and down, heard: plain triads only on the first and fifth degrees, and different chords rising and falling.
- 7. Bach and the rule. Where Bach's bass passes by step through a degree (804 beats in major chorales), his chord's notes lie within the rule's chord 49 times in a hundred, its exact figure 28; rising through the leading note 74, falling through the third 71, through the second degree rarely.
- 8. Galant schemata. Gjerdingen's stock phrases; Riepel's Monte, Fonte and Ponte (1755); eight realized in four voices and heard: Do-Re-Mi, Romanesca, Meyer, Prinner, Fonte, Monte, Ponte, Quiescenza.
- 9. A phrase from parts. Do-Re-Mi, Prinner ‖ Fonte, Monte, Ponte, cadence, chained by the shortest way, heard.
- 10. Where the schemata are. A strict detector on the chorales' beats finds 13 in 185 major chorales (2 in shuffled ones): Bach's chorales are not galant music; the schemata's melodies in the series' 51 major tunes: 6-5-4-3 in 11 (0.4 shuffled), 4-3-2-1 in 23 (1.6), 5-4-3-2-1 in 15 (0.3); the Tune's A A G F F E E is a Prinner's melody.
- 11. Ground basses. An ear question (four grounds, which is major?); the lament (Monteverdi 1638, Purcell 1689), la Folia (Corelli 1700), the passamezzo antico, the Romanesca and Pachelbel's canon, the chromatic lament in rock.
- 12. Frontier: harmony at scale. Rock (de Clercq and Temperley 2011), the Billboard corpus, the Annotated Beethoven Corpus (2018); a grammar of harmony (Rohrmeier 2011) and schemata as a construction grammar (Gjerdingen and Bourne 2015). ★ research problem: chains, trees, or stock phrases, for listeners.
- Variation 18, recap and problems. The Tune's two phrases over the Romanesca with a cadence, over the chromatic lament (in minor), and over a tonic and then a dominant pedal; the ledger; what we found; five problems; where it comes back; in practice; references; Part 19.
What is computed and built
python -m videos.music.music18.compute (about a minute) fills .cache/music18/.
| Item | What it computes | Checked against |
|---|---|---|
hook |
the rule of the octave up and down over a scale | fourpart.parallels (none) |
functions |
T, S, D transitions in the chorales; two orders of I, IV, V | — |
motion |
root motion by interval class; falling and rising fifths, heard | — |
predict |
cross-entropy of n-gram chord models on chorales held out by tune; the guessing game | the same chords shuffled |
sequence |
the descending-fifths sequence; runs of falling fifths | — |
rhythm |
chord changes by beat of the bar | — |
octave |
the rule realized; Bach's chords on stepwise basses against it | Campion's figures |
schemata |
eight schemata realized; a phrase of them | no parallels |
census |
schemata in the chorales and the schemata's melodies in the tunes | shuffled controls |
grounds |
four ground basses realized | — |
tune |
Variation 18 | every chord holds the Tune's note; no parallels |
Monochord's syntax of harmony is held in tests/music/test_progression.py; this part's claims and clips in
tests/music/test_music18.py.
Sounds. A string plucked near its end, as a harpsichord's quill plucks it (Part 1's monochord, retuned for each
note), through Part 7's soundboard (physical model), in twelve-tone equal temperament. There are no recordings.
What the models are, and are not. Functions are read off the root alone (iii counted as tonic, vii° as dominant); Riemann's own theory is subtler. Root motion and n-gram models use Part 17's beat labels, with repeated chords merged and unlabelled beats dropped; with 280 training chorales a model of chord triples is starved of data, which is why it does worse than pairs. The rule of the octave is Campion's in its common form; Neapolitan versions differ in details, and comparing Bach with it is anachronistic in spirit: it measures how much of his practice the rule captures, not what he was taught. The schemata are realized in their simplest textbook forms; real galant music ornaments them, and the detector, which demands every note in place on the beats, finds only plain instances. The chorales are the wrong corpus for galant schemata, and the film says so; no galant corpus was available offline. Ground basses are reduced to one chord per half bar. The frontier's corpus findings are summarized from the publications, not recomputed.
Notes
The functional classifier and directed-root categories are analytical choices. Cross-entropy depends on chord vocabulary, merge/drop preprocessing, split and model; the fixed label alphabet is collected from both training and test labels, while model frequencies use training only; the shuffle comparison is not a universal entropy of harmony. A template match is not a complete historical schema interpretation. Pitch-class containment in the selected octave-rule chord is weaker than exact harmonic agreement. The original 2011 rock study used about one hundred songs. Similar ERP responses in language and music do not prove identical computations. Seven perfect falling fifths fail to close the octave cycle; the endpoint can still be diatonic (for example F-sharp from G), so failure of closure does not imply an out-of-key final pitch.
Companion material in this repository
The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
- Hook: Naples's conservatories; a partimento bass, alone and with the rule of the octave; the plan.
- Three jobs, in order: T, S, D and how often each follows each in Bach (an ear question).
- How roots move: root motion counted; forward and backward (an ear question); why the falling fifth.
- How predictable is harmony: the guessing game (a predict-pause); bits per chord on held-out chorales.
- The same step, again: the descending-fifths sequence heard; runs of fifths counted.
- When chords change: harmonic rhythm against the metre.
- Naples and the partimento: Campion, Durante, Fenaroli; the rule of the octave up and down, heard.
- Bach and the rule: his chords on stepwise basses against the rule's.
- Galant schemata: Riepel and Gjerdingen; eight schemata realized and heard.
- A phrase from parts: Do-Re-Mi, Prinner, Fonte, Monte, Ponte, cadence, heard.
- Where the schemata are: a detector on the chorales and the schemata's melodies in the tunes.
- Ground basses: four heard (an ear question); four centuries of grounds.
- Frontier: rock, Billboard and Beethoven corpora; a grammar of harmony; schemata as constructions.
- Variation 18: the Tune over three basses. Outro: problems, payoffs.
Covers: function and root motion; the descending-fifths sequence; harmonic rhythm; the rule of the octave;
partimento; the Romanesca, Prinner, Monte, Fonte and Ponte; ground basses from the Folia to the lament.
Built and computed: monochord/progression.py: functions and root motion counted in the chorales; the entropy of
harmony as the cross-entropy of n-gram chord models on chorales held out by tune; runs of fifths; harmonic rhythm;
the rule of the octave realized and compared with Bach; eight schemata realized; a schema detector with shuffled
controls; ground basses realized. Played on a plucked string over Part 7's soundboard. No galant corpus was
available offline, so the detector is run on the chorales and on the series' tunes, and the film says what that
can and cannot show.
Variation 18: the Tune over the Romanesca, the chromatic lament bass, and two pedals.
Frontier: corpus harmony at scale; schema learning.
Reading: Gjerdingen, Music in the Galant Style; Sanguinetti, The Art of Partimento; Laitz.
Build the film
python -m videos.music.music18.compute # the part's numbers, into .cache/music18
python tools/build.py music18 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py music18 Hook # one chapter, silent, with a contact sheet
Scenes: videos/music/music18. Setup: see the course page. Source of these notes: the README and the scenes' narration.
Build it
python -m videos.music.music18.compute # numbers and sounds (about a minute)
EXPLAINER_TTS=silent python tools/build.py music18 -q l --fps 15 # a silent-narration preview, with the sounds
python tools/qa_sound.py music18 --sync # the sound gates
python tools/dead_air.py renders/music18_480p.mp4 --sound music18 # no empty screen; no sound over a still one
python tools/lecture_length.py music18 # 30 to 60 minutes, listening included
python tools/build.py music18 # 1080p30, narrated
python -m pytest -q tests/music # Monochord against its references; this part's claims and clips
python -m videos.music.labs 18 # the lab (writes a figure and a short WAV)