HarmoF0: Logarithmic Scale Dilated Convolution For Pitch Estimation

Weixing Wei, Peilin Li, Yi Yu, Wei Li · DOI

Abstract

Sounds, especially music, contain various harmonic components scattered in the frequency dimension. It is difficult for normal convolutional neural networks to observe these overtones. This paper introduces a multiple rates dilated causal convolution (MRDC-Conv) method to capture the harmonic structure in logarithmic scale spectrograms efficiently. The harmonic is helpful for pitch estimation, which is important for many sound processing applications. We propose HarmoF0, a fully convolutional network, to evaluate the MRDC-Conv and other dilated convolutions in pitch estimation. The results show that this model outperforms the DeepF0, yields state-of-the-art performance in three datasets, and simultaneously reduces more than 90% parameters. We also find that it has stronger noise resistance and fewer octave errors. The code and pre-trained model are available at https://github.com/WX-Wei/HarmoF0.

What Problem Does This Paper Address?

Pitch estimation—identifying the fundamental frequency ($f_0$) of a sound—is a cornerstone of audio analysis, essential for everything from speech recognition to music information retrieval. However, it is notoriously difficult because real-world sounds are complex. They consist of a fundamental frequency and a series of overtones (harmonics) that are integer multiples of that fundamental.

Humans perceive pitch by looking at the entire harmonic series, not just the fundamental. Traditional Convolutional Neural Networks (CNNs) struggle to mimic this because harmonics are scattered across the frequency dimension. While some models try to process raw waveforms to avoid this, they end up being computationally massive. Others use linear-scale spectrograms, where the distance between harmonics changes depending on the pitch, making it nearly impossible for a standard convolution filter to learn a consistent pattern.

Methods

Logarithmic Scale Spectrograms

By converting the frequency axis to a logarithmic scale, the distance between any two harmonics becomes a constant value, regardless of what the fundamental frequency is. This turns a variable-spacing problem into a fixed-geometry problem.

Comparison of linear and log scale spectrograms. In the log scale (right), the harmonic spacing becomes consistent across different pitches.

Multiple Rates Dilated Causal Convolution (MRDC-Conv)

Standard dilated convolutions use a single "gap" (dilation rate) to expand their receptive field. HarmoF0’s MRDC-Conv uses multiple dilation rates simultaneously in a single layer. These rates ($d_1, d_2, d_3, \dots$) are mathematically calculated to match the exact spacing of the harmonic series in the log-spectrogram.

The resulting architecture, HarmoF0, is a lightweight, fully convolutional network. It uses an MRDC-Conv block to "capture" the harmonic structure and subsequent standard dilated convolution blocks to refine the features. To handle the fact that only one frequency bin is "correct" out of hundreds, they employ a weighted binary cross-entropy loss during training.

Datasets

The model was trained and evaluated on three diverse datasets to ensure generalizability:

  • MIR-1K: 1,000 song clips featuring singing voices with accompaniment.
  • MDB-stem-synth: 230 solo tracks spanning various musical instruments with perfect $f_0$ annotations.
  • PTDB-TUG: A speech database containing recordings from 20 English speakers.

Key Insights and Ideas

  • Geometric Consistency: The "aha" moment of the paper is the realization that log-frequency scaling transforms the sparse, shifting harmonic series into a rigid template. This allows the model to use fixed dilation rates to "look" exactly where the overtones should be.
  • Efficiency through Domain Knowledge: By hard-coding the expected spacing of harmonics into the architecture (via the dilation rates), the model doesn't have to "learn" the laws of physics from scratch. This is why it can outperform massive models like CREPE while being a fraction of the size.
  • The "Whole is Greater than the Sum": Because HarmoF0 tracks the entire harmonic series, it is much less likely to be fooled by noise that might obscure the fundamental frequency. If the fundamental is missing or noisy, the model can still infer the pitch from the remaining overtones.

Key Results

  • State-of-the-Art Performance: HarmoF0 achieved the highest Raw Pitch Accuracy (RPA) across all three datasets, outperforming established models like CREPE and DeepF0.
  • Massive Parameter Reduction: The model contains only 0.377 million parameters. For comparison, DeepF0 has 5 million and CREPE has 22.2 million. This represents a reduction of over 90–98% in model size.
  • Superior Noise Robustness: In tests with various noise profiles, HarmoF0 maintained significantly higher accuracy than its competitors and ablation variants.
Raw Pitch Accuracy (RPA) across different noise profiles. HarmoF0 (Proposed) maintains significantly higher accuracy in noisy conditions compared to variants without its key components.

In high-noise environments (0dB SNR), HarmoF0 maintained an RPA of 85.11%, while the previous best model (DeepF0) dropped to 79.52%.

  • Fewer Octave Errors: The model showed a much smaller gap between Raw Pitch Accuracy and Raw Chroma Accuracy, indicating it is less prone to the common "octave error" (guessing a frequency exactly double or half the correct one).

Limitations and Future Work

The current study focuses exclusively on monophonic pitch estimation (one sound source at a time). While the results are impressive, real-world audio is often polyphonic (multiple instruments or voices).

The authors suggest that the HarmoF0 architecture provides a strong foundation for future work in melody extraction, polyphonic pitch tracking, and multi-task learning for tasks like source separation.

Summary updated

BibTeX
@misc{wei2022harmof,
  author = {Weixing Wei and Peilin Li and Yi Yu and Wei Li},
  title = {{HarmoF0: Logarithmic Scale Dilated Convolution For Pitch Estimation}},
  year = {2022},
  eprint = {2205.01019},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.01019},
}
Figure