Melody Extraction based on Harmonic Coded Structure

Sihyun Joo, Sanghun Park, Seokhwan Jo, Chang D. Yoo

Introduction

Melody extraction—the task of identifying the single most prominent pitch sequence from a polyphonic audio signal—is a cornerstone of Music Information Retrieval (MIR). Despite its importance for applications like automated transcription and audio search, the process faces two significant hurdles: accompaniment interference, where background instruments mask the melody's spectral signature, and octave mismatch, where harmonic overlaps lead to pitch errors. This paper presents a robust two-step algorithm designed to overcome these challenges using a Harmonic Coded Structure (HCS).

System Overview

The proposed system operates in two distinct phases: Pitch-Candidate Estimation and Pitch-Sequence Identification. By combining timbre-aware spectral modeling with rule-based musical logic, the system effectively isolates the lead melody from complex backgrounds.

System architecture of the proposed melody extraction algorithm, illustrating the two-step process from polyphonic audio to estimated melody line.

Methodology

1. Pitch-Candidate Estimation

The core innovation of this approach is the Harmonic Coded Structure (HCS). Rather than assuming a generic harmonic series for all instruments, the authors developed a codebook of harmonic amplitude patterns. This codebook was built using $k$-means clustering on over 500,000 frames of real audio from piano, saxophone, and singing voices, allowing the model to adapt to the specific "timbre" of the lead instrument.

For every audio frame, the algorithm identifies the $N$-best pitch candidates by minimizing the Minimum Mean-Square Error (MMSE) between the observed audio spectrum and the HCS models in the codebook. This process is visualized through cost function analysis, where local minima indicate the most likely pitch candidates.

Cost function analysis for pitch candidate estimation, where local minima represent potential melody pitches.

To ensure temporal stability and prevent the model from erratically switching between instrument timbres, a "mode" filter is applied. This filter selects the most consistent HCS index across neighboring frames, significantly reducing noise from background instruments.

2. Pitch-Sequence Identification

Once the $N$-best candidates are identified, the system connects them into a continuous melody line using a rule-based selection process. This stage incorporates psychoacoustic and musical properties to prune mathematically plausible but musically impossible sequences:

  • Vibrato Analysis: The system distinguishes between the wider vibrato of a singing voice ($\pm 60\sim200$ cents) and the narrower vibrato of instruments ($\pm 20\sim30$ cents).
  • Transition Constraints: Note jumps are restricted to within one octave to maintain melodic fluidity.
  • Rest Detection: The algorithm accounts for natural pauses, noting that singing rests are typically longer than 50ms.

A final post-processing smoothing step removes short-lived pitch jumps and corrects any remaining octave errors.

Evaluation and Results

The HCS-based algorithm was evaluated against standard benchmarks, including the ADC04 and MIREX05 datasets. The results demonstrate that the system is highly competitive with state-of-the-art methods:

  • MIREX05: The approach achieved a Raw Pitch Accuracy (RPA) of 76.1% and a Raw Chroma Accuracy (RCA) of 80.7%, outperforming several established algorithms.
  • ADC04: The system reached an RPA of 81.8%, placing it among the top-tier performers for this benchmark.

Conclusion

By utilizing a timbre-aware HCS codebook and applying musical logic to sequence identification, the proposed method provides a robust solution for melody extraction in polyphonic environments. While persistent interference remains a challenge, the integration of spectral modeling and temporal consistency offers a significant step forward in accurately capturing the "lead" in complex musical recordings. Future work may involve expanding the HCS codebook to include a wider variety of instruments and exploring more advanced machine learning techniques for temporal dynamics.

Summary updated

BibTeX
@inproceedings{joo2011melody,
  author = {Sihyun Joo and Sanghun Park and Seokhwan Jo and Chang D. Yoo},
  title = {{Melody Extraction based on Harmonic Coded Structure}},
  booktitle = {ISMIR},
  year = {2011},
}
Figure