♪Music, Built

Act III · Voices

Part 16 of 68

Two Voices

Foundationsstarts at this level34 min of film14 chaptersprerequisites: Part 4, Part 7, Part 14, Part 15

What makes two voices sound like two, and how do the rules of counterpoint keep them apart?

Around 900 the Musica enchiriadis taught singers to double a chant a fifth below; eight centuries later Fux forbade exactly that, parallel fifths. The two rules are not opposed: organum wanted one voice made thicker, counterpoint wants two voices heard as two. Part 4's harmonics explain why fifths and octaves fuse (most shared partials: strength 1/2 and 1 against 1/4 for a major third); moving together binds two notes into one stream, and starting together does too, so a 35 ms head start pulls a voice out of a chord. Fux's Gradus ad Parnassum (1725) sets a cantus firmus and twelve rules for a line above it. Monochord counts the lines exactly by dynamic programming: of 4,628,074,479,616 sequences of keys, 152 obey every rule, one in thirty billion; over the Tune, about 24 billion. Removing one rule at a time shows what each does: without consonance 184 times as many lines, a third of their verticals dissonant; without the direct-motion rule fused moments appear (9 in a hundred); the parallel-fifths rule removes nothing the direct-motion rule has not already removed. Almost every rule follows from Huron's six perceptual principles: toneness, minimum masking, tonal fusion, pitch proximity, pitch co-modulation, onset synchrony. The species add ways to move apart in time: passing and neighbouring dissonances on weak beats, then suspensions, dissonance as delay; notes beginning together fall from 100% in first species to 52, 27 and 5% in the second, third and fourth. Counterpoint by machine began with Schottstaedt's species program (1984) and Ebcioglu's chorale rules (1988); a line the rules allow is not yet a good line. The Tune becomes a cantus firmus: in organum, then under each species in turn.

What you need. Part 4 for harmonics and fusion; Part 7 for the piano; Part 14 for pitch proximity and the leap rule; Part 15 for the leading note and cadences. Counting by dynamic programming; a little probability.

Ideas, mathematics and history
organum, Fux's species, why parallel fifths are forbidden (Huron's derivation from auditory streaming), dissonance treatment
What we build, compute and hear
a species checker and generator; every first-species answer to the Tune, counted

What you will be able to do

Foundations

  • Name the four kinds of motion between two voices, by eye and by ear.
  • Write a first-species line above a cantus firmus, and check it against Fux's twelve rules.
  • Place passing, neighbouring and suspended dissonances where the species allow them.

Full course

  • Count the lines that obey a set of rules by dynamic programming, and sample one uniformly.
  • Measure what a rule does by removing it, and find a rule that is redundant given the others.
  • Measure two voices' independence: motion, fused moments, and onsets in common.

Research

  • Derive the rules of voice leading from Huron's perceptual principles, and say which rules they do not explain.
  • Say what a constraint solver for counterpoint leaves out, and how one could test whether composers obey the principles more than chance.

Practice

  • Keep two parts apart in an arrangement: by motion, by register, and by timing.
  • Hear when two instruments fuse in a mix, and separate them by moving one, or by a small offset in time.

Contents

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

  1. 0A forbidden rule that was once the ruleFoundations2 min
  2. 1One voice, made thickerFoundations4 min
  3. 2When two notes become oneFull course2 min
  4. 3Moving togetherFoundations2 min
  5. 4Starting togetherPractice3 min
  6. 5Fux's exerciseFoundations4 min
  7. 6How many good lines?Full course5 min
  8. 7Remove a ruleFull course2 min
  9. 8Two notes against oneFoundations1 min
  10. 9Four notes against oneFoundations1 min
  11. 10Held overFoundations2 min
  12. 11Florid, and independentFull course1 min
  13. 12Frontier: counterpoint by machineResearch2 min
  14. Variation 16, 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.

A forbidden rule that was once the ruleFoundations2 min

If you have ever studied harmony, you have been told this. Never write parallel fifths. Two voices a fifth apart, moving in the same direction to another fifth: forbidden. Students lose marks for it in examinations to this day, and most of them are never told why. Here is a stranger fact. A thousand years ago, this was not a mistake. It was the method.

Listen to two ways of adding a second voice to the Tune, the melody this series keeps returning to. In the first, the new voice sings the Tune again, a fifth lower, all the way through, as singers did in the ninth century. In the second, the new voice is a melody of its own, written by the rules that later forbade the first.

The first does not sound like two melodies. It sounds like one melody, made thicker and richer, like a choir in a large church. The second sounds like two people, each going somewhere. That difference is the whole subject of this part. Counterpoint rules reflect stylistic goals as well as perceptual tendencies. In 2001 the music psychologist David Huron proposed perceptual principles that explain many traditional voice-leading practices when independence is the goal; this is not a unique derivation of every rule. They are instructions for keeping two voices audible as two.

This part opens Act Three, where music has more than one voice at a time. We begin with early notated organum, one documented approach to polyphony whose textures often encourage blending. We find out why some intervals fuse, and why voices that move together become one. Then we take the most famous exercise in music education, Fux's, from 1725. We count every line that obeys its rules, remove the rules one at a time, and measure what breaks. We work through the five species. And we measure how independent two voices are, from organum to the florid counterpoint that prepared Bach.

1One voice, made thickerFoundations4 min

What did the first written polyphony want?

Among the earliest surviving systematic instructions for notated Western polyphony come from a handbook written in northern France around the year 900, the Musica enchiriadis. It describes a practice called organum. One singer has the chant, the principal voice. A second sings the same chant, a fourth or a fifth lower, the organal voice, moving exactly with it. Then either voice may be doubled at the octave, for more singers.

Here is the Tune's first phrase treated that way, on sustained organ tones. First the simple form, the Tune and a fifth below it. Then the composite form, with both voices doubled at the octave: four parts.

The doubling in this example encourages a blended melodic line. Historical organum varied, and its creators’ aims cannot be reduced to one perceptual measure. It wanted a single line, made splendid: one voice for the whole church, as wide as the building. Parallel fifths and octaves were not a fault in it. They were the means, precisely because they fuse.

Hear how the second voice won its freedom, on the whole Tune. First, parallel organum at the fifth, as in the handbook. Then the kind the handbook itself prefers for the fourth, and Guido describes: the organal voice may not go below a boundary note, here C, so at the start it waits on C while the chant rises, follows in parallel fourths, and at the end holds C again until the chant comes down to meet it in a unison. Then free organum, as in a treatise of about 1100: here every interval is still an octave, fifth, fourth or unison, in this simplified teaching reconstruction, but the organal voice moves against the chant wherever it can. Monochord chose that voice by dynamic programming, rewarding contrary motion.

Measure each the way this part will measure everything: at each move, are the voices moving together onto a fused interval, and are they moving in opposite directions? Parallel organum: fused at every move, contrary at none. The oblique kind: fused at moves in a hundred, the rest standing still. Free organum: zero by this co-motion measure, which does not mean no perceptual fusion, and contrary times in a hundred, using only the intervals that fuse most. It is the first sign of the rule Fux would write down: the selected first-species rules restrict similar motion into perfect intervals; oblique approaches are also possible.

