Lognormals, Power Laws and Double Power Laws in the Distribution of Frequencies of Harmonic Codewords from Classical Music

Marc Serra-Peralta, Joan Serrà, √Ålvaro Corral · DOI

TL;DR

While classical music appears to follow a "universal" Zipf-like distribution at first glance, rigorous statistical analysis reveals a more complex reality. By analyzing harmonic "codewords" across 76 composers, researchers found that no single mathematical law—be it power law, lognormal, or double power law—universally describes musical vocabulary; instead, the "best" distribution varies by composer and shifts over historical time.

What Problem Does This Paper Address?

In linguistics, Zipf’s law is a famous empirical observation: the frequency of any word is inversely proportional to its rank in the frequency table. Since music is often described as a "language," researchers have long sought to find a similar universal scaling law within musical structures.

However, music is multidimensional (melody, harmony, rhythm), making it difficult to define what a "word" actually is. Previous studies often suffered from small datasets or lacked statistical rigor, frequently relying on visual "eyeballing" of plots rather than formal goodness-of-fit tests. This paper addresses the gap by applying high-standard statistical physics methodologies to a massive corpus of classical music to determine if a universal law actually exists.

Methods

The authors developed a pipeline to turn music into quantifiable "vocabulary":

  1. Harmonic Codewords: They converted MIDI scores into 12-dimensional binary vectors. Each bit represents one of the 12 pitch classes (C, C#, etc.) in a chromatic scale. If a note is played during a specific beat, its bit is "1"; otherwise, it's "0."
  2. Normalization: To compare different pieces fairly, they transposed all major-key pieces to C major and minor-key pieces to A minor.
  3. Statistical Fitting: They compared three candidate distributions:
  4. Simple Power Law (PL): The classic Zipfian model.
  5. Truncated Lognormal (LN): A common alternative to power laws in complex systems.
  6. Double Power Law (DPL): A more flexible model that allows for two different power-law regimes (a "body" and a "tail") connected at a transition point ($\theta$).
  7. Rigorous Testing: They used Maximum Likelihood Estimation (MLE) and Kolmogorov-Smirnov tests. Crucially, they set a strict acceptance threshold ($p$-value > 0.20), much higher than the standard 0.05, to ensure the fits were truly robust.

Datasets

The study utilized the Kunstderfuge database, a large collection of MIDI scores.

  • Initial size: 17,419 MIDI files.
  • Final cleaned dataset: 9,327 files from 76 classical composers, spanning from the 15th century (Dufay) to the 20th century (Messiaen).
  • Global Corpus: An aggregated dataset of all composers representing "classical music" as a whole, totaling over 5 million tokens (beats).

Key Insights and Ideas

  • The Illusion of Universality: When you rescale the data and look at it qualitatively, all composers seem to follow a similar curve. However, the quantitative "best fit" tells a different story. Universality fails under the microscope.
  • The Double Power Law Emerges: The authors introduce the DPL as a strong contender. It suggests that musical harmony has two distinct statistical regimes: one for common, "functional" chords and another for rare, "ornamental" or complex harmonic events.
  • Historical Shift: There is a chronological trend in which distribution fits best. The Double Power Law slightly dominates the first half of the timeline (pre-Beethoven), while the Lognormal distribution becomes more prevalent in the Romantic and Modern eras.
  • Zipf is the Exception, Not the Rule: Only about 12% of composers are best described by a strict Zipfian power law.

Key Results

  • Lognormal (LN) provided a "good fit" for the highest number of composers (88%).
  • Double Power Law (DPL) provided a "good fit" for 63% of composers.
  • Simple Power Law (PL) trailed behind at 28%.
  • Model Selection: When forced to choose the "best" fit (the one explaining the largest portion of the data), the results were nearly split: 35 composers were best described by Lognormal, and 33 by the Double Power Law.
  • The "Double Zipf": In the DPL models, the tail exponent ($\beta_2$) often hovered around 2.0, which aligns with the traditional Zipfian exponent, but only for the high-frequency "tail" of the distribution.

Limitations and Future Work

  • Discretization Sensitivity: The process of turning continuous audio/scores into binary "1s and 0s" involves an arbitrary threshold (0.1 in this study). While the authors tested for robustness, different thresholds might shift the results.
  • The "Unphysical" Jump: The DPL model assumes a sudden, sharp change in exponent at the transition point $\theta$. The authors suggest that a "Smoothed Double Power Law" (SDPL) using incomplete beta functions might be more realistic but requires more parameters.
  • Temporal Units: The study uses the "beat" as the fundamental unit of time. Future work could explore how these distributions change if the "word" is defined by measures or melodic phrases instead of single beats.
  • Sample Size: Composers with fewer pieces in the database (low $L$) tended to favor the Simple Power Law, likely because there wasn't enough data to resolve the more complex Double Power Law structure.

Summary updated

BibTeX
@inproceedings{serraperalta2022lognormals,
  author = {Marc Serra-Peralta and Joan Serrà and √Ålvaro Corral},
  title = {{Lognormals, Power Laws and Double Power Laws in the Distribution of Frequencies of Harmonic Codewords from Classical Music}},
  booktitle = {Scientific},
  year = {2022},
  doi = {10.1038/s41598-022-06137-3},
}
Figure