♪Music, Built

Act III · Voices

Part 22 of 68

Analysis

Foundationsstarts at this level36 min of film14 chaptersprerequisites: Part 14, Part 17, Part 18, Part 19, Part 21

What is an analysis of a piece of music, and can it be written as a grammar and tested?

Strip the Tune of its decorations, level by level, and one line remains: tonic, dominant, tonic. Schenker claimed every tonal masterpiece elaborates a stepwise descent to the tonic over a bass that arpeggiates I-V-I; 22 of Part 14's 51 major tunes do end on such a descent, against about 3.4 when their notes are shuffled. Lerdahl and Jackendoff wrote the hearing down as rules: three grouping rules put the Tune's five strongest boundaries exactly on its phrase ends, and a sum of preferences picks the head of every span. Rohrmeier wrote harmony as a context-free grammar of tonic, dominant and subdominant regions; the CYK algorithm parses with it, repeated cadences have Catalan numbers of trees (2, 14, 132, 1,430), and I IV I V I has none until a plagal rule is added. Trained on 934 of Bach's chorale phrases and scored on 231 held out, the six-rule grammar predicts no better than counting chords (3.90 bits a chord against 3.93), and worse than chord pairs (3.33); run forwards, a grammar of elaboration regrows the Tune's skeleton into melodies that obey the harmony and never repeat a motive. Other traditions analyse expectation, topics, transformations or the levels of a work; the argument over Schenker's views of 2019 and 2020 is set out with its sources. Bach's phrases parse as chains almost as deep as they are long, and whether listeners hear nesting is a question for experiments. Variation 22 regrows the Tune from its skeleton.

What you need. Part 14 for the tunes; Part 17 for the chorales and Roman numerals; Part 18 for n-gram models; Part 19 for Lerdahl's tension; Part 21 for form and Cook's experiment. Context-free grammars, dynamic programming, the EM algorithm, cross-entropy.

Ideas, mathematics and history
Schenker's reductions and their critics, Lerdahl and Jackendoff's generative theory, harmony as a grammar, parsing
What we build, compute and hear
a probabilistic grammar of chord sequences; the Tune reduced and regrown

What you will be able to do

Foundations

  • Recognize passing, neighbour, arpeggiation and repetition, and say which note each one prolongs.
  • Reduce a short melody to a skeleton, and hear which of two skeletons fits.
  • Read a tree of tonic, dominant and subdominant regions over a progression.

Full course

  • Implement a time-span reduction by a sum of preferences, and grouping preference rules.
  • Parse a progression with the CYK algorithm, count its trees, and prove the Catalan counts.
  • Train a probabilistic grammar by inside-outside and compare it with n-grams in bits per chord on held-out data.

Research

  • Weigh the evidence on whether listeners hear nested harmony, and design an experiment that measures a listener's reduction.
  • Explain why a grammar of melody needs a copy rule, and what that does to its place in Chomsky's hierarchy.

Practice

  • Generate melodies from a skeleton under a harmony, and say what a generator without repetition lacks.
  • Choose between a grammar and an n-gram model for a product that must explain, or must predict.

Contents

Each chapter has a home level. Choose a track to see what to read and watch: Foundations 22 min · Full course 31 min · Research 36 min · Practice 25 min.

  1. 0One line, walking downFoundations2 min
  2. 1Reduction and prolongationFoundations2 min
  3. 2The UrsatzFoundations3 min
  4. 3Grouping and metreFoundations2 min
  5. 4A time-span reductionFoundations3 min
  6. 5Harmony as a grammarFoundations2 min
  7. 6Parsing and ambiguityFull course3 min
  8. 7A grammar learned from BachFull course3 min
  9. 8Growing a melodyPractice3 min
  10. 9Other ways to analyseFoundations3 min
  11. 10A theory and its authorFoundations2 min
  12. 11Is harmony recursive?Research3 min
  13. 12Frontier: grammars from dataResearch2 min
  14. Variation 22, 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.

One line, walking downFoundations2 min

Here is the Tune, and below it the Tune reduced: at each level, every span keeps only its most important note, the note preferred by this simplified harmony-and-metre score. Listen to the levels one after another, from the surface down to the skeleton.

At two beats a note, the Tune becomes C, G, A, G, F, E, D, C: the climb to the fifth and the walk down. At sixteen beats, only C, G, C remain: home, the dominant, home. Every melody, a theory says, is the elaboration of something much simpler.

The theory belongs to Heinrich Schenker, a Viennese music theorist whose last book, Der freie Satz, appeared in 1935, the year of his death. His claim: at the deepest level, every tonal masterpiece is one line falling by step to the tonic, over a bass that goes from the tonic to the dominant and back. Everything else, every note you hear, is elaboration of that, level upon level. The Tune does it in plain sight: it climbs to G, the fifth, and walks down, F, E, D, C.

This part takes the claim seriously as a theory, and tests it. First what reduction means, and Schenker's fundamental structure. Then a version precise enough to compute, Lerdahl and Jackendoff's. Then harmony written as a grammar, with trees and parsing, trained on Bach's chorales and scored against the chord-pair model of Part 18. Then a grammar that grows melodies, and other ways to analyse. And then the arguments: about Schenker himself, and about whether harmony is recursive at all.

1Reduction and prolongationFoundations2 min

Which notes are the skeleton, and which the flesh?

Reduction rests on a few ways one note can serve another. A passing note fills the gap between two notes a third apart. A neighbour note steps away and comes back. An arpeggiation unfolds a chord in time. A repetition strikes the same note again. These examples suggest structural and elaborating notes; the full context determines a reduction, and the structural note is said to be prolonged: it lasts, in the listener's mind, through the notes that decorate it.

Hear the four, in order. In each, the first note is the one that lasts in the mind.

Reduction is the reverse of decoration: remove the servants, and see what they served.

Your turn. You will hear the Tune's first strain, then two candidate skeletons, one note every four beats, over the same chords. Which skeleton belongs to the strain, A or B?

B: C, G, E, C. Each of its notes is a note of the chord sounding at that moment, on the strongest beat of its span, and a stable degree of the scale. A replaced two of them by their neighbours, A and F, and they rub against the chords. A skeleton is not any set of notes that fits the rhythm: it is one contextually supported reading, rather than a uniquely determined subset.

The idea scales up. A note can be prolonged for a bar, a phrase, or longer. A whole section can prolong a single chord: some passages can be analyzed as extended dominant preparation; a sonata development does not universally prolong one dominant. So a piece becomes a tree, every event elaborating a deeper one. The claim behind reduction is that listeners hear the deep events through the surface, as a reader hears a sentence's structure through its words. This part asks whether that is true, and whether it can be computed.

2The UrsatzFoundations3 min

Is every tonal piece one descent to the tonic?

