Rhythm and metre

The note that has a length

Every melodic figure so far reads a table where each note is a pair — a pitch and a duration — and throws the second number away. A step between two minims and a step between two quavers have been one event in every histogram it has drawn. Weighting the same statistics by time moves the step distribution by up to seven points, changes forty-four of a hundred and one contour signs, and turns up an off-by-one in the one figure that did use the durations: it took the length of the note arrived at where the time between two onsets is the length of the note left.

Assumes: A melody is a walk, not a set · The shape that survives everything else

The melody ladder opened by declaring that a tune is a path rather than a set, and then drew five essays of paths that had no time in them.

That is not a figure of speech. The three tunes this collection carries are stored as lists of pairs — a pitch and a number of beats — and every statistic the ladder computed reads the first number of each pair and discards the second. A step from a minim to a minim and a step from a semiquaver to a semiquaver were one event in the histogram. A contour class was computed over the notes in order, with no account of how long each of them lasted.

The ladder said so when it closed, and named the debt. This essay pays it, and one of the three things it found was a bug.

The durations were there all along

Worth being precise about the shape of the omission, because it is the kind that leaves no trace. The data was never incomplete. Nothing had to be measured, transcribed or looked up: the second column was entered with the first, is printed in every figure that draws a stave, and was simply not read.

Written out on a stave, a tune’s notes carry their lengths as part of the notation — the one dimension the stave is a ruler for is not this one and every figure in this ladder before this rung threw them away — which is the omission the whole essay is about, and it is an omission in the analysis rather than in the source.

Two things follow from that, and they point in opposite directions. The good one is that nothing has to be re-collected: every figure below is a re-reading of data the ladder already had, so there is no new source of error and no new corpus problem beyond the one the ladder already recorded. The bad one is that an omission of this kind is completely invisible from inside. A statistic computed over the wrong column of a table renders perfectly, has a plausible value, and is checked by nothing — which is the same shape as the three stable wrong measurements this ladder found while it was being written, and is the reason the debt was written down rather than left as an intention.

Counting by the clock

The first statistic to redo is the one the ladder is built on: how often each size of step occurs.

The same steps, counted by the clock. The step distribution of Ode to Joy and Twinkle, twinkle and Frère Jacques counted two ways: once per interval, which is what every earlier figure did, and once weighted by how long the note it leaves is held. The two disagree because a tune's long notes are not distributed evenly over its interval sizes — in Ode to Joy the 2-semitone step is 55.2 per cent of the moves and 60.0 per cent of the time. Which of the two a claim about melodic motion means has never been stated here, and the answer matters most exactly where a tune slows down, which is at the ends of its phrases.
Fig. 1 The step distribution of all three tunes, counted twice: once per interval, which is what was done before, and once weighted by how long the note being left is held. The two disagree everywhere and by different amounts. In Frère Jacques a repeated note is 12.9 per cent of the moves and 20.0 per cent of the time; in Ode to Joy the whole-tone step is 55.2 per cent of the moves and 60.0 per cent of the time.

The disagreements are between three and seven percentage points, which is not enormous and is not nothing. The tempting next move is to claim a direction — that long notes are approached by step, that phrase endings are conjunct, and that counting by time therefore makes a melody look smoother than counting by note does. That is wrong, and the way it is wrong is the same mistake this essay finds in the streaming figure four sections below.

Summing the steps of two semitones or fewer gives the conjunct fraction of each tune under both weightings:

by count by time
Ode to Joy 100.0% 100.0%
Twinkle 90.2% 87.0%
Frère Jacques 64.5% 60.0%

Time-weighting makes these tunes look less conjunct, not more, on the two of the three where the number can move at all. Ode to Joy cannot move: every one of its intervals is already two semitones or fewer, so it is 100 per cent conjunct under any weighting and tests nothing. On the other two the leaps gain — Twinkle’s fourth and fifth both rise, by 1.9 and 1.4 points, and Frère Jacques’ minor third rises by 3.4.

The reason is the direction along the table, and it is exactly the confusion this essay was written to catch. The weighting assigns each interval the duration of the note it leaves. A long note at the end of a phrase is therefore credited to the interval departing from it — which is the jump back up to the start of the next phrase, not the step that arrived at the cadence. The reasoning about approach is about the note arrived at; the measure is about the note left. They are off by one along the tune, in the same sense and for the same reason as the streaming bug below.

There is an obvious repair available, which is to weight each interval by the note it arrives at instead — the weighting the “approached by step” reasoning actually describes. Running all three weightings side by side:

conjunct fraction by count by the note left by the note arrived at by the mean of the two
Ode to Joy 100.0% 100.0% 100.0% 100.0%
Twinkle 90.2% 87.0% 91.5% 89.2%
Frère Jacques 64.5% 60.0% 59.7% 59.8%