So over the next five centuries the goal changed. Around 1026 Guido of Arezzo, whom Part 10 met developing staff notation, wanted the voices to come back together at the ends of phrases. By about 1100, in free organum, the voices move against each other. By about 1200, in Paris, a new voice runs freely over the long held notes of a chant: Part 23 tells that story. And by about 1500, composers were avoiding exactly what organum had been built on. The ear had not changed. What the music wanted had: two voices, heard as two.

2When two notes become oneFull course2 min

Why do some intervals fuse?

Why would two voices merge? In 1890 Carl Stumpf asked listeners a simple question about two notes played together: one tone, or two? Listeners without training often heard an octave as a single tone, a fifth quite often, a fourth less often, and thirds and sixths less often still. Stumpf called this tonal fusion. Part 5 suggests one acoustic contribution, illustrated here by an ideal infinite harmonic-series model. A note is a whole series of harmonics. Above a C, every harmonic of the C an octave higher is already a harmonic of the lower C: all of them, a hundred in a hundred. For the fifth, half. For the fourth, a third. For a major third, a quarter; for a minor second, one in fifteen. Shared harmonics can favor grouping, but the fraction is a proxy, not a measured probability of hearing one tone. Finite spectra, mistuning, onset and timbre also matter.

So the intervals that fuse most are the octave, the fifth and the fourth: exactly the intervals of organum, and intervals given special treatment in later rules; a fourth above the bass is treated as dissonant in the two-part species exercises here.

Try it. One phrase, with a second voice moving exactly with it, twice. In which is it easier to hear two separate voices: A or B?

B, for most listeners. In A the second voice was an octave below the first, and the two melted into one darker voice: a pipe organ does this on purpose, with stops that sound an octave apart. In B the second voice was a third below, and although it moved exactly with the first, you could follow either. Thirds and sixths keep their identity, which is why the rules allow a few of them in a row, and forbid even two perfect fifths.

3Moving togetherFoundations2 min

Why does motion in the same direction merge?

Two voices can move in four ways relative to each other. Both in the same direction, by the same interval, so that the interval between them stays the same: parallel motion. Both in the same direction by different amounts: similar motion. In opposite directions: contrary motion. Or one moves while the other holds still: oblique. Listen to each.

Why should moving together matter? Look at a field of dots. When some of them move together, in the same direction at the same speed, you see them at once as a single shape. Psychologists call it the law of common fate, and Albert Bregman showed in his book of 1990 that hearing uses the same law. Sounds whose pitches rise and fall together are taken to come from one source. Huron calls it pitch co-modulation. Put that beside tonal fusion: the ideal fifth shares half of its upper harmonic series; that does not mean a fifty-percent fusion percept; common motion can further favor grouping.

The rules push hard toward contrary motion. Take every line that obeys Fux's rules over the cantus firmus we will meet in chapter five, and count the motions. Contrary motion: moves in a hundred. Lines that are merely consonant, with no other rules, manage . Contrary motion is the one kind that can never co-modulate. When one voice rises and the other falls, their pitch trajectories give a cue to separate streams, though other cues may still group them.

4Starting togetherPractice3 min

Can thirty milliseconds split one sound into two?

A third cue. Here is an octave, twice. In one of them, the upper note starts a little late. In which do you hear two notes: A or B?

B. The upper note came in thirty-five thousandths of a second late, a short attack offset whose percept depends on sound and listener, and yet it is enough for the ear to notice a second tone arriving. Rudolf Rasch measured this in 1978: an asynchrony of a few tens of milliseconds helps listeners pick out each of two simultaneous notes, and performers use it without knowing: in ensembles, the notes that are supposed to start together usually do not.

How small can the gap be? Here is the octave five times, with the upper note zero, ten, twenty, thirty-five and sixty thousandths of a second late. Listen for the moment it stops being one sound.

In this illustrative ladder, increasing offset can make a second attack easier to notice. We have not measured a threshold for these sounds or this listener. Hirsh’s roughly twenty-millisecond temporal-order result concerns a different task; it is not a universal tone-separation threshold. And it is smaller than the gaps musicians leave without meaning to: Rasch, recording trios and ensembles, found the notes that are written together with offsets of tens of milliseconds in the studied ensembles; values depend on instrument, role and measurement. Ensemble playing is never perfectly together, and that is part of why the voices stay audible.

So three cues tell the ear that two notes belong to one source: they fuse, they move together, and they start together. Counterpoint can fight the third with rhythm. In first species every note of the new voice begins with a note of the cantus. In second species about half do; in third, a quarter; in fourth species, where the new voice is syncopated, almost none. Huron found the same strategy in Bach. Counting the onsets in his two-part Inventions, and later across polyphonic music generally, he found that the intervals that fuse most, octaves and fifths, are the ones most likely to be reached with the two notes starting at different times.

5Fux's exerciseFoundations4 min

How was counterpoint taught?

In 1725 Johann Joseph Fux, composer to the emperor in Vienna, published a textbook in Latin called the Gradus ad Parnassum, the steps to Parnassus. It is a dialogue between a teacher, Aloys, and a pupil, Josephus, and for two centuries composers learned from it: Haydn worked through it, Mozart taught from it, Beethoven copied out its exercises. The method is to write a new line against a given melody in long equal notes, a cantus firmus. Here is the first one Josephus is given, in the Dorian mode on D: D, F, E, D, G, F, A, G, F, E, D.

In first species, the new line has one note for each note of the cantus, and it must obey rules. Here are twelve of them, in this explicit modern-textbook-inspired implementation, with choices that affect the counts. Only consonances against the cantus. Begin on a perfect consonance, and end on the octave, approached by step. No unisons in the middle. No parallel fifths or octaves, and no perfect consonance reached by similar motion. No awkward leaps, no repeated notes, and a step back after a large leap. Not too many parallel thirds or sixths. No crossing. One highest note. Beside each rule is what it protects, in Huron's account: the fusion and co-modulation of chapters two and three, and the pitch proximity and regression to the middle of Part 14. Almost every rule is a way of keeping two lines from merging, or of keeping one line from falling apart.

Here is the cantus alone, and then with a first-species line above it that obeys all twelve rules; it is the line that Monochord's search for Fux's preferences, chiefly contrary motion, liked best. Under each pair of notes is the interval between them.

Nine of its ten moves are in contrary motion. It begins on the octave and ends on it, through a major sixth, with the cantus falling to D as the new voice rises to it through C sharp, the raised leading note used in the closing formula illustrated in Part 15. It does not belong to the mode. In earlier centuries such notes were often left unwritten, and singers supplied them by rule; the practice was called musica ficta.

