Use of Hidden Markov Models and Factored Language Models for Automatic Chord Recognition

Maksim Khadkevich, Maurizio OmologoIsmir 2009

Introduction

Automatic chord recognition is a core task in Music Information Retrieval (MIR), aiming to extract a sequence of chord labels from raw audio. While acoustic models like Hidden Markov Models (HMMs) are effective at capturing the spectral characteristics of chords, they often lack a sophisticated understanding of musical "grammar." Most traditional systems rely on simple bigram models that ignore the rhythmic structure inherent in music. This paper proposes a novel approach using Factored Language Models (FLMs) to integrate chord duration directly into the prediction process.

System Architecture and Methods

The proposed system utilizes a multi-stage pipeline to refine chord predictions, moving from raw audio to structured labels.

The multi-stage pipeline including acoustic modeling and FLM-based lattice rescoring.

1. Front-End and Acoustic Modeling

Audio is first converted into Pitch Class Profiles (PCP), or chromagrams, which represent the intensity of the 12 semitones. These features are fed into a 3-state left-to-right HMM for each chord type, with acoustic "sounds" modeled by 512-component Gaussian Mixture Models (GMMs). To mitigate data sparsity, all training data is transposed to a common key (C Major or A Minor) using circular permutation.

2. Two-Pass Decoding

The decoding process occurs in two distinct passes:

  • Pass 1: A Viterbi decoder uses a standard bigram model to generate a "lattice"—a directed graph representing multiple high-probability chord sequences.
  • Pass 2: This lattice is rescored using Factored Language Models. Unlike standard LMs that treat a chord as a single label, FLMs treat it as a bundle of factors: the chord label ($C_t$) and its duration in beats ($D_t$). This allows the model to consider higher-order dependencies (e.g., 4-grams) involving both identity and timing.

The Role of Rhythmic Duration

A key insight of this work is that chord changes in popular music are not random; they are deeply tied to metrical structure.

Histogram of chord durations in beats, showing strong peaks at 2, 4, and 8 beats.

As shown in the distribution of the Beatles dataset, chords predominantly last for 2, 4, or 8 beats. By incorporating duration as a factor, the FLM can learn these patterns. Furthermore, FLMs utilize "Generalized Parallel Back-off," allowing the system to intelligently drop less certain factors (like a distant previous chord) while retaining more certain ones (like the current duration) when encountering sparse data.

Evaluation and Results

The system was evaluated on 175 songs from the Beatles, using 5-fold cross-validation. The results demonstrate that adding a language modeling layer significantly improves performance over a purely acoustic baseline.

Model Accuracy
Baseline (Acoustic only) 67.86%
Standard 3-gram LM 69.34%
3-gram Factored LM 69.52%
4-gram Factored LM 69.63%

The FLM approach provided a ~2% total improvement over the baseline. Notably, the FLM was particularly effective at refining chord boundaries, ensuring transitions aligned more accurately with the rhythmic grid.

Conclusion and Future Work

The integration of Factored Language Models allows chord recognition systems to move beyond simple label sequences and incorporate rhythmic context. While the current system assumes a constant key and relies on external beat tracking, future work could explore handling key modulations and more complex chord vocabularies beyond major and minor triads.

Summary updated

BibTeX
@inproceedings{khadkevich2009use,
  author = {Maksim Khadkevich and Maurizio Omologo},
  title = {{Use of Hidden Markov Models and Factored Language Models for Automatic Chord Recognition}},
  booktitle = {Ismir},
  year = {2009},
}
Figure