Musical style as a first-order graph

One piece, 144 numbers, no music theory. A first-order graph identifies its style 70.9% of the time across six corpora.

The construction

Take a melody and throw away almost everything. Keep only which scale degree follows which. Twelve nodes, one per degree relative to the piece's own tonic; a weighted edge for every note-to-note move; rows normalised so each node's outgoing weights sum to one.

One piece becomes one 12×12 table. That is 144 numbers, and it is the whole representation: no key analysis, no phrase segmentation, no contour or interval features, no hand-designed musicology of any kind. Rhythm is discarded. Register is discarded. Everything but the local step is discarded.

The question is how much style survives that.

144 numbers name the composer

Across 1,000 monophonic pieces in six corpora, a plain multinomial logistic regression reading only the transition table places an unseen piece in the right corpus 70.9% of the time under five-fold cross-validation. The majority-class baseline is 20%.

The errors carry as much information as the hits. Read the rows:

true \ predictedBach choraleEssen folk songMonteverdiPalestrinaRyan's fiddleTrecento
Bach chorale 66%9%2%20%2%2%
Essen folk song 16%62%2%4%13%4%
Monteverdi 1%4%80%11%0%3%
Palestrina 20%4%0%71%2%3%
Ryan's fiddle 4%8%0%2%82%2%
Trecento 5%4%0%19%5%67%
Five-fold cross-validated confusion, row-normalised. Diagonal shaded; off-diagonal confusions of 10% or more shaded lightly.

Bach and Palestrina trade places 20% of the time in each direction — two chorale-writing traditions two centuries apart, separated by voice-leading conventions that a memoryless graph is not equipped to see. Folk song and fiddle tune confuse at 13–16%. Trecento song leaks 19% into Palestrina. Monteverdi and fiddle tune never confuse at all, in either direction.

Nobody drew that map. It is a picture of stylistic kinship that falls out of 144 transition probabilities per piece.

Why first order, specifically

Not as a simplification for presentation. In this data it is the only order at which the object is a graph at all.

An 89-note Bach chorale visits 10 distinct first-order nodes and spends 89% of its steps revisiting ones it has already been to. Give each node a memory of three preceding notes instead of none, and the same chorale visits 81 nodes with a 6% revisit rate — a path, not a graph, and very nearly a transcription of the piece itself.

Revisiting is the precondition for every tool worth bringing: a stationary distribution, a mean return time, a spectrum, a symmetry group, a community structure. First order is where graph theory still has purchase on the object, and that is an argument for studying it rather than an apology for it.

What a memoryless graph cannot do

It carries a style's vocabulary but not its syntax. In a blind A/B test — one real excerpt against one first-order generation sharing its exact rhythm, pitch content the only cue — an LLM judge picked out the real excerpt 96–100% of the time, against 60% on a real-versus-real control. The note-to-note statistics are right. The sentences are not.

The failure is specific and it is the interesting part: what the first-order graph is missing is everything that depends on where you are in the piece rather than which note you just played.

What memory buys, and what it costs

Let a node remember two notes instead of one and structure appears that the memoryless graph provably cannot represent. Running community detection on the resulting network recovers partitions that align with human analysts' key-region annotations at an adjusted mutual information of 0.16–0.32, against roughly zero at first order. Modulation — a piece changing key underneath itself — is invisible to a graph without memory and legible to one with it.

The cost is the degeneration above: push the order up uniformly and the graph stops being a graph. So the question I am working on is not what order to use but which contexts earn their memory — a variable-order construction in which a node is promoted to remember an extra note only when that note changes what follows.

That promotion rule turns out to have two defensible and non-equivalent forms. Promote where the longer context disagrees with the shorter one, and you maximise information: this predicts better, measurably so. Promote where both are confident, and you isolate the style's fixed idioms: the figures a tradition repeats verbatim, which the first rule discards precisely because they are predictable. A graph labelled by both — where memory buys information, and where it marks formula — is, I think, the object worth having.

A related line asks what a smaller alphabet buys. On pentatonic repertoire the first-order graph separates structural from ornamental tones by an order of magnitude in mean return time, with no scale knowledge supplied; and the modes of that repertoire turn out to be approximately one graph acted on by a rotation, which would let five sparse graphs be pooled into one dense one. Write-up to follow.

Reproduce it

The classification result above is 40 lines. It is published here in full so the claim can be checked rather than taken:

It expects seqs_v2.json, a {style: [{"tonic", "mel"}]} dump produced with music21 from six public symbolic corpora: the Bach chorales, Palestrina, Monteverdi, the Trecento repertoire, the Essen Folksong Collection, and Ryan's Mammoth Collection of fiddle tunes. No tuning was done and no held-out set was touched twice; the number above is what the script prints on a first run.

Written with AI assistance and checked by hand. Computation used the Rochester Institute of Technology Research Computing cluster, DOI 10.34788/0S3G-QD15.