Fux then turns the exercise over: the cantus on top, and the new voice below it. Most rules carry over, measured from the lower note. Two change. The line must begin on the octave or the unison, never a fifth below, because a fifth below the D would be G, and a bass on G can suggest G as a bass foundation in this style; this is a pedagogical convention, not an inevitable percept. And at the cadence the new voice still takes the leading note, C sharp, now a third below the cantus's E, closing to the unison.

Count again. Below the cantus there are only good lines, against above. Most of the difference is the first note: drop the rule about it, and the count jumps to . One rule about where home is removes six good lines in every seven.

6How many good lines?Full course5 min

How much freedom do the rules leave?

How much freedom do these rules leave? Monochord can count it exactly. Over Fux's cantus, the new voice may use fourteen notes in each bar, which gives million million possible lines. Now add the rules one at a time and count what survives. Consonance alone removes all but one in four hundred. The rules for the beginning and the end remove most of the rest. The rules of melody cut deep. And when all twelve are in force, there are good lines. Not one in thirty billion. The counting takes a fraction of a second, by dynamic programming: the dynamic-programming state retains the recent motion, interval run and highest-note information needed by these rules, so the lines can be counted without being listed.

How can anything count four million million lines without listing them? Here is the method, on a cantus of five notes, D, F, G, E, D, with eight of the rules: the ones that only compare a note with the note before it. Each column holds the notes the new voice may sing in that bar on some line that obeys the rules, and a line joins two notes when one may follow the other.

Now count backward, from the end. From each note of the last bar there is one way to finish: stop. Before it, the cadence allows only the leading note, C sharp: one way. In the middle bar, every note can go only to C sharp: one way each. In the second bar, each note can go to two of those: two ways each. And in the first bar, the number for each note is the sum of the numbers it can go to: four, four and six. Fourteen lines in all.

Each number is found once and then reused. Add a bar, and the table grows by one column; the number of lines it counts is multiplied. Over Fux's cantus there are eleven columns, and since some rules look further back, a step back after a leap, no more than three parallel thirds, each cell also remembers the last move and the run of thirds. The method is the same, and it takes a fraction of a second.

The same table draws a line at random with every good line equally likely, which is how the next chapter will take its samples. Choose the first note in proportion to its number: four chances in fourteen for the low D, four for A, six for the high D. Then each next note in proportion to its number, among the notes it may go to. This draw gives D in unison, A, E, C sharp, D. Over many draws, each of the fourteen lines comes up one time in fourteen.

Counting makes a logical redundancy explicit in this particular rule set. Remove the most famous rule of all, the one against parallel fifths and octaves, and count again. Still . Not one line more. The reason is that a stricter rule is already in force: no perfect consonance may be reached by similar motion at all, and parallel motion is a kind of similar motion. Remove that rule instead, and the number rises to . In this implementation, the parallel-perfect rule adds no exclusion beyond the stronger direct-motion rule. It is a special case, kept for its name.

And the rules still leave room for a lifetime of music. Take the whole Tune, forty-two notes, as a cantus firmus. The possible lines are a number with fifty digits. The good ones number about billion. Played one after another without stopping, they would take some years. The rules remove almost everything, and what they leave is still more than anyone will ever hear. That is why Fux's exercises could occupy a student for years: the rules rule out the bad, and leave the choosing to you.

7Remove a ruleFull course2 min

What goes wrong without each rule?

Now take the rules away one at a time, and measure the damage. For each rule, count the lines that obey all the others, draw three hundred of them at random, and measure what has gone wrong in them. Without the rule of consonance there are a hundred and eighty times as many lines, and notes in a hundred clash with the cantus. Without the rule against similar motion into perfect intervals, moves in a hundred land on a fused interval with both voices moving together: the organum effect returns. Without the rules of melody, leaps larger than a fifth triple. Without the rule of recovery, the line wanders: its moves grow. Without the rule against unisons, the two voices meet in the middle and vanish into each other. The measures illustrate several consequences; rules can interact and are not each a unique isolated cause of voice loss.

Hear two of them. Each obeys every rule but one. In one, some notes clash with the cantus; in the other, the two voices arrive together on an octave or a fifth. Which one clashes, A or B?

B clashes: it breaks the rule of consonance, at the pink notes. A breaks the rule on similar motion, and its pink notes mark similar motion into perfect intervals, our proxy for increased grouping risk.

Neither is a catastrophe. A loses its independence for a moment, twice, as the voices arrive together on an octave or a fifth. B is harsher, and in a style where every note is held for a whole bar, the clashes have nowhere to go. In the species that follow, dissonance comes back, on purpose, in places where it can go somewhere.

8Two notes against oneFoundations1 min

Where may a dissonance go?

Second species gives the new voice two notes to each note of the cantus, and with them a new freedom. The note on the strong beat must still be consonant. The note on the weak beat may be a dissonance, but only one kind: a passing note, which fills the gap between two consonances a third apart, arriving by step and leaving by step in the same direction. Here C over A is a third, E over C is a third, and the D between them is a fourth above the cantus: a dissonance, on the way somewhere. In Part 14 a melody moved mostly by steps. A passing dissonance is a melody's step allowed to clash, because the ear hears where it is going.

9Four notes against oneFoundations1 min

What else can a dissonance do?

Third species gives the new voice four notes to each one of the cantus, and two kinds of dissonance. The passing note, as before. And the neighbouring note: a step away from a consonance and straight back, a decoration of a single note. The line may skip between consonances, but every dissonance is still reached and left by step. The first note of each group must be consonant. Everything the ear might hear as a mistake is placed so that it is heard as motion.

10Held overFoundations2 min

What is a suspension?

Fourth species shifts the new voice by half a bar. Each of its notes begins in the middle of a cantus note and is held over into the next. When the cantus moves underneath a held note, the interval can become a dissonance on the strong beat, where it is most exposed. The note must first be consonant when it arrives: the preparation. Then the cantus moves, and the held note becomes a dissonance: the suspension. And then it must fall by step to a consonance: the resolution. A seven falling to a six, a four falling to a three.

A suspension is a dissonance of a different kind from a passing note. It is not on the way between two consonances. It is a consonance that has stayed too long: the note that should have moved when the cantus did has not moved yet. You hear the delay, and then you hear it paid off. A great deal of expressive music, from Palestrina to the slow movements of Mozart, lives in that delay.

Hear it before seeing it. The same five notes in the upper voice, over a falling cantus, twice: once moving with the cantus, once held over. In which do you hear a clash on the strong beats, A or B?

B. In A the upper voice moves with the cantus in parallel sixths: pleasant, and a little bland. In B each note arrives half a bar late and is still sounding when the cantus moves: three sevenths on the strong beats, each falling a step to a sixth. A chain of seven-six suspensions. The notes are the same; only the timing makes the dissonance, and the timing is also what keeps the voices apart.

11Florid, and independentFull course1 min

How independent are two voices?

