The hidden grammar inside a melody is made of transformations
Across 852 keyboard works, motifs reuse a smaller vocabulary than chance predicts—and their transformations reveal how composers make ideas travel.
97%+ of melodies used fewer motif families than content-matched controls predicted.
Across 852 keyboard works, at least 97% of melodies drew on a narrower vocabulary of short musical ideas than carefully constructed chance versions did. The difference was not simply that composers reused the same notes. The study counted a motif as the same idea even when it was transposed, inverted, played backward or shifted around within its window. That makes a familiar musical intuition measurable: a melody can change its surface and still feel like itself.
The result offers a way to ask not just what notes a composer used, but how musical ideas move. In the corpus, recurring motifs were transposed 1.6 times as often as in randomized versions of their forms. Transpositions by a fourth or fifth were especially common—2.8 times the random rate. Such intervals are familiar landmarks in tonal music, but the point here is not that every composer followed a rule. It is that a broad statistical preference appears across a large collection, and changes across periods and forms.
The Science
Alfredo González-Espinoza’s study treats a melody as a sequence of pitch classes: notes reduced to their place within the twelve-note chromatic scale, without distinguishing octaves. It then scans that sequence with overlapping windows of three to six notes. Each small window is a candidate motif, and each is compared with every other under four transformations: transposition to another pitch level, inversion around a pitch axis, retrograde (playing the notes backward), and cyclic shift (moving the starting point around the window).
If one window can be turned into another by these operations, the analysis groups them into the same orbit—a mathematical term for a family of transformed versions. The orbit is the motif’s vocabulary entry; the individual versions are its possible ways of appearing. For a listener, this is close to recognizing a theme when it returns in a new key or direction. For the analysis, it means that a sequence of notes is not automatically a new idea just because its pitches differ.
This distinction lets the paper separate two things that ordinary note-by-note counting blends together. Orbit entropy measures how many motif families a melody uses and how evenly it distributes its attention among them. The second measure, called deployment, asks how many transformed versions of each family actually appear. A melody can therefore have a compact vocabulary but use each idea in several guises, or a wide vocabulary in which each motif appears just once.
The framework also records internal symmetry. A motif is symmetric if one or more of the transformations leave it unchanged: a palindrome, for instance, survives retrograde. Most motifs can be transformed into many distinct forms; a symmetric one has fewer unique versions because some operations bring it back to itself. In group theory, the operations that leave an object unchanged form its stabilizer. The terminology is abstract, but the question is concrete: what kind of transformations does this musical figure tolerate without changing?
The researchers apply the window analysis to 852 solo keyboard pieces, balanced across four historical periods, and compare real melodies with surrogate sequences. These controls preserve different features—pitch content, spectral structure, or one-step transitions—while disrupting other aspects of organization. A further “within-orbit” shuffle preserves the motif families and their forms but rearranges how they are deployed, helping isolate whether particular transformations are favored beyond the vocabulary itself.
The study also examines whole phrases and themes already marked out by human annotators, including folk phrases and instrumental themes. Unlike a sliding window, a full phrase is assessed as one object, with exact symmetry counted directly. Those passages are compared with rearrangements of their own notes, so a phrase’s note inventory is held constant while its order changes. This second analysis asks whether people’s selected musical phrases are unusually symmetric—not merely whether symmetry is possible.
What They Found
The broadest result is that real melodies are not just random collections of locally plausible notes. For windows of four or more notes, at least 97% of the melodies had lower orbit entropy than surrogate comparisons that preserved important properties of their pitch material. In plain terms, real pieces repeatedly return to a more concentrated set of ideas than those controls would lead us to expect. The pattern survives several different definitions of what a surrogate should retain.
That result does not mean that every melody is built from a handful of obvious repeated phrases. The orbit space grows rapidly as windows get longer: after the four transformations are taken into account, there are 19 possible motif families for three-note windows, 163 for four-note windows, 1,110 for five-note windows and 10,962 for six-note windows. Longer windows can describe more distinctive shapes, but a single piece contains too few examples to estimate a distribution over an enormous catalogue reliably. The researchers therefore focus on short motifs, where repetition can be measured rather than guessed.
How many motif families exist at each window length?
Theoretical count of distinct motif orbits after identifying transposition, inversion, retrograde and cyclic shift as transformations of the same idea.
| Label | Value |
|---|---|
| 3 notes | 19 orbits |
| 4 notes | 163 orbits |
| 5 notes | 1,110 orbits |
| 6 notes | 10,962 orbits |
The authors also found that motif organization depends on what kind of structure one measures. Historical periods differ in their motif vocabulary and in the mix of symmetry types. Musical forms differ in deployment: the degree to which a recurring idea appears in multiple transformed versions. That distinction matters. A form might not use fewer basic ideas, but it may be more likely to vary them; another may rely on a different balance of repetition and transformation.
The most striking clue about how motifs travel is the preference for transposition. Compared with random permutations of a piece’s forms, recurring motifs are transposed 1.6 times more often. If the move is specifically to a fourth or fifth, the rate rises to 2.8 times the random baseline. These are not counts of every note interval in the corpus; they describe the relationship between recurring windows that belong to the same motif family. That makes the finding about musical development, rather than simply about which intervals happen to be common.
Recurring motifs favor transposition
Observed recurrence relations relative to randomized arrangements of the same forms. A value of 1 represents the random-permutation baseline.
| Label | Value |
|---|---|
| Randomized baseline | 1 × |
| Transposition, any interval | 1.6 × |
| Transposition by a fourth or fifth | 2.8 × |
The preference is not fixed across music history. According to the paper, it weakens from the Baroque period toward the twentieth century, and also from Bach’s fugues to Shostakovich’s. In other words, a broad tendency toward transposed restatement does not erase stylistic change. The same operation can be central in one repertory and less pronounced in another. The analysis helps turn that contrast into something researchers can test across pieces instead of relying only on a few famous examples.
Exact symmetry tells a more qualified story. Folk phrases and instrumental themes are rarely perfectly symmetric: only 2–10% meet the study’s exact symmetry criterion. Yet such symmetry appears 1.6 to 5 times more often than in rearrangements of the same notes. It is uncommon, but not merely an accident of the notes available. The comparison also avoids a tempting but misleading conclusion: that because composers have mathematical tools for making palindromes or inversions, they use them constantly. In the selected phrases and themes, exact symmetry is the exception.
Why This Changes Things
Music theory has powerful ways to describe transposition, inversion and retrograde. But those ideas are often applied to a score, a small set of pieces, or a catalog of possible transformations. This paper shifts the emphasis from what transformations can be made to how often real music uses them. It offers a statistical map of the relationship between a motif’s identity and its changing forms.
That matters because musical recognition often depends on continuity through change. A phrase may return in a different key, with its notes reversed, or embedded in a cyclic pattern. If a researcher counts every version as a new sequence, the analysis can mistake transformation for novelty. If they collapse every version into one identity, they can miss how composers deploy that identity. Separating motif vocabulary from deployment preserves both sides of the story.
It also creates a bridge between close listening and large-scale comparison. The framework can ask whether a particular composer favors inversion, whether a dance form varies motifs differently from a fugue, or whether a historical shift changes how composers restate ideas. The reported differences across periods and forms show why this is more than a single “symmetry score” for a piece. A distribution of symmetry types and relations can be a stylistic signature, much as recurring visual patterns can help characterize an artistic tradition.
The study’s central claim is deliberately narrower than “music is mathematical.” It does not show that composers consciously chose transformations according to these statistics, or that listeners perceive every symmetry equally. The paper notes that people often recognize transposition more readily than inversion or retrograde. The measurements describe structure in scores, not the full experience of hearing them. A score can contain a relation that listeners overlook, and a performance can make a relation vivid or obscure it.
The approach may also travel beyond music. Any symbolic sequence can be studied this way if researchers can define transformations that preserve identity for their question. The paper points to parallels with canonical DNA sequences, network motifs and chemical structures: in each case, apparent differences can be grouped when a transformation leaves the relevant structure intact. The useful lesson is not that all these fields share the same kind of meaning. It is that a carefully chosen notion of sameness can reveal how a system reuses a limited vocabulary.
What’s Next
The most immediate next step is to test the framework across more than solo keyboard scores. This corpus spans four centuries and includes a range of forms, but a single extracted melodic line cannot capture everything that makes music relational. Imitation between voices, canons, tune families and the exchange of ideas between pieces sit outside the study’s present scope. A future analysis could track how one voice answers another, or how a theme migrates between works, while keeping the distinction between motif identity and transformed presentation.
There are also choices built into the measurement. The pitch data are reduced to twelve pitch classes, so octave, rhythm, articulation, timbre and expressive timing do not enter the motif identity used here. The windows overlap, which means adjacent observations share notes and are not statistically independent. The authors acknowledge that limitation and keep the analysis focused on descriptive comparison rather than treating the windows as isolated experimental trials. Different transformation rules or richer representations could change which passages count as the same idea.
The precise mechanisms behind the historical differences remain open. The reported weakening of transposition preferences from Baroque to twentieth-century music could reflect changes in compositional practice, repertory, form, or the way the corpus is assembled. Likewise, observed distinctions among forms do not by themselves explain why a dance, fugue or character piece deploys motifs in a particular way. The framework provides a way to sharpen such questions, not a final causal answer.
Still, the study gives researchers a useful new lens: a melody is not only a sequence of notes, but a population of ideas and the transformations through which they recur. Its findings suggest that composers reuse motifs more selectively than simple controls predict, while favoring some ways of changing them over others. Extending that lens to other repertoires—and eventually to relations among voices, performances and listeners—could help explain how musical identity survives change.
Sign in to join the conversation.
Comments (0)
No comments yet. Be the first to share your thoughts.