Schenker's fundamental structure, the Ursatz, has two parts. On top, the fundamental line, falling by step from the third, fifth or octave of the scale to the tonic: here, from five. Below it, the bass arpeggiation: tonic, dominant, tonic, the dominant arriving under the second degree, so that the last step, two to one, is a cadence. The Tune lays this out on its surface: its first phrase ends on G, the fifth; the second walks down F, E, D, C over the dominant and the tonic.

Is the bass really part of the structure? Hear the Tune's second phrase, F F E E D D C, twice over two different basses. In which does the last step, D to C, sound like an ending, A or B?

B. Over a held tonic, A's descent is a scale that stops; it lacks the dominant-to-tonic bass articulation of B, though melodic closure remains possible. Over the Tune's own bass, the D sits on the dominant and the C arrives with the tonic, and the step is a cadence. That is why Schenker joined the two lines: the falling melody and the bass's motion to the dominant together make the close.

How common is the fundamental line on the surface? Take Part 14's major-key tunes and ask whether each one ends with a stepwise descent to the tonic, five-four-three-two-one or three-two-one, with repeated notes merged. of the do, of them from the fifth, the Tune among them. Shuffle each tune's notes, keeping its last note, and about would by chance. These selected major-key tunes show more of the specified surface descents than this shuffle baseline; many cadences use other melodic endings.

What does the Ursatz buy? It offers an interpretation of some tonal endings, and why some notes feel more important than others. But it is a theory that decides in advance what it will find: the analyst looks for a descent, and finds one. Two analysts can reduce the same piece in different ways, both following the method. And it was built for one repertoire, German instrumental music from Bach to Brahms, and Schenker used it to rank music: what did not fit was lesser. To test a theory like this, its rules have to be written down precisely enough for someone else, or a program, to follow them. That was the aim of the next book.

3Grouping and metreFoundations2 min

Can the rules of hearing be written down?

In 1983 a composer and a linguist, Fred Lerdahl and Ray Jackendoff, set out to write the rules down. Their Generative Theory of Tonal Music describes the structures an experienced listener infers from a piece, four of them: grouping into motives and phrases, metre, and two kinds of reduction. Their rules come in two kinds: well-formedness rules say which structures are possible at all; preference rules say which are likely. Preference rules can conflict, and the hearing is the best compromise among them, an idea borrowed from the study of vision.

Take grouping. Three of their preference rules: a boundary is preferred after a long note, across a leap, and where the note lengths change. Score every gap between the Tune's notes by those three rules. The five strongest gaps fall exactly on the Tune's five phrase ends, each after a long note. These selected rules match the supplied phrase boundaries of this teaching tune; listener agreement is not measured here.

Listen for the five places where the Tune breathes. Metre gets the same treatment. A metrical grid stacks levels of beats, each twice as slow as the one below, as in Part 11. Preference rules put strong beats where notes begin, where they are long, and where the harmony changes. And the time-span reduction of the next chapter uses grouping and metre together: the head of each span is its most stable note, preferring notes on strong beats.

Lerdahl and Jackendoff did not say how much each rule counts. When rules conflict, the book leaves the decision to the reader's musical judgement. In the 2000s Masatoshi Hamanaka, Keiji Hirata and Satoshi Tojo developed computational subsets and numerical preference weights, and built programs that compute grouping, metre and time-span trees from a score, first with weights tuned by hand, later learned from analyses made by experts. That is the price of computing a theory: every word prefer must become a number, and the numbers are themselves claims that can be tested.

4A time-span reductionFoundations3 min

How does a program decide which note is the head?

Here is the reduction of the opening, written as a program. Cut the Tune into spans of two beats, then four, eight, sixteen and thirty-two. Each span keeps one note, its head, chosen from the heads of its two halves. The choice is a score: two points if the note belongs to the chord sounding there; three for the tonic, two for the fifth, one and a half for the third; half a point for each level of metrical strength. The higher score wins, and a tie goes to the earlier note. It is Lerdahl and Jackendoff's preference rules, simplified to a sum: crude, and explicit, which is the point.

The levels, read as letters. Every two beats: C G A G F E D C, then G F E D twice, then the opening again: the Tune with its repeated notes removed. Every four beats, the strains keep their first and middle notes. Every eight beats, a note a phrase: C C G G C C. Every sixteen, C G C, and at thirty-two, C C. The top of the program's tree is tonic, dominant, tonic: Schenker's bass arpeggiation, found by a sum of preferences. But the program found it in the bass's terms, through the melody's notes; it never found the descending line, because its rules prefer the stable G and C to the passing F, E and D. A different rule set would find a different tree. That is the lesson of every reduction.

Lerdahl and Jackendoff's fourth structure asks a different question. The prolongational reduction is about tension. Not which note is most important, but which event tenses away from which, and which relaxes back into which. A chord that returns unchanged is a strong prolongation; the same root in another position a weak one; a new chord a progression, a move of tension. Lerdahl's later book, Tonal Pitch Space, put numbers on these moves: the tension curves of Part 19 were distances along such a tree. The tree of importance and the tree of tension need not be the same, and the theory keeps them apart.

5Harmony as a grammarFoundations2 min

Can chord progressions be parsed like sentences?

Linguists describe sentences with grammars: a sentence is a noun phrase and a verb phrase, a noun phrase a determiner and a noun, and so on, down to words. In 2011 Martin Rohrmeier wrote harmony the same way. Here is a small teaching grammar inspired by that work. A tonic region can be a dominant region followed by a tonic region: the cadence. A dominant region can be a subdominant region followed by a dominant region: the preparation. Any region can be two regions of the same kind: prolongation. And at the bottom, each region is a chord of its function. Six rules and three lists, and every progression they generate is a tree.

Two parses, the most probable trees under a soft-emission version of these rules. I, IV, V, I: an opening tonic prolonged by a cadence, the cadence a dominant region, prepared by IV, resolving to the final I. I, vi, ii, V, I: the first two chords group together as one tonic region, vi prolonging I, and the rest is the same cadence, prepared by ii. The tree says what a musician means by the function of a chord: not what it is, but what it does, and to which other chord it belongs.

Hear them, each tree's chords lighting as they sound. One feature of these rules matters more than the rest. A dominant region can contain a dominant region. So cadences can nest inside cadences: the dominant of the dominant of the dominant, Part 19's chain of applied dominants, each one preparing the next. A productive self-embedding rule permits recursive derivations; recursion can also involve several mutually dependent symbols. In language, recursion is what lets sentences grow without limit: the cat that the dog that the man owned chased. Whether listeners actually hear nested harmony, or whether it exists only in the analyst's tree, is the question of chapter eleven.

6Parsing and ambiguityFull course3 min

How many ways can a progression be heard?

How does a program find a tree? With an algorithm from the 1960s named after its three inventors, Cocke, Younger and Kasami. Fill a triangle of cells. In the bottom row, each chord, with the regions that could produce it. In each cell above, the regions that could produce that whole stretch of chords, by splitting it somewhere into two stretches already solved below. The top cell covers the whole progression. Keep probabilities instead of yes or no, and the most probable tree can be read back down. The work grows as the cube of the length, fine for a phrase of a dozen chords.