Now measure every texture in this part the same way, over the same cantus: organum, and the five species. Organum: every note begins together; every move lands on a fused interval with both voices moving together; all the motion is parallel. It is designed to be one voice. First species: still every note together, but co-moving perfect intervals absent by our proxy, and contrary motion nearly everywhere. Then, species by species, the onsets come apart: half together, a quarter, almost none. The rules attack the three cues of fusion one after another: first the fused intervals, then the common motion, then the common onsets.

Huron's paper of 2001 put it in one table. Start from six principles of hearing, each established in the laboratory. Use tones with clear pitches. Manage spectral overlap and register to reduce masking, the masking of Part 4. Limit or offset the intervals that promote fusion when independence is the goal. Move by small steps, so each line stays one stream, as in Part 14. Avoid moving together. Avoid starting together. From these, with a goal, to keep the voices audible as independent lines, he explained many traditional voice-leading practices in perceptual terms, and some that textbooks had never stated but composers had obeyed.

12Frontier: counterpoint by machineResearch2 min

Can rules write music, and can music test the rules?

Rules this exact are an invitation to a computer. In 1984 Bill Schottstaedt, at Stanford, wrote a program that worked all five of Fux's species in up to six voices. He gave most of the rules penalties rather than making them prohibitions, which is closer to Fux, who calls many of his rules advice. In 1988 Kemal Ebcioglu harmonized chorales in the style of Bach with a system of about three hundred and fifty rules. Today counterpoint is a standard test for constraint solvers, and neural networks are trained on Bach's chorales to write more. What this part did is the simplest version: count, sample and search.

The perceptual account also makes predictions that can be checked against music. If the rules come from hearing, then composers who never read Fux may show similar tendencies when independent streams are a goal; culture and stylistic convention can also contribute. Huron's corpus studies found exactly that: fused intervals are approached with offset onsets, and by contrary motion, more than chance would give. And where the goal is a single thick voice, as in a hymn's chords moving together or a horn section in parallel, the rules relax. The method is the one Part 14 used for the leap rule: shuffle the music, count again, and see what is left over.

What remains open is the other half of the craft. The rules say what to avoid. The hard constraints used here do not by themselves rank all valid lines. There are lines over Fux's cantus that break no rule, and a teacher would not grade them equally: some have a shape, a climax in the right place, a sense of going somewhere; others merely comply. Monochord's preference for contrary motion is a crude guess at that judgement. Whether a model can rank good lines as a good teacher does, and from what it would have to learn, is not settled.

Variation 16, recap and problemsAll tracks3 min

Every part ends by doing something to the Tune with what it has built. This part built counterpoint. So the Tune becomes a cantus firmus: each of its notes held for a whole bar, in the lower voice. Over its first phrase, a second voice in organum, a fifth below, as in the ninth century. Then, phrase by phrase, a voice above it in each of Fux's five species, written by Monochord's search: one note against one, two against one, four against one, held over, and florid. One search, so the line runs on from phrase to phrase.

Row sixteen of the ledger. seconds. The measurement: in the organum phrase every note began together with the cantus, and every move landed on a fused interval. In the fourth-species phrase, no note began with the cantus, and none met our co-motion proxy; this is not a perceptual listening result. The same melody underneath; two ways of being heard.

What did we find? Organum wanted one voice, made thicker, and parallel perfect intervals were its means. Three cues make the ear merge two voices: intervals that fuse, moving together, and starting together. Fux's rules, for the most part, follow from avoiding those cues, in Huron’s perceptual account, alongside stylistic choices. Over Fux's cantus, lines obey every rule, out of four point six million million, and the famous rule against parallel fifths adds nothing that the others do not already do. Removing rules changes our modeled features, with interactions between constraints. And the later species bring dissonance back, as passing notes, neighbours and suspensions, while pulling the voices apart in time.

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: the next part puts four voices together, where the same rules govern the chords. Then progressions, and canon and fugue, where a melody is set against itself. The history from Notre-Dame to Palestrina gets its own parts. The search that wrote these species returns as a way of composing, and the question of hearing two voices as two returns, turned around, when machines try to separate them in a recording.

And in practice. An arranger doubles a melody in octaves to make one bigger voice, and in thirds to keep two. A choir director asks for exact togetherness where the parts should blend, and lets them breathe apart where they should be heard. A bass player moves against the melody to stay audible. And a mix engineer separates two instruments by register, timing and motion, not only by loudness.

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

Where it goes next. Four voices and the rules of voice leading in Part 17; progressions in Part 18; canon and fugue in Part 20; the Renaissance and Palestrina in Parts 23 and 24; composing machines in Part 42; separating voices in a recording in Part 64.

Key results

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

