Harmony and voice leading

The alternation a key-finder cannot follow

Two keys sounding together are not in the key-finder's vocabulary, and an earlier essay ended by pointing at the other case and saying what was missing: a passage whose alternation rate can be varied while everything else is held still. Built, it gives a rule with three numbers in it — the second key is never named below a block of three bars, the tracking clears ninety per cent above twice the window, and the reading is late by half the window throughout.

Assumes: Two keys at once · How much evidence a modulation needs

The previous rung found that a key-finder cannot report two keys and does not report uncertainty either: asked about a passage in C and G simultaneously it names G at a correlation of 0.961, which is higher than the same progression in C alone. It ended by naming a rung it had pointed at and not taken — the other case, in which two keys alternate rather than sound together — and by saying exactly what was missing.

Not the machinery. The material: a passage whose alternation rate can be varied while everything else is held still, which is a construction rather than a piece — a thing this collection has built before, for the same reason: a variable cannot be varied inside a piece somebody else wrote.

How fast two keys can alternate before the finder stops following. The share of bars a moving key-finder names correctly, once its reading is shifted back by its own lag, against how many bars each key holds for. One line per window. Below a block of three bars the second key is never named at all — 2 of the sweep's readings report a single key for the whole passage — and above about twice the window the tracking is over ninety per cent. The lag itself is about half the window: 0 bars at a window of 3, 0 bars at a window of 4, 3 bars at a window of 8.
Fig. 1 The construction, run. Each line is one window of the moving key-finder; the horizontal axis is how many bars each key holds for before the music switches. The reading has been shifted back by its own lag before scoring, so what is drawn is how well the finder tracks rather than how promptly. Below a block of three bars it does not track at all, and above about twice the window it is over ninety per cent right.

The construction

Four bars of I–IV–V–I in one key, then the same four bars transposed into a key a fifth away, then back. That is the whole passage, and the one thing that varies is how many bars each block holds for.

Everything else is held. The chords are the same chords, in the same order, with the same durations. The two keys are the same distance apart at every rate. The progression is a complete cadential unit in each key, so each block is a self-contained fragment rather than a slice of an interleaving — a detail that turned out to matter: the first version of this construction indexed the progression globally, so the two keys ran through each other rather than alternating, and what it measured was interleaving.

The key-finder is unchanged from the ladder’s fourth rung: a weighted pitch-class histogram over a window of recent bars, correlated against twenty-four rotated probe-tone profiles, best first.

Two keys alternating every 8 bars, and what the finder says. Above, which key is actually sounding in each bar of a 48-bar passage that alternates between two keys a fifth apart every 8 bars. Below, what a moving key-finder with a window of 4 bars reports. It names the right key in 88 per cent of bars as they stand, and in 88 per cent once the reading is shifted 0 bars earlier — so the finder is right or wrong rather than late.
Fig. 2 One rate drawn out. Above, the key actually sounding in each bar of a passage that alternates every eight; below, what a four-bar window reports. Where the two rows disagree the lower one is pale. The disagreements are all at the joins, which is the finder taking a few bars to notice — and the number of bars is the thing an earlier essay measured.

The rate below which nothing happens

The first number is the sharp one.

At a block of two bars the second key is never named at all. Not named late, not named weakly, not named as a related key: the entire passage — twenty-four bars, half of them in one key and half in the other — is read as a single key from beginning to end, at a window of four bars and at a window of eight.

At a window of three it is not quite true, and the exception is worth having because it is the rule’s own arithmetic showing through. A three-bar window over two-bar blocks spends most of its span inside one block, so it does resolve the second key — five times in twenty-four bars, at 77 per cent aligned — where the four-bar window, which always straddles a join, reports one key for the whole passage. The dead zone is a relation between the window and the block, not a property of two-bar blocks.

Two keys alternating every 2 bars, and what the finder says. Above, which key is actually sounding in each bar of a 24-bar passage that alternates between two keys a fifth apart every 2 bars. Below, what a moving key-finder with a window of 4 bars reports. It names the right key in 50 per cent of bars as they stand, and in 55 per cent once the reading is shifted 2 bars earlier — so the finder is right and late. The second key is never named at all: every bar of the passage is read as the first.
Fig. 3 Two bars per key. The upper row alternates twelve times; the lower row does not alternate at all. The finder is not confused and it does not report a low correlation; it reports one key, confidently, for a passage that is in two.