Most progressions have more than one tree. I, vi, ii, V, I has under these rules: vi can belong to the opening tonic or begin a new one; ii can group with V or with what came before. Repeat the cadence IV V I and the count explodes: trees for seven chords, for ten, for thirteen, growing like the Catalan numbers that count the ways to bracket a sum. Ambiguity is the normal state of a grammar, in music as in language, and the model’s probabilities rank its trees; this is not a measured account of listeners’ choices.

The separate strict function-label counter can assign no trees at all. I, IV, I, V, I has under the six rules. The trouble is IV going straight back to I, the plagal move of Part 18: the rules only let a subdominant region lead to a dominant one. Add a rule, a tonic region can be a subdominant region followed by a tonic region, and it parses. That is what it means for a grammar to be a theory: a rejected accepted progression exposes a limitation if the grammar claims to cover that repertoire; a teaching subset need not cover everything. Bach writes IV going to I hundreds of times, so this grammar must grow, and Rohrmeier's full grammar has many more rules than these six.

Hear it. To a listener it is ordinary: the IV leans back to I, and the cadence follows.

7A grammar learned from BachFull course3 min

Does a grammar predict Bach's next chord better than chord pairs?

Can such a grammar be learned from music, and does it describe it better than the chord-pair model of Part 18? Take the major-mode subset of Part 17’s chorales and cut them at their fermatas, retaining phrases of two to fourteen recognized chord labels: phrases to learn from, from chorales with other tunes held out. Each phrase is a sequence of chord names, about long. Start from the six branching rules with soft emissions that allow every vocabulary chord in each region, and learn the probabilities, which rule a region uses and which chord it emits, by the inside-outside algorithm: guess the probabilities, parse every phrase in every possible way, count how often each rule was used, weighted by the probability of its tree, re-estimate, and repeat. Then score every model by the bits it needs per chord on the held-out phrases, counting the end of the phrase as one more symbol.

The scores. Knowing nothing about order costs bits a chord. Chord pairs, Part 18's model, cost ; triples do worse, , since there is too little data to learn them. The six-rule grammar costs : worse than pairs. Give a grammar twelve symbols of its own, every rule allowed, and let it invent its categories: after training it costs , close to pairs but not better. On this split and these settings, these grammar models do not beat the bigram baseline in held-out complete-phrase bits per symbol.

What did the six-rule grammar learn? Look at the chords each region emits after training. The tonic region emits I times in a hundred and vi : as the theory says. The dominant region emits V and V seven, and sometimes IV, which Bach often places just before a cadence. But the subdominant region drifted: training found it more useful as a second kind of tonic, and its most frequent chord is I. Nothing in the algorithm keeps the names honest; it only makes the phrases likely.

What does that mean? The same result is well known in language: simple grammars predict the next word worse than counting pairs and triples of words. A grammar's strength is elsewhere, in dependencies across a distance: a grammar can represent an opening-to-closing tonic dependency when its rules encode one, however long the middle, which a tree states and a simple first-order chain cannot retain arbitrarily distant opening context. Chorale phrases are short, about six chords, which leaves little room for depth to pay off. And prediction and explanation are different tests: a grammar can be the better description of how a progression is organized and still be the worse guesser of what comes next.

8Growing a melodyPractice3 min

Can a grammar run forwards and write music?

A grammar can run forwards as well as backwards. Reduction removes servants; elaboration adds them. Each rule halves a note's time and adds a servant: repeat the note, step to a neighbour, pass to the next note, or arpeggiate the chord. Start from the Tune's skeleton, the reduction of chapter four at a note every four beats. Apply the rules twice, choosing which at random, and a new surface grows. It is Schenker's levels, grown downwards instead of peeled away.

Two melodies over the same chords. One is the Tune; the other was grown by the grammar from the Tune's skeleton. Which one is the grammar's, A or B? You will recognize the Tune, so listen also for what makes the other one sound less like a tune.

A is the grammar's. It obeys the harmony and moves by sensible steps, but it has no explicit rule tying later elaborations to earlier motives, though chance and its fixed durations can produce repeats. The Tune's charm is its repetitions, C C G G A A G, which the rules, choosing independently at every note, never think to make. Part 21's lesson returns: what a listener hears as a tune is largely repetition, and this grammar has no rule for it.

What rule is missing? A rule that says: elaborate this span the way an earlier span was elaborated. Copy. Unrestricted exact copying of an arbitrarily long unknown sequence is beyond a context-free grammar: the choice at one place depends on the choice made at another. But a finite stock of named motives or bounded copies can be encoded context-freely; computational cost depends on the formalism. Music needs it everywhere: motives, sequences, rounds, fugues. Part 20's canons and Part 21's repetitions are not captured by this small independent-elaboration grammar, without proving that every such musical pattern exceeds context-free power.

Here are three whole derivations from the same skeleton, with the rules each one used. Every one is a valid elaboration; none is the Tune. Schenker's levels say what a melody can be grown from; they do not say which of the countless growths a composer chose, or why. That choice, the composer's, is what analysis tries to explain, and what a grammar of this kind leaves out.

Three tunes, all lawful, their memorability has not been tested: the grammar knows what may follow, not what should.

9Other ways to analyseFoundations3 min

Is a tree the only way to understand a piece?

Trees are one tradition. Another starts from Leonard Meyer's book of 1956: musical meaning lies in expectations aroused, delayed and fulfilled. Eugene Narmour turned that into rules in 1990: a small interval implies that the line will continue the same way; a large leap implies a reversal. Part 14 measured this on folk tunes and found it partly true. David Huron's Sweet Anticipation, in 2006, argued that the expectations are learned from the statistics of the music one has heard, Part 18's probabilities. This kind of analysis models the listener moment by moment, rather than the piece as a finished whole.

A third tradition asks what music refers to. In 1980 Leonard Ratner proposed that eighteenth-century composers wrote with topics, stock styles their audiences recognized at once: the march, the hunt with its horn calls, the pastoral with its drones, the singing style, the learned style of counterpoint, and the storm and stress of minor keys and tremolo. A Mozart movement can move through half a dozen of them in a minute, and to analyse it is to follow that conversation of styles, meaning by reference rather than by tree.

A fifth tradition began with David Lewin's book of 1987. Lewin proposed to analyse the moves rather than the objects, asking, in his words, if I am at s and wish to get to t, what characteristic gesture should I perform? Part 19's transformations P, L and R come from this school: chords as points, progressions as paths between them. The result is a network of transformations rather than a tree of prolongations, and it fits music the Ursatz cannot, the chromatic chains of Wagner and Liszt, where no single key holds.

A fourth tradition asks whose structure an analysis describes. The semiotician Jean-Jacques Nattiez separated three levels of a musical work: how it was made, the score as a neutral object, and how it is heard. An analysis should say which of them it is about. Schenker's claims are about hearing, what an ideal listener grasps, made from the score alone. This series measures the score, and then asks experiments what listeners actually hear, which is the only way to settle a claim about hearing.