Fusion by shared harmonics\(\displaystyle p\!:\!q \ \text{in }\allowbreak \text{lowest }\allowbreak \text{terms}: \ \text{strength} = 1/q; \ \text{octave } 1, \ \text{fifth } \tfrac12, \ \text{fourth, }\allowbreak \text{major }\allowbreak \text{sixth } \tfrac13, \ \text{major }\allowbreak \text{third } \tfrac14\)
Lines over Fux's cantus\(\displaystyle 4{,}628{,}074{,}479{,}616 \ \to \ 152 \ \text{lines }\allowbreak \text{obey }\allowbreak \text{all }\allowbreak \text{twelve }\allowbreak \text{rules} \ (\approx 1 \text{ in } 3 \times 10^{10})\)
Counting by dynamic programming\(\displaystyle N_i(p, s) = \sum_{p' : \ \text{allowed}(i, p, s \to p')} N_{i+1}(p', s')\)
A redundant rule\(\displaystyle \#\{\text{all }\allowbreak \text{rules }\allowbreak \text{but }\allowbreak \text{parallel }\allowbreak \text{fifths}\} = 152 = \#\{\text{all }\allowbreak \text{rules}\}\)
Notes beginning together\(\displaystyle \text{organum }\allowbreak \text{and }\allowbreak \text{species }\allowbreak \text{1: } 100\%; \quad\allowbreak \text{species }\allowbreak \text{2, }\allowbreak \text{3, }\allowbreak \text{4: } 52\%, \ 27\%, \ 5\%\)
Fused moments\(\displaystyle \text{organum } 100\%; \quad\allowbreak \text{every }\allowbreak \text{species } 0\%\)

Try it

Lab 16 · Two voices, by rule and by count

Count the lines that obey Fux's twelve rules over a cantus firmus, find which rules do the work and which add nothing, check a line of your own, write the other four species, measure how independent two voices are, and hear the four kinds of motion.

Figure produced by Lab 16: Two voices, by rule and by count
Produced by the lab below, seed 0, in 4.7 s.
python -m videos.music.labs 16 needs numpy, scipy, matplotlib · download lab16.py · source on GitHub
any notes at all, from the keys allowed                                     4,628,074,479,616
+ only consonances against the cantus                                       10,737,418,240
+ begin on a perfect consonance                                             5,368,709,120
+ end on the octave or unison, by step, through the sixth or third          67,108,864
+ no unison except at the ends                                              23,059,204
+ no parallel fifths or octaves                                             13,122,048
+ no perfect consonance reached by similar motion                           4,054,754
+ no tritones, sevenths or leaps larger than an octave                      37,551
+ no repeated notes                                                         17,936
+ after a leap larger than a third, a step back                             378
+ no more than three parallel thirds or sixths in a row                     378
+ no crossing, and no more than a tenth apart                               234
+ a single highest note                                                     152
share of the sequences that obey every rule                                 3.28e-11
without 'only consonances against the cantus'                               28,038  (184.5 times as many)
without 'begin on a perfect consonance'                                     403  (2.7 times as many)
without 'end on the octave or unison, by step, through the sixth or third'  1,521  (10.0 times as many)
without 'no unison except at the ends'                                      339  (2.2 times as many)
without 'no parallel fifths or octaves'                                     152  (1.0 times as many)
without 'no perfect consonance reached by similar motion'                   410  (2.7 times as many)
without 'no tritones, sevenths or leaps larger than an octave'              487  (3.2 times as many)
without 'no repeated notes'                                                 674  (4.4 times as many)
without 'after a leap larger than a third, a step back'                     2,287  (15.0 times as many)
without 'no more than three parallel thirds or sixths in a row'             152  (1.0 times as many)
without 'no crossing, and no more than a tenth apart'                       277  (1.8 times as many)
without 'a single highest note'                                             234  (1.5 times as many)
your line                                                                   D5 C5 C5 D5 B4 C5 C5 E5 D5 C#5 D5
rules it breaks                                                             bar 3: no repeated notes;  bar 7: no repeated notes
its score by Fux's preferences (higher is better)                           24.6;  the best of 3000 sampled lines scores 28.8
species 3: notes                                                            D5 C5 B4 C5 D5 E5 D5 C5 E5 C5 D5 C5 B4 C5 D5 C5 B4 D5 C5 D5 A4 G4 A4 B4 C5 E5 D5 E5 G5 F5 E5 D5 A4 B4 C5 D5 E5 C5 D5 C#5 D5
species 3: dissonances off the beat                                         C5 (bar 1, beat 2);  C5 (bar 1, beat 4);  E5 (bar 2, beat 2);  D5 (bar 3, beat 3);  C5 (bar 4, beat 2);  C5 (bar 4, beat 4);  C5 (bar 5, beat 3);  G4 (bar 6, beat 2);  B4 (bar 6, beat 4);  D5 (bar 7, beat 3);  F5 (bar 8, beat 2);  B4 (bar 9, beat 2);  D5 (bar 10, beat 3)
organum: begin together, fused, contrary                                    100%,  100%,  0%
first species: begin together, fused, contrary                              100%,  0%,  90%
species 2: begin together, fused, contrary                                  52%,  0%,  40%
species 3: begin together, fused, contrary                                  27%,  0%,  12%
species 4: begin together, fused, contrary                                  5%,  0%,  5%
species 5: begin together, fused, contrary                                  32%,  0%,  20%
ear problem, the eight moves (listen first)                                 oblique;  similar;  parallel;  oblique;  contrary;  contrary;  contrary;  oblique

Twelve rules leave a few hundred lines out of millions; almost every rule keeps two voices from fusing into one or keeps one voice from falling apart; and each species after the first adds a way for the voices to move at different times.
The code (118 lines; it asserts its own result)
"""Lab 16: count the first-species lines over a cantus, see which rules do the work, check a line of your own,
write in the other species, measure how independent two voices are, and name the motion between them by ear."""

import numpy as np

from videos.coursekit import labs
from explainer.music.monochord import Clip, concat
from explainer.music.monochord import chords as CH
from explainer.music.monochord import counterpoint as K
from explainer.music.monochord.partkit import organ_tone

SHARP = ("C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B")


def nm(p: int) -> str:
    return f"{SHARP[p % 12]}{p // 12 - 1}"

TITLE = "Two voices, by rule and by count"
GOAL = ("Count the lines that obey Fux's twelve rules over a cantus firmus, find which rules do the work and which add "
        "nothing, check a line of your own, write the other four species, measure how independent two voices are, and "
        "hear the four kinds of motion.")
TASKS = [
    "Set CANTUS to a cantus of your own: 8 to 12 white keys, mostly steps, ending on its first note (try [60, 62, 65, 64, 62, 67, 65, 64, 62, 60]). How does the number of good lines change with its length and its range?",
    "MY_LINE breaks two rules. Repair it with as few changed notes as you can, then make it score higher than the best sampled line. Which preferences did you trade?",
    "Set SPECIES to 2, 3, 4 and 5. In which species do the voices begin together least often, and why does fourth species never fuse?",
]
CANTUS = K.FUX_DORIAN       # MIDI notes of the cantus firmus (Fux's D F E D G F A G F E D)
MY_LINE = [74, 72, 72, 74, 71, 72, 72, 76, 74, 73, 74]   # a first-species line above it, one note per bar
SPECIES = 3                 # 2, 3, 4 or 5: which species to write above the cantus
SR = 48_000
MOTION = {"parallel": (+2, +2), "similar": (+5, +2), "contrary": (+2, -2), "oblique": (0, -2)}


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

    # 1. Problem 1: the funnel, rule by rule
    f = K.funnel(cf)
    for name, n in f:
        lab.row("any notes at all, from the keys allowed" if name == "no rules" else f"+ {K.NAMES[name]}", f"{n:,}")
    good = f[-1][1]
    lab.row("share of the sequences that obey every rule", f"{good / f[0][1]:.2e}")
    if cf == K.FUX_DORIAN:
        assert good == 152

    # 2. Problem 2: take one rule away at a time
    rows = []
    for r in K.RULES:
        n = K.count(cf, tuple(x for x in K.RULES if x != r))
        rows.append((r, n))
        lab.row(f"without '{K.NAMES[r]}'", f"{n:,}  ({n / good:.1f} times as many)")
    if cf == K.FUX_DORIAN:
        assert dict(rows)["parallel"] == good          # the direct-motion rule already forbids parallel fifths

    # 3. Problem 1 again, by hand: what is wrong with MY_LINE?
    errs = K.check(cf, MY_LINE)
    lab.row("your line", " ".join(nm(p) for p in MY_LINE))
    lab.row("rules it breaks", ";  ".join(f"bar {i + 1}: {K.NAMES[r]}" for i, r in errs) or "none: a good first-species line")
    lab.row("its score by Fux's preferences (higher is better)", f"{K.score(cf, MY_LINE):.1f};  the best of 3000 sampled lines scores {K.score(cf, K.best(cf, tries=3000)):.1f}")

    # 4. Problem 3: the other species
    line = K.species(cf, SPECIES, rng=np.random.default_rng(100 + SPECIES), tries=60)
    cf_ev = [(c, 4.0 * k, 4.0) for k, c in enumerate(cf)]
    diss = [(p, a) for p, a, _ in line if a % 4 and (p - cf[min(int(a // 4), len(cf) - 1)]) % 12 not in K.CONSONANT]
    lab.row(f"species {SPECIES}: notes", " ".join(nm(p) for p, _, _ in line))
    lab.row(f"species {SPECIES}: dissonances off the beat", ";  ".join(f"{nm(p)} (bar {int(a // 4) + 1}, beat {int(a % 4) + 1})" for p, a in diss) or "none")

    # 5. Problem 4: independence, from organum to florid
    table = {"organum": K.independence([(c - 7, 4.0 * k, 4.0) for k, c in enumerate(cf)], cf_ev),
             "first species": K.independence(*K.first_species_events(cf, K.best(cf, tries=1000)))}
    for n in (2, 3, 4, 5):
        table[f"species {n}"] = K.independence(line if n == SPECIES else K.species(cf, n, rng=np.random.default_rng(100 + n), tries=40), cf_ev)
    for name, ind in table.items():
        lab.row(f"{name}: begin together, fused, contrary", f"{100 * ind['together']:.0f}%,  {100 * ind['fused']:.0f}%,  {100 * ind['contrary']:.0f}%")
    assert table["organum"]["fused"] == 1.0
    if cf == K.FUX_DORIAN:
        assert table["species 4"]["fused"] == 0.0 and table["species 4"]["together"] < table["first species"]["together"]

    # 6. Ear problem: eight moves, each one of the four motions
    answers, clips = [], []
    for _ in range(8):
        kind = list(MOTION)[int(rng.integers(0, 4))]
        lo = int(rng.choice([53, 55, 57, 60]))
        hi = lo + int(rng.choice([3, 4, 8, 9]))
        du, dl = MOTION[kind]
        y = np.zeros(int(2.4 * SR))
        for t, (u, l) in enumerate([(hi, lo), (hi + du, lo + dl)]):
            tone = sum(organ_tone(CH.hz(n), 1.1, partials=6, rolloff=0.7, decay=1.2) for n in (u, l))
            i = int(t * 1.1 * 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 moves (listen first)", ";  ".join(answers))

    fig, (a, b) = labs.figure(2)
    names = ["none"] + [str(i + 1) for i in range(len(f) - 1)]
    a.bar(range(len(f)), [n for _, n in f], color=labs.GOLD)
    a.set_yscale("log")
    a.set_xticks(range(len(f)))
    a.set_xticklabels(names)
    a.set_xlabel("rules added, in Fux's order")
    a.set_title(f"Lines over the cantus: {f[0][1]:,} to {good:,}")
    keys = list(table)
    x = np.arange(len(keys))
    b.bar(x - 0.2, [table[k]["together"] for k in keys], width=0.4, color=labs.GOLD, label="notes begin together")
    b.bar(x + 0.2, [table[k]["fused"] for k in keys], width=0.4, color="#7DD3FC", label="fused moments")
    b.set_xticks(x)
    b.set_xticklabels([k.replace("species ", "sp. ") for k in keys], rotation=20)
    b.set_title("How independent: organum to fifth species")
    b.legend(frameon=False)
    lab.fig = fig
    lab.note = ("Twelve rules leave a few hundred lines out of millions; almost every rule keeps two voices from fusing "
                "into one or keeps one voice from falling apart; and each species after the first adds a way for the "
                "voices to move at different times.")
    return lab

Now change it

  1. Set CANTUS to a cantus of your own: 8 to 12 white keys, mostly steps, ending on its first note (try [60, 62, 65, 64, 62, 67, 65, 64, 62, 60]). How does the number of good lines change with its length and its range?
  2. MY_LINE breaks two rules. Repair it with as few changed notes as you can, then make it score higher than the best sampled line. Which preferences did you trade?
  3. Set SPECIES to 2, 3, 4 and 5. In which species do the voices begin together least often, and why does fourth species never fuse?

Problems, with solutions

Try each problem before opening its solution.

  1. Compute. Against the cantus C D F E D C, write every first-species line above it that begins and ends on the C an octave above, obeying the twelve rules, and say which you prefer and why.

    Solution

    There are seven good lines in all (counterpoint.count([60, 62, 65, 64, 62, 60])), and three begin and end on C5: C A D C B C, C B D C B C and C B D E B C. Each falls to B over D at the cadence (a major sixth opening to the octave). The third is the best by Fux's preferences (score 12.4 against 10.9 and 11.5): it reaches its single highest note, E, by contrary motion onto an octave in the middle of the line, and has three contrary moves of five; the first moves in similar motion three times in a row, and the second has a pair of parallel sixths and a repeated shape (C B … C B).

  2. Prove. Show that if no perfect consonance may be reached by similar motion, then no parallel fifths or octaves can occur. Is the converse true?

    Solution

    Parallel motion is the special case of similar motion in which the interval stays the same. Two successive fifths (or octaves) in which both voices move are reached by motion in the same direction, so they are a perfect consonance reached by similar motion, which the stronger rule forbids. (Two fifths with neither voice moving are a repeated note, forbidden separately.) The converse is false: the weaker rule allows a perfect consonance reached by similar motion from a different interval, a third or a sixth moving to a fifth or an octave with both voices rising or falling: the "hidden" or "direct" fifths and octaves. Over Fux's cantus this difference is the whole of the gap between 410 lines and 152, and the parallel-fifths rule adds nothing once the direct-motion rule is in force.

  3. Ear. The lab plays eight pairs of two-voice chords. For each, say whether the voices move in parallel, similar, contrary or oblique motion.

    Solution

    The lab prints the answers. Listen to each voice in turn. If one voice stays put, oblique. If they go opposite ways, contrary. If both go the same way, listen to the interval: unchanged (here a step each) is parallel, opening or closing (a fourth against a step) is similar.

  4. Build. With counterpoint.count, remove each rule in turn, above Fux's cantus and below it. Which rules bind harder below, and why?

    Solution

    Above, 152 lines; below, 42. Removing each rule multiplies the count by (above, below): consonance 184, 408; start 2.7, 7.2; cadence 10, 9.0; unison 2.2, 2.0; parallel 1, 1; direct 2.7, 2.0; melodic 3.2, 6.7; repeat 4.4, 5.2; recovery 15, 19; run 1, 1; spacing 1.8, 2.7; climax 1.5, 1.8. The rule on the first note binds almost three times harder below: above, the line may begin on the octave or the fifth; below it must begin on the octave or unison, because a fifth below D is G, and a bass on G names G as home. The melodic rules also bind harder (6.7 times against 3.2), but differently: the lines they remove below leap mostly by major sixths, major sevenths and minor ninths; above, mostly by tritones and falling minor sixths. Why a line below the cantus is drawn to those leaps is a good extension.

  5. ★ Which good line is best? Of the 152 good lines over Fux's cantus, which would a teacher grade highest? Propose a score, and a way to check it against human judgements.

    Where the frontier is. Rules of avoidance are well understood; rules of preference are not. Candidate scores combine shape (a single climax in the middle third, a balance of rising and falling, steps outweighing leaps), variety (imperfect consonances, few repeated intervals or motions) and direction (motion toward the cadence), with weights. Schottstaedt (1984) turned Fux's preferences into penalties by hand; Farbood and Schoner (2001) learned them from examples with a Markov model; Komosinski and Szachewicz (2015) and others search with several objectives at once. The check is the hard part: collect blind rankings of a sample of the 152 lines from several counterpoint teachers, measure how far teachers agree with one another (if they do not, there is nothing to fit), fit the weights on half the lines and test the ranking on the rest. As far as we know no such data set of expert rankings exists for species counterpoint.

Notes and sources

Sources

Books: J. J. Fux, Gradus ad Parnassum (1725), trans. A. Mann, The Study of Counterpoint (1965); K. Jeppesen, Counterpoint: The Polyphonic Vocal Style of the Sixteenth Century (1931, trans. 1939); F. Salzer and C. Schachter, Counterpoint in Composition (1969); A. S. Bregman, Auditory Scene Analysis (1990); C. Stumpf, Tonpsychologie, vol. 2 (1890); R. Crocker, "Discant, counterpoint and harmony", JAMS 15 (1962); S. Fuller, "Early polyphony", in The New Oxford History of Music, vol. 2 (1990); the Musica enchiriadis and Scolica enchiriadis, trans. R. Erickson (1995); Guido of Arezzo, Micrologus (about 1026), trans. W. Babb in Hucbald, Guido, and John on Music (1978).

Papers: D. Huron, "Tone and voice: a derivation of the rules of voice-leading from perceptual principles", Music Perception 19 (2001); D. Huron, "Voice denumerability in polyphonic music of homogeneous timbres", Music Perception 6 (1989), and "Asynchronous preparation of tonally fused intervals in polyphonic music", Empirical Musicology Review 3 (2008); D. Huron and P. Sellmer, "Critical bands and the spelling of vertical sonorities", Music Perception 10 (1992); I. J. Hirsh, "Auditory perception of temporal order", JASA 31 (1959); R. A. Rasch, "The perception of simultaneous notes such as in polyphonic music", Acustica 40 (1978), and "Synchronization in performed ensemble music", Acustica 43 (1979); B. Schottstaedt, Automatic Species Counterpoint, CCRMA report STAN-M-19 (1984); K. Ebcioğlu, "An expert system for harmonizing four-part chorales", Computer Music Journal 12 (1988); M. Farbood and B. Schoner, "Analysis and synthesis of Palestrina-style counterpoint using Markov chains", Proceedings of the ICMC (2001); M. Komosinski and P. Szachewicz, "Automatic species counterpoint composition by means of the dominance relation", Journal of Mathematics and Music 9 (2015).

About this partfrom its README

Part 16 of a sixty-eight-part course in music (see the series plan and the syllabus), and the first part of Act III, where music has more than one voice at a time. It starts from a paradox: parallel fifths were the method of the first written polyphony and are the most famous prohibition in harmony teaching. It explains both from hearing (tonal fusion, moving together, starting together), then takes Fux's Gradus ad Parnassum (1725) as an engineering problem: it counts every first-species line over Fux's cantus firmus exactly, removes the rules one at a time and measures what breaks, works through the five species, and measures how independent two voices are, from organum to florid counterpoint. The counterpoint module is Monochord's (explainer/music/monochord/counterpoint.py), and every sound is computed in compute.py. Published findings are the ones listed under Sources.

  • A forbidden rule that was once the rule. "Never write parallel fifths"; the Tune with a second voice a fifth below it all the way through, and then with a counterpoint above it that obeys Fux's rules (contrary motion at 54 moves in a hundred, no fused moments): one melody made thicker, and two people each going somewhere; Huron (2001): the rules are instructions for keeping two voices audible as two; the plan.
  • 1. One voice, made thicker. The Musica enchiriadis (about 900): principal and organal voices, simple and composite organum, heard on the Tune's first phrase; three stages heard on the whole Tune and measured: parallel organum at the fifth (fused at every move), organum at the fourth with a boundary note, as in the handbook and Guido (fused at 57 moves in a hundred, the rest oblique), and free organum of about 1100, chosen by dynamic programming to move against the chant (never fused, contrary at 64 in a hundred); the timeline to 1500.
  • 2. When two notes become one. Stumpf's tonal fusion (1890); the share of the upper note's harmonics that are also harmonics of the lower (1/q for a just ratio p:q): octave 1, fifth 1/2, fourth and major sixth 1/3, major third 1/4, minor second 1/15; an ear question (a phrase doubled at the octave and at the third).
  • 3. Moving together. The four motions, heard; the law of common fate and Bregman (1990): pitch co-modulation; in the 152 good first-species lines contrary motion is 47 moves in a hundred, against 35 in lines that are merely consonant.
  • 4. Starting together. An ear question (an octave, the upper note 35 ms late); how late a note must be, heard (0, 10, 20, 35 and 60 ms); Hirsh (1959): about 20 ms to tell which of two sounds came first; Rasch (1978, 1979): asynchrony helps listeners pick out simultaneous notes, and ensembles play "together" 30 to 50 ms apart; notes beginning together, by species: 100, 52, 27 and 5 in a hundred; Huron (1993, 2008) on Bach.
  • 5. Fux's exercise. The Gradus (1725) and its readers; the Dorian cantus D F E D G F A G F E D; twelve rules as modern textbooks state Fux, each beside the perceptual principle it protects; the line Monochord's search liked best, heard: nine of ten moves contrary, octave to octave through C♯ (musica ficta); the exercise turned over: a line below the cantus, heard, the octave or unison as first note, the leading note now a third below; 42 good lines below against 152 above, and 302 below if any first note is allowed.
  • 6. How many good lines? 4,628,074,479,616 note sequences; the rules added one at a time (consonance leaves one in 431; the beginning and the cadence; the rules of melody; direct motion; one highest note): 152 good lines, one in thirty billion; counting by hand: a five-note cantus (D F G E D) with the eight rules that look one note back, counted backward column by column (4 + 4 + 6 = 14) and a line drawn uniformly from the same table; the redundant rule: without the rule against parallel fifths and octaves, still 152, because no perfect consonance may be reached by similar motion at all (without that rule instead: 410); over the whole Tune as a cantus: 23,921,887,999 good lines, 38,000 years to play.
  • 7. Remove a rule. Each rule removed, 300 lines drawn uniformly from those that obey the rest, and the damage measured: without consonance 184 times as many lines and 37 notes in a hundred clashing; without the rule on direct motion 9 moves in a hundred fused; without the melodic rules leaps over a fifth rise from 3 to 11 in a hundred; without recovery 15 times as many lines; an ear question (two lines, each breaking one rule: which clashes?).
  • 8. Two notes against one. Second species: the weak beat may carry a passing dissonance (D over A between C and E); a line over Fux's cantus with its four passing dissonances, on the staff and heard.
  • 9. Four notes against one. Third species: passing and neighbouring notes, a skip between consonances; a line with thirteen dissonances, every one reached and left by step, heard.
  • 10. Held over. Fourth species: preparation, suspension, resolution (a seven falling to a six); an ear question (the same five notes over a falling cantus, moving with it in parallel sixths and held over as a chain of 7–6 suspensions); a fourth-species line, heard: one note in twenty begins with the cantus.
  • 11. Florid, and independent. Fifth species, heard; one table for every texture: notes beginning together, fused moments, contrary and parallel motion, from organum (100, 100, 0, 100) through the species; Huron's six principles (toneness, minimum masking, tonal fusion, pitch proximity, pitch co-modulation, onset synchrony) and the rules that follow from them.
  • 12. Frontier: counterpoint by machine. Schottstaedt's species program (1984, rules as penalties, up to six voices); Ebcioğlu's chorales (1988, about 350 rules); constraint solvers and neural networks; corpus tests of the perceptual account (the shuffle method of Part 14). ★ research problem: what makes one good line better than another.
  • Variation 16, recap and problems. The Tune as a cantus firmus, a bar to each note: its first phrase in organum a fifth below, then a voice above it in each of the five species (one search, so the line runs on); the ledger (notes beginning together: 100% in organum, 0% in fourth species); what we found; five problems; where it comes back; in practice; references; Part 17.
What is computed and built

python -m videos.music.music16.compute (about a minute) fills .cache/music16/.

Item What it computes Checked against
hook the Tune with a fifth below it; the best first-species line above it; independence of both the line breaks no rule (check)
organum simple and composite organum on the Tune's first phrase —
fusion 1/q for each interval's just ratio; the ear question Part 4's ratios
motions the four motions; their shares in good lines and in merely consonant lines —
onsets the octave, together and 35 ms apart; onsets in common by species —
fux the cantus, the best line by Fux's preferences, its intervals and motions; the rules check finds no violation
counting the funnel of exact counts; the count over the whole Tune exhaustive listing on small cantus (tests)
damage the count and 300 uniform samples with each rule removed; two broken lines —
species species two to five over Fux's cantus by randomized search; their dissonances and suspensions every dissonance placed by the species' rules (tests)
independence the independence table: organum and the five species —
tune Variation 16 onsets in common: 100% (organum), 0% (fourth species)
more organum's three stages; the five-note count by hand; the line below; the delay ladder; the suspension question the hand count equals count and the list of lines

Monochord's counterpoint is held against brute force in tests/music/test_counterpoint.py; this part's claims and clips in tests/music/test_music16.py.

Sounds. Sixteen clips: the counterpoint on Part 7's piano (physical model), organum, the fusion and onset questions on organ tones (synthesized), all in twelve-tone equal temperament. There are no recordings.

What the models are, and are not. The twelve rules are Fux's first species as modern textbooks state it (Mann's translation, Jeppesen, Salzer and Schachter), made exact: consonances are octaves, fifths, thirds and sixths; "awkward leaps" are tritones, sevenths and leaps over an octave (a rising minor sixth is allowed); "too many parallel thirds" is more than three in a row; the compass is a tenth. Fux states some of these as advice, not law, and other choices give other counts; the counts are exact for these rules. Fux's preferences (contrary motion, imperfect consonances, steps, a climax in the middle) are Monochord's score, a crude stand-in for a teacher, which is the chapter-12 research problem. The species lines are found by randomized depth-first search with a score; they obey the species' rules for dissonance but are not checked against every first-species rule (the compass and leaps are, the climax is not), and a teacher would correct some of them. Fusion strength 1/q is the share of shared harmonics of an idealized harmonic tone, a proxy for Stumpf's judgements, not a measurement. Independence counts, at every moment a note begins, the motion since the last such moment and whether the voices move together onto an octave, fifth or fourth; Huron's corpus measures are more refined. The free organum of chapter 1 is chosen by a scoring rule of ours, in the style of the treatises, not transcribed from one. The delay ladder's thresholds are what most listeners report, not a measurement of ours.

Notes

Historical organum had varied textures and aims. Perceptual principles can explain tendencies toward blending or independence without uniquely deriving a style’s rules. The infinite-series 1/q fraction is not a probability of hearing one tone; the two-part exercises also treat the fourth above the bass as dissonant. The fused field counts co-moving arrivals on selected perfect intervals, not listener reports of fusion. Delay examples do not establish individual thresholds, and temporal-order identification is a distinct task from detecting separate tones. Dynamic-programming state includes recent motion, interval runs and highest-note information. Counts and redundancy apply to this explicit rule set, while later species are checked under their stated subset of constraints.

Companion material in this repository

The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
  1. Hook: the Tune with a voice a fifth below it, and with a counterpoint above it; the forbidden rule; the plan.
  2. One voice, made thicker: the Musica enchiriadis; simple and composite organum; parallel, oblique and free organum heard and measured; the timeline to 1500.
  3. When two notes become one: Stumpf's fusion; shared harmonics, 1/q; octaves or thirds (an ear question).
  4. Moving together: the four motions; common fate and pitch co-modulation; how often the rules choose contrary motion.
  5. Starting together: an octave, together and 35 ms apart (an ear question); how late is late; onsets by species.
  6. Fux's exercise: the Gradus; the cantus; twelve rules and what each protects; the best line; a line below.
  7. How many good lines: the funnel to 152; counting by hand (a worked example); the redundant rule; the Tune.
  8. Remove a rule: the damage, rule by rule; two broken lines (an ear question).
  9. Two notes against one: passing dissonance; second species heard.
  10. Four notes against one: neighbours and skips; third species heard.
  11. Held over: preparation, suspension, resolution; the same notes held over (an ear question); fourth species.
  12. Florid, and independent: fifth species; independence measured, organum to florid; Huron's six principles.
  13. Frontier: counterpoint by machine; corpus tests of the perceptual account; what makes a good line.
  14. Variation 16: the Tune as a cantus firmus. Outro: problems, payoffs.

Covers: organum (parallel, oblique, free); cantus firmus; the four motions; species one to five; passing tones, neighbours and suspensions; counterpoint below the cantus; stream segregation, tonal fusion, pitch co-modulation and onset synchrony; independence measured; Huron's derivation of the rules. Built and computed: monochord/counterpoint.py: Fux's twelve rules as exact predicates; every first-species line counted by dynamic programming and sampled uniformly; a checker; species two to five by randomized search; an independence measure; rules removed one at a time and the damage measured on uniform samples. Bach's Inventions are cited from Huron's corpus studies, not analysed here (no score files offline). Variation 16: the Tune as cantus firmus, in organum and then through the five species. Frontier: corpus tests of the perceptual account; counterpoint as constraint satisfaction; what makes one good line better than another. Reading: Fux, Gradus ad Parnassum (1725); Huron (2001); Jeppesen; Salzer & Schachter.

Build the film

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

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

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