That is the previous rung’s claim, and this rung’s contribution is to say where it stops being true. At three bars the second key appears, at every window, and the boundary is between two and three for the two windows that straddle a two-bar block.

The reason is in the histogram rather than in the window. A two-bar block of a I–IV–V–I is its first two chords, I and IV, and I and IV of one key are also V and I of the key a fifth below — so a two-bar fragment of C and a two-bar fragment of G have no note in either that distinguishes them. The alternation is invisible not because it is too fast for the window but because the fragments are too short to be in a key at all.

Which means the previous rung’s finding was about the fragments and not about the rate, and the thing that was hidden was hidden by the progression rather than by the algorithm. That is a correction to a claim an earlier essay here published, and it is the kind that only appears when somebody varies the parameter.

Right, and late by half the window

The second number is the one the fourth rung set up.

How much evidence a modulation needs measured the detection lag on a single modulation: the same change of key is found two chords later with a window of eight than with a window of three, because a window carries the old key’s notes along with it. That is a measurement on one event.

Alternation makes it a measurement on a signal, and the answer is the same answer with a shape.

The lag is about half the window. At a window of eight bars the reading is best aligned with the truth when shifted back three bars; at four bars the shift is zero to two; at three, zero. That is what a rectangular window does to any changing signal — its centre of mass is half its length behind its leading edge — and it means a key-finder is not merely slow but predictably slow, by an amount its own parameter fixes. The key plan is the form on a scale of dozens of bars, where three bars of lag is nothing; on a scale of four, it is most of the unit.

The consequence for the tracking score is large. At a window of eight and a block of six bars, the raw agreement is 44 per cent — worse than chance. Shift the reading back three bars and it is 87. The finder is not wrong about that passage; it is right about the passage three bars ago, which is a different kind of failure and one that no score computed bar by bar can distinguish from being wrong. The circle is a circle and the map is not: here, too, the thing that looks like an error is a coordinate problem.

The rule, in one line

Put the three together and the ladder has a rule where it had an anecdote.

A moving key-finder with a window of W bars follows an alternation whose blocks are 2W bars or longer, at better than ninety per cent, three bars late at W = 8. Between W and 2W it is between seventy and ninety. Below W it is near chance. And below a block of three bars it reports one key whatever W is, because the fragments are not in a key.

How many bars a key change takes to be heard. A twelve-bar progression that moves to G major at bar 6, read by the same correlation against all twenty-four profiles, with a window of 3, 4 and 8 bars. With 3 bars of history the new key is never the answer at all. With 4 bars of history the answer is G major from bar 7, one bar late, and it holds it from there. With 8 bars of history the answer is G major from bar 9, 3 bars late, and it holds it from there. The pivot bar is ambiguous by construction — it belongs to both keys, which is what makes it a pivot — so the lag is not a defect of the algorithm but a statement about how much evidence a key is.
Fig. 4 That earlier figure: one modulation, three windows, and the lag between the music changing key and the reading changing with it. Everything in this essay is that measurement made repeatedly. The rule above is what it looks like when the modulation never stops happening.

The dead zone, and what a listener would do with it

The two-bar result deserves one more turn, because it is the only place in the sweep where the failure is total rather than graded.

A two-bar fragment of I–IV in C is the notes C, E, G, F, A. A two-bar fragment of the same progression in G is G, B, D, C, E. Between them they use seven of the twelve, which is a diatonic collection — and a diatonic collection is the object the key-finder is best at and the object that is ambiguous between two keys by construction. Every window that spans a whole cycle sees exactly that collection.

So the finder’s silence is not a failure of resolution. It is a correct report about an object that has no answer: the passage, integrated over any window longer than one block, is a diatonic set and nothing more. The information that distinguishes the keys is entirely in the order, and the order is the first thing thrown away.

A listener plainly does better than that, and the reason is not a longer window. It is that a listener hears the cadences — the V–I at the end of each block — as events rather than as pitch-class counts, and an event has a position in time. A degree is where it goes next is the same observation made about a scale rather than about a key, and it is the observation this whole ladder’s machinery cannot represent.

What it says about bitonality

The previous rung’s real question was whether a listener — or a model of one — can tell a bitonality from a fast alternation, and the answer this construction gives is unexpectedly clean.