10A theory and its authorFoundations2 min

Can a theory be separated from the person who made it?

The theory has an author, and the author matters to the argument. Heinrich Schenker was born in 1868 in Galicia, then part of Austria-Hungary, and worked in Vienna. He was Jewish, and a fervent German nationalist. His writings rank peoples as well as pieces, with German musical genius above all, and they contain racist statements, about Black people among others. He died in 1935; his widow, Jeanette, was murdered in the Theresienstadt camp in 1942.

In 2019 the theorist Philip Ewell gave a plenary talk to the Society for Music Theory titled music theory's white racial frame. He argued that the field's canon and methods, with Schenker's at their centre, carry the racial hierarchy of their authors, and that the field had looked away from it. In 2020 the Journal of Schenkerian Studies published a set of responses, some of which were widely condemned as racist themselves. The Society's executive board and many theorists criticized the issue, and the university that publishes the journal reviewed how it had been produced. Ewell's argument appeared as an article in Music Theory Online the same year. The dispute has also involved institutional and legal proceedings; those are historical context rather than a current case-status report.

What is the argument about? One position holds that a method can be judged apart from its author: reduction is a tool, to be used where it helps. Another holds that the method itself encodes a ranking, since it defines good music as music that fits it, and that teaching it as the core of the subject passes the ranking on. What a course like this one can add is to state the theory as explicit rules and test its claims. Some survive: the stepwise descent to the tonic is really there, more often than under this particular shuffle, in these selected major-key tunes. The claim that only some music deserves to be heard this way is not a finding of any analysis. And a theory built on one repertoire should be tested on others, as Act VI of this series will do.

11Is harmony recursive?Research3 min

Do listeners hear nested structure?

Tree depth is one descriptive property; recursive grammars need not produce deeply nested examples. Parse every held-out chorale phrase that the six rules can parse, and measure the depth of its best tree. A pure chain, each chord attached to the next, would be as deep as the phrase is long. A perfectly balanced tree would be only about the logarithm of the length. For the subset whose labels lie in the restricted vocabulary, the soft-emission grammar’s best trees are almost as deep as the phrases are long: chains of preparation and resolution, each chord leaning on the next, a tree that branches only one way. On phrases this short, a nested grammar and a chain of pairs describe nearly the same thing, and the data cannot tell them apart, let alone show what a listener hears.

What would nesting sound like? First, one dominant inside another: I, the dominant of the dominant, the dominant, I. Then four deep: E seven, A seven, D seven, G, and home to C, each chord the dominant of the next, the chain of applied dominants from Part 19.

Every chord is heard as wanting the next. But a listener could hear that without any tree: each chord pulls toward the one after it, a chain of pairs, and the chain arrives home. Whether the opening C is still held in mind when the last C arrives is exactly what the tree claims, and what only an experiment can show.

The question matters beyond music. In 2002 Marc Hauser, Noam Chomsky and Tecumseh Fitch proposed that recursion might be the one thing special to human language. If music has it too, the two may share machinery. In 2013 Stefan Koelsch and colleagues, Rohrmeier among them, rewrote Bach chorales so that the key a phrase opened in was not the key it closed in, with a passage in another key embedded between: a dependency across a distance, like the subject and verb of a long sentence. The study reported an electrophysiological response to the manipulation, consistent with sensitivity to a nonlocal dependency; it does not establish identical language processing or recursion by itself. Yet, as Part 21 found, over several minutes listeners hardly notice a piece ending in the wrong key. Together these task-specific results motivate further tests across timescales, rather than a fixed limit on musical nesting: harmony may be recursive in the short range, and something else holds long pieces together.

12Frontier: grammars from dataResearch2 min

Can a program discover music's grammar?

The frontier is to let the data write the grammar. Start with symbols that mean nothing and every rule allowed, and let training give them meaning. In chapter seven, a grammar with four invented symbols reached bits a chord, and one with twelve reached . And what the symbols learn need not be the theory's categories: even the six-rule grammar drifted in training, its symbol for the subdominant region ending up emitting the tonic chord more often than any other. The difficulty is the training itself: it gets stuck, and different starting points find different grammars. Neural sequence models provide another approach; no matched neural benchmark is computed here. This leaves the old question open in a new form: is the grammar in the music, or only in our description of it?

The richest ground for grammars of harmony has turned out to be jazz. Jazz standards are built from long chains of two-five progressions, dominants of dominants of dominants, patterns a recursive grammar can represent, though a dominant chain alone does not prove hierarchical listening. In 2018 Daniel Harasim and colleagues in Rohrmeier's group built a grammar-based parser for jazz chord sequences, and in 2020 Rohrmeier set out the syntax of jazz harmony. The field is building annotated trees for standards, a treebank like those linguists build for sentences. Part 39 will take one of those trees apart.

And the open questions. Which reductions do listeners actually make, and can they be measured, for instance by asking which of two skeletons a passage sounds like, as chapter one did? Does any grammar beat chord pairs on long pieces, where depth has room to pay? And this part's research problem: design an experiment that measures a listener's reduction directly.

Variation 22, recap and problemsAll tracks3 min

Every part ends by doing something to the Tune with what it has built. This part built reductions and grammars. So the Tune is reduced to its skeleton, a note every four beats over its harmony, and then regrown by the elaboration grammar along a different derivation: the same skeleton, the same chords, a different surface.

Row twenty-two of the ledger. seconds. The measurement: skeleton notes grown into , and on of strong beats a note of the chord. The grammar keeps the harmony most of the time; it does not explicitly preserve the Tune’s motivic repetitions.

What did we find? Reduction rests on a few ways one note serves another. Schenker's descent to the tonic is really there at the ends of tunes, more often than this shuffle baseline. A handful of explicit preference rules recover the Tune's phrases and its tonic, dominant, tonic. Harmony can be written as a recursive grammar, whose possible tree counts can grow rapidly, depending on its rules. Trained on Bach, such a grammar describes but does not out-predict chord pairs. And the theory's author, and whether nesting is heard at all, remain open arguments.

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 the Renaissance, whose counterpoint predates the tonal tree. In the classical style, where topics and schemata meet. In twelve-tone music, written against everything the Ursatz stands for. In jazz, where the trees are deepest. In expectation and emotion, the listener's side. And in machines that compose.

And in practice. Performers who know which notes are structural shape a phrase around them. Improvisers elaborate a skeleton, the changes underneath. Arrangers keep the skeleton and change the surface. And analysts can say which level they describe, and test it.

The books and papers this part follows. The full list, with notes, is in the README.

Where it goes next. Chant and the first polyphony in Part 23; Schenkerian readings of the classical sonata in Part 26; jazz harmony and its grammars in Parts 38 and 39; expectation and emotion in Part 46; structure analysis by machine in Part 62; machines that compose in Part 65.

