Automating Harmonic Analysis

Harmonic analysis is a central practice in music theory. In recent decades, many scholars have endeavored to automate harmonic analysis. In particular, numerous supervised machine-learning based approaches to harmonic analysis, and similar tasks, have been reported in the last decade. However, this "supervised" learning requires data with the "correct answer" to learn from—what machining learning researchers call the "ground truth." Unfortunately, the "correct answer" in harmonic analysis (and in many other music theory tasks) is not at all clear. Different music theorists will often come up with different harmonic analyses of the same piece. What's more, this variation is not just "random noise," which is expected in any scientific work. Rather, this variation arises from systematic disagreements about the specifics of harmonic analysis, rooted in deep, fundamental questions: what does harmonic analysis reveal about a piece of music? What do different harmonic analyses of the same piece signify?

The "ambiguity" in harmonic analysis is a major detriment to machine (or human) training and evaluation. If the model's output doesn't match the training data but does match a different plausible analysis, is it wrong? How will inconsistent analyses hinder the model's ability to learn?

The standard approach to dealing with "ambiguous" ground truth data is to get multiple copies of it from different sources: in this case, it would mean get a bunch of different music theorists to analyze the same music. However, how we integrate these different analyses in model training/evaluation is not clear. More importantly, this approach doesn't assure that a complete picture of all the possibilities is revealed. Two theorists might happen to (by chance) agree on one segment and disagree on another, when a third theorists would have disagreed on the former and agree on the later. What's worse, we are basically side-stepping the real issue, what different analyses are supposed to mean!

A "Flexible" Approach

My contribution to this vexing issue has been to create a new type of "flexible" harmonic analysis training data. I've created an algorithm which identifies every possible analysis of a musical passage. Here is an example from one two-beat window in J.S. Bach's chorale "Aus meines Herzens Grunde":

What this shows us is all the ways that this passage can be broken up into legal triads, allowing for legal harmonic rhythms and non-harmonic melodic contours (i.e., "passing tones" or "appogiaturas"). I have generated every possible analysis of \(>24000\) windows in 571 chorales by J.S. Bach and Michael Prætorius. Using my R package—or even better, its accompanying GUI—you can filter these windows to get your prefered analyses of these 571 pieces. (For instance, for the window shown above, you could apply a filter to avoid interpretations which include appogiaturas or diminished triads and minimize passing tones: in which case the package would spit out the \(C\)–\(F\#_o\) analysis.)