It cannot, and neither can the pair model. A window that spans a whole cycle of the alternation contains exactly the pitch classes a simultaneity would contain, because a histogram has no order in it. So at a block of two bars with a window of eight, the histogram of the alternation and the histogram of the bitonality are the same object, and any method that reads only the histogram must give the same answer to both.

A model that cannot say two keys does not say it is unsure. I – IV – V – I played in C major and in a second major key at the same time, with the second key moved round the circle of fifths. For each separation: the correlation the standard key-finder gives its single best answer, and the correlation reached by the best PAIR of key profiles — a hypothesis the finder does not have. The pair recovers both keys that are sounding at every separation, 7 of 7. The single answer names neither of them at 4 of the 7, and its confidence does not fall when it is wrong: at four steps apart it reports E minor at r = 0.886, against 0.959 for the same progression in one key.
Fig. 5 The most recent sweep: one progression in two keys at once, at seven separations, with what the single-key finder says beside what the best pair says. The pair model recovers both keys at every separation — and it recovers them from a histogram, which is exactly why it cannot tell that case from a fast alternation.

That is not a defect of the pair model. It is a statement about what a histogram is: the distinction between two keys at once and two keys in quick succession is a fact about order, and every model in this ladder discards order in its first step. A model that could tell them apart would have to be a different kind of model, and naming what kind is the ladder’s next job.

How far every key is from C major. The 11 other major keys under three measurements. Notes in common and steps round the circle are the same measurement — the first is seven minus the second until it bottoms out at two — and voice-leading distance between the tonic triads is not. E major shares 3 notes and is 2 semitones away; A♭ major shares 3 notes and is 2 semitones away, against the dominant's 6 and 3.
Fig. 6 Why a fifth is the hard case. The distance from one key to all twenty-four under three measures, of which two are the same measure: among the major keys, notes in common is a strict function of steps round the circle. A key a fifth away shares six of its seven notes, so a window that spans both sees a collection that is almost one key’s and almost the other’s.
Two keys alternating every 4 bars, and what the finder says. Above, which key is actually sounding in each bar of a 32-bar passage that alternates between two keys a fifth apart every 4 bars. Below, what a moving key-finder with a window of 4 bars reports. It names the right key in 72 per cent of bars as they stand, and in 72 per cent once the reading is shifted 0 bars earlier — so the finder is right or wrong rather than late.
Fig. 7 The intermediate case, at four bars a key — the block length most of the nineteenth-century repertoire’s sequences use. The reading alternates, and it alternates in the right places, and it is a bar or two behind at every join. This is the regime in which the model is useful and its answers have to be read with a correction.

The sweep over key distance, which says the opposite

The fifth was chosen because it is the closest relation there is and therefore the hardest case, and the obvious expectation is that two keys further apart would separate at a shorter block. Running the same construction against all eleven other major keys says otherwise, twice.

second key steps round the circle shared notes first named at a block of (window 4) aligned tracking, block 8
G 1 6 1 87.5%
F 1 6 2 86.7%
D 2 5 1 78.7%
B♭ 2 5 3 78.7%
E, A♭ 4 3 3 89.4%
E♭, A 3 4 3 89.4%
C♯, B 5 2 3 85.1%, 83.0%
F♯ 6 2 3 89.4%

The tritone does not separate at a shorter block. It separates at three, which is where nine of the eleven separate, and the two that separate sooner are the two nearest keys. And the tracking at a well-separated block does not improve with distance at all: it runs between 78.7 and 89.4 per cent with no trend in it, and the worst two are at two steps round the circle rather than at one.

The reason those two are worst is the useful part, and it is visible in what the finder actually names. Alternating C with D, it reports D twenty times, C eighteen — and G eight times, which is a key the passage never enters. Alternating C with B♭ it reports F seven times, likewise. A window straddling a join sees a blurred histogram, and a blurred histogram is not a bad reading of either key; it is a good reading of the key halfway between them on the circle of fifths.

That is why the tritone comes out best. C and F♯ are antipodal, so there is no key between them for the blur to fall into — the mixture is equally far from everything and the finder reverts to whichever block dominates the window. Its errors are two bars of B minor and two of F minor, which are near neither key and are read as noise rather than as an answer.