Key results

The part's results in one place, for revision.

The Urlinie in the folk tunes\(\displaystyle 22 \text{ of } 51 \text{ major }\allowbreak \text{tunes }\allowbreak \text{end } \hat 3 \hat 2 \hat 1 \text{ or } \hat 5 \ldots \hat 1; \ \text{shuffled } 3.4\)
Grouping rules on the Tune\(\displaystyle \text{five }\allowbreak \text{strongest }\allowbreak \text{boundaries} = \text{five }\allowbreak \text{phrase }\allowbreak \text{ends}\)
Trees for I (IV V I)^m\(\displaystyle C_{2m}: \ 2, 14, 132, 1430\)
Bits per chord, held-out chorale phrases\(\displaystyle \text{unigram } 3.93, \ \text{bigram } 3.33, \ \text{six-rule }\allowbreak \text{grammar } 3.90, \ \text{12 }\allowbreak \text{latent }\allowbreak \text{symbols } 3.46\)
Coverage\(\displaystyle \text{the }\allowbreak \text{six }\allowbreak \text{rules }\allowbreak \text{parse }\allowbreak \text{about } 21\% \text{ of }\allowbreak \text{held-out }\allowbreak \text{phrases}\)

Try it

Lab 22 · Analysis, computed

Reduce a melody to its skeleton level by level, parse chord progressions with a six-rule grammar of harmony and count their trees, train the grammar on Bach's chorales and compare it with chord n-grams on held-out phrases, grow new melodies from a skeleton, and choose skeletons by ear.

Figure produced by Lab 22: Analysis, computed
Produced by the lab below, seed 0, in 6.5 s.
python -m videos.music.labs 22 needs numpy, scipy, matplotlib · download lab22.py · source on GitHub
Ode to Joy: a note every 2 beats                                          E G G E C E E D E G G E C E C C
Ode to Joy: a note every 4 beats                                          E G C E E G C C
Ode to Joy: a note every 8 beats                                          G C G C
trees for I vi IV ii V I under the six rules                              10
... with the plagal rule TR -> SR TR                                      16
trees for I (IV V I) repeated 1, 2, 3 times / Catalan numbers C2, C4, C6  [2, 14, 132] / [2, 14, 132]
bits per chord on 231 held-out phrases: no context                        3.93
bits per chord on 231 held-out phrases: chord pairs                       3.33
bits per chord on 231 held-out phrases: the six-rule grammar              3.93
held-out phrases the hand-set six rules parse                             49 of 231
melody 1 grown from the skeleton C G E C                                  C C G G G E D D C C B A  (rules: keep 3, neighbour 3, passing 1, repeat 4)
melody 2 grown from the skeleton C G E C                                  C D B B G F G E E D D C B C D  (rules: arpeggio 2, keep 1, neighbour 3, passing 2, repeat 4)
melody 3 grown from the skeleton C G E C                                  C C B G F F E F C C D C  (rules: arpeggio 2, keep 3, neighbour 3, passing 1, repeat 2)
ear problem, the fitting skeleton for each passage (listen first)         Jasmine Flower (Mo Li Hua): A;  Three Blind Mice: B;  Sur le pont d'Avignon: B;  Row, Row, Row Your Boat: A;  Deck the Halls: B;  Simple Gifts: A;  Ode to Joy: A;  The Itsy Bitsy Spider: A

A reduction keeps the stable notes on strong beats; a six-rule grammar of tonic, dominant and subdominant regions gives Catalan numbers of trees for repeated cadences and none at all to a plagal return; trained on Bach it explains phrases but predicts them no better than chord pairs; and melodies it grows obey the harmony but never repeat a motive.
The code (167 lines; it asserts its own result)
"""Lab 22: analysis computed: a melody reduced level by level, chord progressions parsed by a six-rule grammar (and
their trees counted), the grammar trained on Bach's chorales and scored against chord n-grams, melodies grown from a
skeleton, and skeletons chosen by ear."""

from collections import Counter

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 grammar as G
from explainer.music.monochord import melody as M
from explainer.music.monochord.partkit import organ_tone

TITLE = "Analysis, computed"
GOAL = ("Reduce a melody to its skeleton level by level, parse chord progressions with a six-rule grammar of harmony and "
        "count their trees, train the grammar on Bach's chorales and compare it with chord n-grams on held-out phrases, "
        "grow new melodies from a skeleton, and choose skeletons by ear.")
TASKS = [
    "Choose a TUNE from Part 14's corpus. Read its reduction at a note every two, four and eight beats. Does it end on a stepwise descent to the tonic?",
    "Write a PROGRESSION of your own in Roman numerals (I, ii, IV, V, vi, V7). How many trees does the grammar give it? Does it parse at all? Add the plagal rule TR -> SR TR and try again.",
    "Change SEED and grow three melodies from the Tune's skeleton. Which rules did each use, and why does none of them sound like the Tune?",
]
TUNE = "Ode to Joy"
PROGRESSION = "I vi IV ii V I"
SEED = 3
SR = 48_000
HARMONY = ["C", "C", "F", "G", "F", "C", "G", "C"]
PCS = {"C": (0, 4, 7), "F": (5, 9, 0), "G": (7, 11, 2)}