The repair does not repair it. Under the arrival weighting Twinkle does become more conjunct, by 1.3 points, exactly as the reasoning predicts — and Frère Jacques becomes less conjunct, by 4.8, which the reasoning forbids. Two tunes, two directions, under the weighting chosen to produce one direction. Frère Jacques’ long notes are at the ends of its short phrases and the note after each of them begins a new phrase a fourth away, so both of its neighbours are leaps and no choice of which side to credit can make the tune look smoother.

So the honest statement is the one without a direction in it. The two histograms are measurements of two different things, they differ by several points, and which one an argument wants depends on whether the argument is about events or about the sound. What cannot be said from three tunes is which way the difference goes in general, because on these three it goes both ways under every weighting tried, and one of the three is degenerate.

How big a melody's moves are. The absolute size of every melodic interval in Ode to Joy, Frère Jacques, as a fraction of that melody's moves. Ode to Joy puts 100 per cent of its motion inside two semitones and never exceeds 2; Frère Jacques puts 65 per cent of its motion inside two semitones and never exceeds 7. The distributions are of the melodies named and of nothing else: three tunes are an illustration of the shape, not a measurement of it.
Fig. 2 The by-count version alone, which is the figure the earliest essay used. Every conclusion drawn from it — that melodic motion is overwhelmingly small, that the tail is thin, that the distribution is the input to the null model — survives the reweighting. What does not survive is any claim about a proportion, because there are now two of them.

The contour, which moves a great deal

The second statistic is the one the third rung is entirely about: the sign sequence.

A contour is normally taken over the notes in order. A listener does not receive notes in order at a constant rate; they receive them in time, and the amount of time a given pitch is present is the duration of the note. So there are two contours available and they are not the same object.

The same steps, counted by the clock. The step distribution of Ode to Joy and Twinkle, twinkle counted two ways: once per interval, which is what every earlier figure did, and once weighted by how long the note it leaves is held. The two disagree because a tune's long notes are not distributed evenly over its interval sizes — in Ode to Joy the 2-semitone step is 55.2 per cent of the moves and 60.0 per cent of the time. Which of the two a claim about melodic motion means has never been stated here, and the answer matters most exactly where a tune slows down, which is at the ends of its phrases.
Fig. 3 The same two tunes at half the tempo, which shows that the disagreement is not a tempo artefact. Counted per interval the step distributions are one thing; counted weighted by how long the note it leaves is held they are another, and the difference does not move when the clock does — because a tune’s long notes are not distributed evenly over its steps, and that is a property of the tune rather than of how fast it is played. Halving the tempo doubles every duration and leaves every ratio of durations alone, which is exactly what the weighting depends on.

Forty-four of a hundred and one is a big number and it needs the right reading. The clock-sampled contour has a run of equal signs wherever a long note is held, which is a different object from the shape a listener keeps, because a held pitch sampled twice produces no change; so the disagreements are concentrated at exactly the notes that carry the rhythm, and they are mostly of the form “a step, by note” against “no change, then a step, by clock”.

That is worth stating as a general property rather than a curiosity. Sampling by clock inserts repetitions wherever the music slows down. A contour taken that way is therefore partly a rhythm profile, which is either the intended measurement or a contamination, depending on the question.

The nine-way class surviving all three is the reassuring half, and it is the same finding the shape rung reached under four other transformations: whatever contour is measuring, it is coarse enough not to care. The census of a quarter of a million sequences that produced the arch result is a census over note-indexed contours, and the result would survive being redone the other way because it is a statement about classes.

There is a third contour available and it is worth naming even though nothing here computes it. A listener does not sample at a constant rate either: attention is not uniform in time, and what is retained of a passage is weighted toward its boundaries. A contour weighted by attention would differ from both of the two above, and there is no principled way to build one from a score.

The figure that did use the durations, and used the wrong one

There is exactly one place in the ladder where the second column was read, and it is the first rung’s headline figure: whether an interval holds together as one stream depends on how fast the notes are coming, and how fast they are coming is a duration.

Twinkle, twinkle as a path. Twinkle, twinkle plotted as 42 notes against the 10 scale degrees it uses, one column per note. Its largest melodic interval is 7 semitones and it spans 9; the mean absolute step is 1.46 semitones. “Ah! vous dirai-je, maman”, French, printed 1761 — six bars, the outer strain and its middle. Intervals are marked with whether they stay one stream at 120 notes a minute: 0 of 41 exceed the coherence boundary.
Fig. 4 Twinkle with each interval marked by whether it stays one stream at the rate the tune is going. The verdict for each interval needs a tone repetition time, and the tone repetition time is the gap between the two onsets.

