Heaps' Law and Vocabulary Richness in the History of Classical Music Harmony

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

Abstract

Music is a fundamental human construct, and harmony provides the building blocks of musical language. Using the Kunstderfuge corpus of classical music, we analyze the historical evolution of the richness of harmonic vocabulary of 76 classical composers, covering almost 6 centuries. Such corpus comprises about 9500 pieces, resulting in more than 5 million tokens of music codewords. The fulfilment of Heaps' law for the relation between the size of the harmonic vocabulary of a composer (in codeword types) and the total length of his works (in codeword tokens), with an exponent around 0.35, allows us to define a relative measure of vocabulary richness that has a transparent interpretation. When coupled with the considered corpus, this measure allows us to quantify harmony richness across centuries, unveiling a clear increasing linear trend. In this way, we are able to rank the composers in terms of richness of vocabulary, in the same way as for other related metrics, such as entropy. We find that the latter is particularly highly correlated with our measure of richness. Our approach is not specific for music and can be applied to other systems built by tokens of different types, as for instance natural language.

Quantifying the Evolution of Musical Language

In linguistics, Heaps' law describes a fundamental relationship: as a text grows longer, the number of unique words (vocabulary size, $V$) increases following a power law $V = K L^\alpha$. While this statistical regularity is well-established for natural languages, applying it to music presents a unique challenge. Unlike text, music lacks predefined "words." Furthermore, comparing the harmonic diversity of a prolific composer like Bach to one with a smaller surviving body of work requires a metric that accounts for the total volume of output.

This research addresses these challenges by defining a discrete "harmonic vocabulary" and developing a relative richness metric ($R$) based on Heaps' law. By analyzing the Kunstderfuge corpus—spanning nearly 9,500 pieces from 76 composers over six centuries—the study reveals how the complexity of musical harmony has evolved from the Renaissance to the modern era.

Methodology: Constructing the Harmonic Vocabulary

To analyze music through the lens of information theory, the researchers first converted MIDI files into sequences of discrete tokens. This process involves collapsing notes into 12 pitch classes (ignoring octaves) and dividing pieces into discrete time frames based on beats.

Conversion of MIDI scores into discrete chromagrams and binary codewords.

Each beat is represented as a 12-dimensional binary vector, or "music codeword," indicating which pitch classes are active. To ensure a fair comparison of harmonic function rather than absolute pitch, all pieces were transposed to a common key (C major or A minor). This methodology resulted in a dataset of over 5.1 million tokens and a total vocabulary of 4,085 unique chords.

Results: The Steady March of Harmonic Complexity

The study confirms that music follows Heaps' law, though with a scaling exponent ($\alpha \simeq 0.35$) significantly lower than that of natural language ($\alpha \ge 0.5$). This suggests that musical vocabulary expands more slowly than linguistic vocabulary as the total length of the work increases.

By calculating the relative richness ($R$)—the standardized residual from the Heaps' law regression—the researchers were able to track harmonic diversity across time. As shown in the following figure, there is a striking, linear increase in harmonic richness from the 14th to the 20th century.

Evolution of harmonic vocabulary richness (R) across six centuries of classical music, showing a clear linear trend.

Key findings include:

  • Historical Trend: Harmonic richness increases by approximately 0.72 standard deviations per century. This suggests a steady, predictable expansion of the harmonic palette rather than erratic stylistic jumps.
  • Composer Rankings: Modernist and late-Romantic composers like Paul Hindemith and Sergei Rachmaninoff exhibit the highest relative richness, while Renaissance composers like Tomás Luis de Victoria score the lowest.
  • Entropy as a Proxy: The richness metric $R$ correlates strongly ($\rho \approx 0.95$) with Shannon entropy, indicating that the diversity of a composer's chord distribution is a robust indicator of their harmonic complexity.

Conclusion and Future Directions

While this study focuses on pitch-class harmony and ignores nuances like rhythm or dynamics, it provides a powerful quantitative framework for musicology. The linear trend in harmonic richness offers a mathematical perspective on the history of Western classical music. Beyond music, the relative richness metric $R$ provides a scalable tool for comparing vocabulary diversity in any system composed of discrete tokens, from literature to genetic sequences.

Summary updated

BibTeX
@article{serraperalta2021heaps,
  author = {Marc Serra-Peralta and Joan Serrà and Álvaro Corral},
  title = {{Heaps' Law and Vocabulary Richness in the History of Classical Music Harmony}},
  journal = {EPJ Data Sci.},
  year = {2021},
  doi = {10.1140/epjds/s13688-021-00293-8},
}
Figure