def chord_at(t):
    return set(PCS[HARMONY[min(int(t // 2), len(HARMONY) - 1)]])


def notes_of(tune, base=72):
    out, a = [], 0.0
    for p, d in zip(tune.pitches, tune.beats):
        out.append((base + p, a, float(d)))
        a += d
    return out


def render(notes, beat=0.32):
    T = max(a + d for _, a, d in notes)
    y = np.zeros(int((T * beat + 0.6) * SR))
    for p, a, d in notes:
        tone = organ_tone(CH.hz(p), d * beat, partials=5, rolloff=0.7, decay=1.0)
        i = int(a * beat * SR)
        y[i:i + len(tone)] += tone[: len(y) - i] * 0.3
    return Clip(y, SR).fade(0.01, 0.2).at_level(-20.0)


def chorale_phrases(book):
    out = []
    for c in book:
        if c.mode != "major":
            continue
        cur, prev = [], None
        for x in F.beat_labels(c):
            s = x["label"][:2] if x["label"] else None
            if s is not None:
                r = F.roman((s[0], s[1], 0), "major")
                if r != prev:
                    cur.append(r)
                    prev = r
            if x["fermata"] and cur:
                out.append(cur)
                cur, prev = [], None
        if cur:
            out.append(cur)
    return out


def names(level):
    letters = {0: "C", 2: "D", 4: "E", 5: "F", 7: "G", 9: "A", 11: "B"}
    return " ".join(letters.get(p % 12, "?") for p, _, _ in level)


def run(seed=0):
    rng = np.random.default_rng(seed)
    lab = labs.Lab()

    # 1. a tune, reduced (no harmony given: the most stable note on the strongest beat wins)
    t = [x for x in M.corpus() if x.name == TUNE][0]
    lv = G.reduce_levels(notes_of(t), None, span=1.0)
    for k in (1, 2, 3):
        lab.row(f"{TUNE}: a note every {2 ** k} beats", names(lv[k]))
    assert all(len(lv[k + 1]) <= len(lv[k]) for k in range(len(lv) - 1))

    # 2. parsing: trees for your progression, and the Catalan numbers
    hand = G.PCFG(["I", "vi", "iii", "IV", "ii", "V", "V7", "vii°"], prior=50.0)
    seq = PROGRESSION.split()
    n_trees = hand.count_parses(seq) if all(x in hand.index for x in seq) else 0
    lab.row(f"trees for {PROGRESSION} under the six rules", str(n_trees))
    plagal = G.PCFG(["I", "vi", "iii", "IV", "ii", "V", "V7", "vii°"], rules=G.RULES + [("TR", "SR", "TR")], prior=50.0)
    lab.row(f"... with the plagal rule TR -> SR TR", str(plagal.count_parses(seq) if all(x in plagal.index for x in seq) else 0))
    counts = [hand.count_parses(["I"] + ["IV", "V", "I"] * m) for m in (1, 2, 3)]
    catalan = [2, 14, 132]
    lab.row("trees for I (IV V I) repeated 1, 2, 3 times / Catalan numbers C2, C4, C6", f"{counts} / {catalan}")
    assert counts == catalan

    # 3. the grammar trained on Bach, against chord n-grams, on held-out phrases
    train, test = BC.split(BC.load(), offset=2)
    P, Q = chorale_phrases(train), chorale_phrases(test)
    cnt = Counter(x for p in P for x in p)
    vocab = [v for v, c in cnt.most_common() if c >= 5]
    fix = lambda S: [[x if x in vocab else "?" for x in p] for p in S if 2 <= len(p) <= 14]  # noqa: E731
    P2, Q2 = fix(P), fix(Q)
    vocab = vocab + ["?"]
    g = G.PCFG(vocab, seed=0)
    g.train(P2, iters=15)
    bits = {"no context": G.ngram_bits(P2, Q2, vocab, 1), "chord pairs": G.ngram_bits(P2, Q2, vocab, 2),
            "the six-rule grammar": G.pcfg_bits(g, Q2)}
    for k, v in bits.items():
        lab.row(f"bits per chord on {len(Q2)} held-out phrases: {k}", f"{v:.2f}")
    assert bits["chord pairs"] < bits["no context"]
    short = [p for p in Q if 2 <= len(p) <= 14]
    parsed = sum(1 for p in short if all(x in hand.index for x in p) and hand.viterbi(p) is not None)
    lab.row("held-out phrases the hand-set six rules parse", f"{parsed} of {len(short)}")

    # 4. melodies grown from the Tune's skeleton
    tune = notes_of(M.corpus([M.THE_TUNE])[0])
    first = [n for n in tune if n[1] < 16]
    skel = G.reduce_levels(first, chord_at, span=1.0)[2]
    r = np.random.default_rng(SEED)
    grown = []
    for k in range(3):
        surf, used = G.elaborate(skel, chord_at, r, depth=2, min_dur=1.0)
        grown.append(surf)
        lab.row(f"melody {k + 1} grown from the skeleton {names(skel)}", f"{names(surf)}  (rules: {', '.join(f'{a} {b}' for a, b in sorted(Counter(used).items()))})")

    # 5. Problem 3, for the ear: eight passages, each followed by two skeletons, one right, one wrong
    clips, answers = [], []
    pool = [x for x in M.corpus() if x.mode == "major"]
    for k in rng.permutation(len(pool))[:8]:
        nts = [n for n in notes_of(pool[k], base=72 - 12 * (max(pool[k].pitches) > 14)) if n[1] < 16]
        right = G.reduce_levels(nts, None, span=1.0)[2]
        wrong = [(G.scale_step(p, 1) if j in (1, 2) else p, a, d) for j, (p, a, d) in enumerate(right)]
        pair = [right, wrong] if rng.random() < 0.5 else [wrong, right]
        clips += [render(nts), render(pair[0]), render(pair[1])]
        answers.append(f"{pool[k].name}: {'A' if pair[0] is right else 'B'}")
    lab.audio = concat(clips, gap=0.9)
    lab.row("ear problem, the fitting skeleton for each passage (listen first)", ";  ".join(answers))

    fig, (a, b) = labs.figure(2)
    for k, row in enumerate(lv[:4]):
        for p, on, d in row:
            a.plot([on, on + d], [p - 14 * k] * 2, color=[labs.GOLD, "#7aa6d6", "#d66", "#9c6"][k], lw=4, solid_capstyle="butt")
    a.set_title(f"{TUNE}: the surface and its reductions (each level shifted down)")
    a.set_xlabel("beat")
    a.set_yticks([])
    ks = list(bits)
    b.bar(range(len(ks)), [bits[k] for k in ks], color=labs.GOLD)
    b.set_xticks(range(len(ks)))
    b.set_xticklabels(ks, fontsize=8)
    b.set_ylabel("bits per chord (lower predicts better)")
    b.set_title("Held-out chorale phrases")
    lab.fig = fig
    lab.note = ("A reduction keeps the stable notes on strong beats; a six-rule grammar of tonic, dominant and "
                "subdominant regions gives Catalan numbers of trees for repeated cadences and none at all to a plagal "
                "return; trained on Bach it explains phrases but predicts them no better than chord pairs; and melodies "
                "it grows obey the harmony but never repeat a motive.")
    return lab

Now change it

  1. Choose a TUNE from Part 14's corpus. Read its reduction at a note every two, four and eight beats. Does it end on a stepwise descent to the tonic?
  2. Write a PROGRESSION of your own in Roman numerals (I, ii, IV, V, vi, V7). How many trees does the grammar give it? Does it parse at all? Add the plagal rule TR -> SR TR and try again.
  3. Change SEED and grow three melodies from the Tune's skeleton. Which rules did each use, and why does none of them sound like the Tune?

Problems, with solutions

Try each problem before opening its solution.

  1. Compute. Reduce Ode to Joy's first eight bars (Part 14's version) to a note every four beats, by hand, using this part's score.

    Solution

    Without harmony (the score's chord term left out), each four-beat span keeps its most stable note on the strongest beat: E G | C E | E G | C C (the program in grammar.reduce_levels gives the same). The first half ends on E, the third, open; the second closes on C. With the chords put back (I, then V under the D's), the spans that hold D over V keep D instead, and the end of the second half shows the 3–2–1 descent: E D C.

  2. Prove. Prove that the number of binary trees over n leaves is the Catalan number C_{n−1}, and say why the parse counts of chapter 6 are Catalan numbers.

    Solution

    Let T(n) count binary trees with n leaves; the root splits the leaves into k and n − k, so T(n) = Σ_{k=1}^{n−1} T(k) T(n − k), T(1) = 1, the Catalan recurrence with T(n) = C_{n−1}. In chapter 6 every IV V pair must form a dominant region (SR DR → DR), so I (IV V) I (IV V) I … has 2m + 1 units, and the rules TR → DR TR, TR → TR TR, TR → TR DR let them be bracketed in every binary way: C_{2m} trees, which are 2, 14, 132, 1,430 for m = 1 … 4.

  3. Ear. The lab plays eight short passages and two skeletons for each. Choose the skeleton that fits.

    Solution

    The lab prints the answers. The fitting skeleton's notes belong to the chords under them on strong beats; the wrong one moves a note to a neighbour that clashes.

  4. Build. Add the rule TR → SR TR to the grammar, retrain it, and report its bits per chord and coverage.

    Where to look. Append ("TR", "SR", "TR") to grammar.RULES, train PCFG on the same phrases, and score with pcfg_bits and coverage. The plagal rule lets I IV I parse and should improve the share of phrases the strict grammar parses; whether it lowers the bits per chord depends on how often Bach's IV returns straight to I.

  5. ★ A listener's reduction. Design an experiment that measures a listener's reduction of a melody directly.

    Where the frontier is. Chapter 1's question is one design: present a passage and two skeletons and ask which fits, varying which notes the skeletons keep; another asks listeners to tap the 'important' notes, or to judge similarity between passages that share skeletons but not surfaces. A good design separates memory for the surface from recognition of the structure, as Dowling's experiments with contour did.

Notes and sources

Sources

  • H. Schenker, Der freie Satz (1935); A. Cadwallader and D. Gagné, Analysis of Tonal Music: A Schenkerian Approach (3rd ed., 2011).
  • F. Lerdahl and R. Jackendoff, A Generative Theory of Tonal Music (1983); F. Lerdahl, Tonal Pitch Space (2001); M. Hamanaka, K. Hirata and S. Tojo, "Implementing 'A Generative Theory of Tonal Music'", Journal of New Music Research 35 (2006).
  • M. Rohrmeier, "Towards a generative syntax of tonal harmony", Journal of Mathematics and Music 5 (2011); "The syntax of jazz harmony", Music Theory and Analysis 7 (2020).
  • S. Koelsch, M. Rohrmeier, R. Torrecuso and S. Jentschke, "Processing of hierarchical syntactic structure in music", PNAS 110 (2013); M. D. Hauser, N. Chomsky and W. T. Fitch, "The faculty of language", Science 298 (2002).
  • L. B. Meyer, Emotion and Meaning in Music (1956); E. Narmour, The Analysis and Cognition of Basic Melodic Structures (1990); D. Huron, Sweet Anticipation (2006); L. G. Ratner, Classic Music (1980); D. Lewin, Generalized Musical Intervals and Transformations (1987); J.-J. Nattiez, Music and Discourse (1990).
  • P. Ewell, "Music theory and the white racial frame", Music Theory Online 26 (2020); the Journal of Schenkerian Studies 12 (2020) and the statements of the Society for Music Theory's executive board.
  • Part 14 for the tunes; Part 17 for the chorales; Part 18 for the n-gram models; Part 19 for Lerdahl's tension; Part 21 for Cook's experiment.
About this partfrom its README

Part 22 of a sixty-eight-part course in music (see the series plan and the syllabus), the last part of Act III. Parts 16 to 21 built tonal music's grammar from the bottom; this part asks what an analysis of it is. It takes Schenker's claim, that every tonal masterpiece elaborates one stepwise descent to the tonic, seriously as a theory: states reduction as rules (Lerdahl and Jackendoff's grouping, metre and time-span reduction), writes harmony as a probabilistic context-free grammar (after Rohrmeier), parses with it, trains it on Bach's chorales and scores it against chord n-grams on held-out chorales, runs a grammar of melodic elaboration forwards to regrow the Tune, surveys other approaches, sets out the argument over the theory and its author, and asks whether harmony is recursive. The reductions and grammars are Monochord's (explainer/music/monochord/grammar.py); the chord sequences are Part 17's chorales cut at their fermatas; everything heard is played on Part 7's piano. Published findings are the ones listed under Sources.

  • One line, walking down. The Tune and its time-span reduction at spans of 2, 4, 8 and 16 beats, heard (C G A G F E D C …; C C G G C C; C G C); Schenker's Der freie Satz (1935); the plan.
  • 1. Reduction and prolongation. Passing, neighbour, arpeggiation, repetition, each heard; an ear question (the first strain and two skeletons, C G E C against C A F C: which fits?); prolongation at every scale.
  • 2. The Ursatz. The fundamental line and the bass arpeggiation; an ear question (F F E E D D C over a tonic pedal and over IV I V I: which closes?); 22 of Part 14's 51 major tunes end on a stepwise descent to the tonic (6 from the fifth, 16 from the third), against about 3.4 when their notes are shuffled; what the claim explains and costs.
  • 3. Grouping and metre. A Generative Theory of Tonal Music (1983): well-formedness and preference rules; three grouping rules put the five strongest boundaries of the Tune exactly on its five phrase ends (heard); the metrical grid; computational GTTM (Hamanaka, Hirata and Tojo).
  • 4. A time-span reduction. The head of each span by a sum of preferences (chord tone, stable degree, metrical strength); the Tune's levels read as letters; I–V–I at the top; prolongational reduction and Part 19's tension.
  • 5. Harmony as a grammar. Rohrmeier (2011): six rules over tonic, dominant and subdominant regions; trees for I IV V I and I vi ii V I, heard; recursion.
  • 6. Parsing and ambiguity. The CYK algorithm; 5 trees for I vi ii V I; for I followed by repeated IV V I, 2, 14, 132 and 1,430 trees at 4, 7, 10 and 13 chords (Catalan numbers); I IV I V I, heard, has no tree without a plagal rule.
  • 7. A grammar learned from Bach. 934 training phrases and 231 held out, 42 chord symbols, inside-outside training; bits per chord on held-out phrases: no context 3.93, chord pairs 3.33, triples 3.57, the six-rule grammar 3.90, a grammar with 12 invented symbols 3.46; what the six-rule grammar learned (its subdominant symbol drifted to emitting I); prediction against explanation.
  • 8. Growing a melody. The elaboration grammar from the Tune's skeleton; an ear question (which melody is the grammar's?); the missing copy rule and Chomsky's hierarchy; three derivations, heard.
  • 9. Other ways to analyse. Meyer, Narmour and Huron (expectation); Ratner's topics; Lewin's transformations; Nattiez's three levels.
  • 10. A theory and its author. Schenker's life and views; Ewell's 2019 plenary talk and 2020 article; the Journal of Schenkerian Studies volume of 2020 and its aftermath; the positions, and what testing can add.
  • 11. Is harmony recursive? Depth of the best trees of held-out phrases (about as deep as they are long, where the six rules parse them: about a fifth); nested dominants heard (one level, then E7 A7 D7 G C); Hauser, Chomsky and Fitch (2002); Koelsch and colleagues' nested chorales (2013); Part 21's limits.
  • 12. Frontier: grammars from data. Induced grammars and their drifting categories; jazz parsing and Rohrmeier's syntax of jazz harmony (2020). ★ research problem: measuring a listener's reduction directly.
  • Variation 22, recap and problems. The Tune's skeleton, a note every four beats, regrown along a different derivation (12 notes grown into 37; on 15 of 24 strong beats a chord tone); the ledger; what we found; five problems; where it comes back; in practice; references; Part 23.
What is computed and built

python -m videos.music.music22.compute (about ten minutes: the grammars train) fills .cache/music22/.

Item What it computes Checked against
hook the Tune's time-span reduction, every level, and four of them heard —
kinds passing, neighbour, arpeggiation and repetition, heard —
progressions the chord progressions of chapters 5, 6 and 11, voiced the shortest way and heard —
skeleton the first strain and two candidate skeletons —
cadence the second phrase over a tonic pedal and over IV I V I —
urlinie stepwise descents to the tonic at the ends of the major tunes shuffled tunes
grouping grouping preference strengths on the Tune; its melody heard its phrase ends
parses Viterbi trees and parse counts under the six-rule grammar Catalan numbers
learned grammars trained by inside-outside; n-grams; bits per chord on held-out phrases; tree depths brute-force parse counts (tests)
growth three derivations from the skeleton, heard; a quiz —
tune Variation 22 —

Monochord's grammars are held in tests/music/test_grammar.py; this part's claims and clips in tests/music/test_music22.py.

Sounds. Part 7's piano (physical model) in twelve-tone equal temperament. There are no recordings.

What the models are, and are not. The time-span reduction chooses heads by a fixed sum of three preferences, not Lerdahl and Jackendoff's full rule set, and the Tune's harmony is the one of Part 21. The six-rule grammar is the core of Rohrmeier's (2011), without his rules for applied dominants, modulation or plagal motion; chord symbols are Part 17's beat labels as Roman numerals with repeated chords merged and rare symbols (fewer than five uses) pooled. Bits per chord count the end of each phrase as a symbol for every model, so a grammar (which assigns probability to whole phrases) and an n-gram are compared on the same footing. The latent grammar is trained from one random start; others find different grammars. The elaboration grammar chooses rules independently at each note and has no rule for motivic repetition, which is the point of chapter 8. The account of the 2019–2020 controversy is a summary of public events and published positions; readers should consult the sources.

Notes

The reduction is a weighted teaching heuristic, not the full GTTM or a unique Schenkerian analysis. Its selected surface descents and shuffle comparison neither prove an Ursatz for every piece nor establish what listeners hear.

The strict parse counter assigns each chord to its named function. The probabilistic parser and learned grammar instead use nonzero emissions of every vocabulary chord in every region. Thus zero strict parses does not imply zero probabilistic parses. The depth plot’s retained share is limited by its restricted vocabulary and phrase-length filter; it is not coverage of the strict six-rule grammar.

Learning uses major-mode phrases of 2–14 labels, a tune-grouped train/test split, a training-derived vocabulary and a rare-label bucket. The reported complete-phrase bits use the stated normalization; they are not a universal comparison of hierarchy with sequential models. No matched neural benchmark is computed.

Unrestricted exact copying of arbitrary unknown strings exceeds context-free power, but finite named motives, bounded repetitions and many musical canons can be represented without that general operation. This small independent-elaboration grammar lacks planned recurrence; that is a model limitation rather than a theorem about all musical repetition. Neural responses to nonlocal changes do not by themselves prove recursion or identical computations in music and language.

Companion material in this repository

The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
  1. Hook: the Tune and its time-span reduction, level by level, heard; Schenker; the plan.
  2. Reduction and prolongation: passing, neighbour, arpeggiation; an ear question (which skeleton fits?).
  3. The Ursatz: line and bass; an ear question (which bass makes the descent close?); descents at the ends of tunes.
  4. Grouping and metre: GTTM's preference rules on the Tune; the metrical grid; computational GTTM.
  5. A time-span reduction: heads by a sum of preferences; the Tune's levels; prolongational reduction.
  6. Harmony as a grammar: Rohrmeier's core rules; trees; recursion.
  7. Parsing and ambiguity: CYK; Catalan growth of parses; what the grammar cannot parse.
  8. A grammar learned from Bach: inside-outside on the chorales; bits per chord against n-grams; what it learned.
  9. Growing a melody: the elaboration grammar; an ear question (which melody is the grammar's?); the copy rule.
  10. Other ways to analyse: expectation, topics, transformations, semiotics.
  11. A theory and its author: Schenker; the 2019–2020 argument; the positions.
  12. Is harmony recursive: tree depths of Bach's phrases; Koelsch's nested chorales; Part 21's limits.
  13. Frontier: grammars induced from data; jazz parsing.
  14. Variation 22: the Tune reduced and regrown. Outro: problems, payoffs.

Covers: reduction and prolongation; the Ursatz; Lerdahl and Jackendoff's grouping, meter and reductions as preference rules; harmony as a context-free grammar; parsing and ambiguity; other approaches (implication, semiotics, topics, transformations); the 2020 controversy. Built and computed: monochord/grammar.py: a time-span reducer, grouping preference strengths, a melodic elaboration grammar, a functional PCFG with inside-outside training, Viterbi parsing and parse counting, a latent PCFG induced from data, n-gram baselines; trained and scored on Part 17's chorales cut at their fermatas (the "Library" of the plan is, for now, the chorales and Part 14's tunes); the Tune's reduction played level by level. Variation 22: the Tune reduced to its skeleton and regrown along a different derivation. Frontier: grammars induced from data; whether harmony is recursive: the evidence. Reading: Cadwallader & Gagné; Lerdahl & Jackendoff (1983); Rohrmeier (2011).

Build the film

python -m videos.music.music22.compute        # the part's numbers, into .cache/music22
python tools/build.py music22                  # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py music22 Hook   # one chapter, silent, with a contact sheet

Scenes: videos/music/music22. Setup: see the course page. Source of these notes: the README and the scenes' narration.

Build it
python -m videos.music.music22.compute                          # numbers and sounds (about ten minutes)
EXPLAINER_TTS=silent python tools/build.py music22 -q l --fps 15   # a silent-narration preview, with the sounds
python tools/qa_sound.py music22 --sync                         # the sound gates
python tools/dead_air.py renders/music22_480p.mp4 --sound music22  # no empty screen; no sound over a still one
python tools/lecture_length.py music22                          # 30 to 60 minutes, listening included
python tools/build.py music22                                   # 1080p30, narrated
python -m pytest -q tests/music                                 # Monochord against its references; this part's claims and clips
python -m videos.music.labs 22                                  # the lab (writes a figure and a short WAV)