The gap between the onset of note i and the onset of note i + 1 is the duration of note i — the note being left. The figure was reading the duration of note i + 1, the note being arrived at.

That is an off-by-one along the tune. It is wrong on every interval whose two notes have different lengths, which is seven of Ode to Joy’s twenty-nine, eleven of Twinkle’s forty-one and ten of Frère Jacques’ thirty-one.

How big a melody's moves are. The absolute size of every melodic interval in Ode to Joy, Twinkle, twinkle, Frère Jacques, as a fraction of that melody's moves. Ode to Joy puts 100 per cent of its motion inside two semitones and never exceeds 2; Twinkle, twinkle puts 90 per cent of its motion inside two semitones and never exceeds 7; Frère Jacques puts 65 per cent of its motion inside two semitones and never exceeds 7. The distributions are of the melodies named and of nothing else: three tunes are an illustration of the shape, not a measurement of it.
Fig. 5 The step sizes without the cumulative reading, which is where the three tunes differ most. Ode to Joy puts 100 per cent of its motion inside two semitones and never exceeds them; Twinkle’s opening is a fifth; Frère Jacques sits between. A distribution that is entirely steps and a distribution with a leap in it are different objects to every streaming argument, and the duration weighting moves all three by different amounts because the leaps and the long notes do not coincide.

The verdict moves on zero of the hundred and one intervals, and the reason it moves on none is the same reason the first rung’s conclusion holds: these tunes are made almost entirely of steps, and a step of one or two semitones is far below the coherence boundary at every rate a tune uses. The bug is real, it has been fixed where it was rather than worked around here, and its effect is nil — which is a statement about the tunes and not about the code.

It is worth saying what would have been needed to make it visible. The boundary rises steeply with the repetition time, from about 4.4 semitones at sixty milliseconds to 14.5 at a hundred and sixty; a tune with wide leaps whose notes alternate between very short and very long would put intervals on both sides of it, and the two readings would then disagree about whether the line splits. Nothing in this collection’s corpus does that. A trill against a held note does, and that is a texture rather than a melody.

Three tones inside a small span are heard as one line and the same three with one displaced by an octave split into two — so where a tune’s leaps are decides whether it is one stream, and a leap onto a long note is a different proposition from a leap onto a short one.

The general lesson is worth extracting, because this collection will hit it again. A quantity that a model reads from a table has a direction along the table, and an off-by-one along that direction is not a type error. It produces numbers of the right magnitude in the right units, and the only things that catch it are a symmetry check or a case where the two readings disagree loudly. Here there was neither: the tunes are too smooth to disagree and the quantity has no symmetry to violate. It was found by writing a second function that computes both readings and prints the difference, which is now kept as the check rather than deleted.

What the null models still do not have

The other half of the ladder is the walk, and the walk has no time in it at all — not the wrong time, none.

Ode to Joy as a path. Ode to Joy plotted as 30 notes against the 8 scale degrees it uses, one column per note. Its largest melodic interval is 2 semitones and it spans 7; the mean absolute step is 1.24 semitones. Beethoven, Ninth Symphony, finale, 1824 — the theme as first stated, eight bars. Intervals are marked with whether they stay one stream at 120 notes a minute: 0 of 29 exceed the coherence boundary.
Fig. 6 The tune the duration weighting changes least, drawn as a path. Thirty notes over eight degrees, a largest interval of two semitones and a mean absolute step of 1.24 — so nearly every note is the same length and nearly every step the same size, and weighting by duration barely moves anything. That is the control the comparison needs: a tune whose durations are flat is a tune where the old figures were right, and the two tunes whose durations are not flat are the ones this essay corrects.

Adding durations to the walk would not be hard, and the reason not to is worth stating: the walk exists to be the dullest thing that could produce the observation, and every parameter added to it weakens that. A walk with a duration distribution has two distributions fitted to the data instead of one, and the argument that a bounded walk reproduces post-skip reversal gets correspondingly less impressive.

But the corpus statistics the walk is compared against are themselves note-indexed, so the comparison is at least consistent. The debt this leaves is not the model; it is that nobody knows whether the published reversal figures are note-weighted or time-weighted, because no paper says, and on these three tunes the difference between the two is several points.

And a bar of eight with a weight on each position is what a metrical reading supplies: a note on a strong beat is heard as more important than one on a weak beat regardless of its length, which is a third weighting the distributions here do not have.

Read as a rate rather than as a sequence, the same steps sit far below the boundary at which a succession becomes a texture — so nothing in this essay is near the region where durations stop being durations.