So the difficulty of an alternation is not its key distance. It is whether a third key sits between the two, and that is a property of two steps round the circle rather than of one or six. The fifth is not the hardest case; the whole-tone pair is, and it is hardest for a reason the previous rung’s framing had no place for.

Which computation produced the numbers

The passage is alternatingPassage: a roman-numeral progression, transposed by a stated number of steps round the circle of fifths, in blocks of a stated length, with each block restarting its key’s progression from the beginning.

The reading is keyReading, which is the fourth rung’s function unchanged — a window of recent bars, weighted by beats, correlated with Krumhansl and Schmuckler’s twenty-four profiles.

The tracking score is the share of bars whose reading names the major key actually sounding in that bar. The aligned score is the same thing maximised over a shift of the reading, and the shift that maximises it is reported as the lag. Searching for the best shift rather than assuming it is what turns “the finder is wrong here” into “the finder is late by this much”, and the search is bounded at twice the block length so that it cannot find a spurious alignment a whole cycle away.

Twelve blocks, so twenty-four to a hundred and ninety-two bars depending on the rate. The scores are over the whole passage including the first window’s worth of bars, where the finder has less history than its window asks for — which drags every score down by a few points and does so equally at every rate.

Whose music, and when

Rapid alternation between two keys is not a common device and where it appears it is usually a texture rather than a harmony: the ostinato bitonality of Stravinsky and Milhaud, in which one layer stays in one key while another stays in a second, is the simultaneous case; the alternating case is nearer to the sequential harmony of nineteenth-century development sections, where two-bar or four-bar units move by fifths or thirds.

The rule above says something about that repertoire which is worth stating as a prediction rather than a finding. A development section that moves its unit every two bars is, on this measurement, in no key at all as far as a histogram model is concerned — and that is a fair description of what a development section sounds like. One that moves every eight bars is in a succession of keys, three bars late.

Whether a listener’s own lag is anything like a rectangular window’s is not a question this collection can answer. What it can say is that the model’s lag is a property of the model’s window, so any listener who integrates over a longer span is later, and any listener who does not integrate at all is not doing this at all.

What the picture cannot show

The two keys are a fifth apart in every figure, and the section above runs the sweep that the rest of the essay assumed. A fifth is the closest relation there is and it is not the hardest case; the pair two steps round the circle is, and the tritone is the easiest. What the figures show is therefore a middling case rather than a worst one.

The progression is one progression. I–IV–V–I is maximally tonal and defines a key in as few chords as anything can. A progression that wandered would push every number the other way, and the two-bar result — that a fragment is not in a key — is a fact about this fragment.

The alignment search can flatter the model. Maximising over a shift is the right way to separate lateness from error, and it also guarantees the aligned score is never below the raw one. The lag values are the honest part of it; the aligned scores are upper bounds.

And nothing here is a listener. Category boundaries barely move with expectation and a key is a much larger object than a category, so whatever a listener does with an alternation, there is no reason to think it is a rectangular window over a histogram. The rule above is a rule about a published algorithm, and the algorithm’s value is that it is explicit.

Where this ladder goes next

Seven rungs. Keys are neighbours and the map is computed; the key plan is the form; three distance measures disagree; a modulation takes a measurable number of chords to detect; the circle is a circle and the map is not; two keys at once are not in the vocabulary; and now, two keys in alternation are followed above a rate the window fixes and are invisible below a block length the progression fixes.

The rung after it is the one the last section names, and it is the first in this ladder that would need a different kind of model. Every method here begins by throwing order away. A key-finder that kept it — one that scored a sequence of chords against a grammar rather than a bag of pitch classes against a profile — would be able in principle to tell an alternation from a simultaneity, and the interesting question is not whether it could but how much it would cost: the histogram model has twenty-four hypotheses and a sequence model has as many as its grammar admits. That trade, between what a model can distinguish and how many hypotheses it must carry, is the same one the pair model paid when it went from twenty-four candidates to three hundred.

Part 7 of 21

One essay in the series on Key-relations. The essays either side of this one:

What links here

Essays that reach for this one mid-argument — the half of a link its own author cannot write down.

What this makes readable

Essays that declare this one a prerequisite.

The objects named here

The third way in, after the field and the series: the things themselves, and every essay that touches each one.

AmbiguityBitonalityKey-findingKrumhansl schmucklerModulationPitch-class profileTonicWindow