The same steps, counted by the clock. The step distribution of Ode to Joy and Twinkle, twinkle and Frère Jacques counted two ways: once per interval, which is what every earlier figure did, and once weighted by how long the note it leaves is held. The two disagree because a tune's long notes are not distributed evenly over its interval sizes — in Ode to Joy the 2-semitone step is 55.2 per cent of the moves and 60.0 per cent of the time. Which of the two a claim about melodic motion means has never been stated here, and the answer matters most exactly where a tune slows down, which is at the ends of its phrases.
Fig. 7 And at a fast tempo, which is where a fourth weighting would start to matter. At 180 the shortest notes in these tunes are around 160 milliseconds — close to the length at which a note’s own duration limits how finely its pitch can be placed — so a duration-weighted step distribution and a resolution-weighted one would start to differ. Neither is computed here. The distributions on this page weight a note by how long it lasts and not by how well it could be heard, and those are the same thing only while every note is long enough.

Which computation produced the numbers

The time-weighted histogram assigns each interval the duration of the note it leaves and divides by the total time of all the intervals — which is the whole tune minus its last note. The by-count histogram divides by the number of intervals. Both are computed from the same list of pairs in the same function, so the two columns cannot drift apart.

The three-weighting table is the same sum with the index shifted: the note left is row i, the note arrived at is row i + 1, and the mean is the average of the two inter-onset intervals. Writing all three was the point rather than choosing between them. The off-by-one this essay found in the streaming figure was found the same way — by computing both readings and printing the difference — and the conjunctness claim was wrong for want of the same two lines. A quantity indexed along a sequence should be computed both ways by default and the difference reported, because the cost of doing so is one line and the cost of not doing so is a number that renders correctly and means something else.

The clock-sampled contour takes as many samples as the tune has notes, at equal intervals over the tune’s whole duration, and reads the pitch sounding at each. That choice of sample count is what makes the two sequences the same length and therefore comparable position by position.

It was previously recorded here that sampling more finely changes the count of disagreements and not their location. That is not something this function can be asked. Above one sample per note it resamples the note-indexed contour as well, to keep the two sequences the same length, so a denser comparison is between two resamplings rather than between a note contour and a clock contour — the disagreement fraction duly falls, from 44 per cent of positions at one sample a note to about 16 at eight, and the fall is a property of the resampling and not of the tunes. Testing the claim properly needs a different function, one that maps each differing sample back to the note sounding there and compares the sets of notes implicated. That is not written, and the claim is withdrawn rather than restated.

The streaming comparison runs both readings side by side and reports the number of intervals whose tone repetition time differs and the number whose verdict differs. The second is zero on all three tunes at 120 beats a minute, and it stays zero at 60 and at 200.

The tempo of 120 beats a minute is a stated default and every duration in seconds scales with it. The step histogram does not depend on it at all, because it is a ratio of times.

What the picture cannot show

Three tunes is not a corpus, and this essay’s numbers are less robust than the ladder’s earlier ones rather than more, because a time weighting is dominated by a handful of long notes and there are perhaps six of them in the whole collection. Every percentage here could move several points on a fourth tune — and the section on conjunctness above shows the corpus is not merely small but inconsistent: the sign of the effect differs between the two tunes on which it can be measured at all. A quantity whose direction is not settled by the whole corpus cannot be reported as a tendency, and the honest use of these figures is as a demonstration that the two weightings differ rather than as an estimate of how.

The stored durations are notated, not performed. A minim in the table is exactly twice a crotchet, and no performance has ever done that — the deviations from the grid are the groove and they are of the order of tens of milliseconds, which is comparable to the effects being measured here at fast tempi. A time-weighted statistic taken from a score is a statistic about a score.

There are no rests. All three tunes are stored as continuous runs of notes, so a note’s duration and the gap to the next onset are the same number. In real music they are not, and the distinction matters for exactly the boundary question the phrase ladder is about.

The clock-sampled contour is one of many. Sampling at the note rate is a choice; sampling at a fixed number of milliseconds is another, and the psychological present has a width that would be a third and better-motivated one. The figure uses the first because it is the one that produces two sequences of equal length, which is what makes them comparable at all.

And nothing here weights by loudness or by metrical position, both of which are at least as good candidates for “how much this note counts” as duration is. Duration was chosen because it was the number already in the table.

The ladder from here

This rung paid the first of the three debts the ladder recorded. The next pays the second: contour survives every transformation because it is what a listener retains, and the compression the census measured is the same quantity as the memory load — so the question of what part of a tune is kept can be asked as an information count rather than as an intuition.

Part 6 of 8

One essay in the series on melody. 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.

The objects named here

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

ContourDurationInter-onset intervalMelodic intervalNull modelQuantisationStreamingTemporal coherence