/chord-recognition

The tools to extract chords from an audio

Primary LanguageJupyter NotebookMIT LicenseMIT

Chord Recognition

The tools to solve Audio Chord Recognition (Chord Estimation) problem.

Some of pre-trained model metrics of major and minor chords made by mir_eval on Isophonics and Robbie Williams datasets.

_ majmin mirex
beatles 0.792 0.771
queen 0.815 0.798
zweieck 0.839 0.811
robbie_williams 0.908 0.885

How it works

chord-recognition takes an audio file in mp3 format, and then represents it as waweform in numpy.array. It computes STFT to split the input into frames representing 1.5 seconds of the audio. It applies a simple ConvNet to each frame to classify into 25 classes (12 minor, 12 major plus a non-chord class). Finally the result is enhanced by HMM smoothing.

Installation

pip install git+https://github.com/discort/chord-recognition

Usage

from chord_recognition import estimate_chords

result = estimate_chords(audio_path='tests/fixtures/C_Am.mp3', nonchord=True)
print(result)
[(0.0, 1.6718, 'N'),
 (1.6718, 3.7152, 'C'),
 (3.7152, 4.2725, 'N'),
 (4.2725, 6.0372, 'Am')]

Development

Download datasets

Use this link to download Beatles, Queen and Robbie Williams datasets in isophonics format

Unzip data and put into root of a project

unzip data.zip data

Install requirements

pip install -r requirements.txt

Run tests

py.test -q --cov=chord_recognition tests

Evaluation

python -m chord_recognition.evaluate -ds <dataset_name>

Experiments

audio_analysis.ipynb  <- Check spectrogram, chromagram, etc
chords_analysis.ipynb  <- Check chord distribution and other stats data
experiments.ipynb  <- Describing some experiments to improve classification/
experiment<N>.ipynb  <- A code to reproduce an experiment

Run jupyter

jupyter notebook

References:

  1. Müller M. (2015) Chord Recognition. In: Fundamentals of Music Processing
  2. Korzeniowski, Widmer (2016) A Fully Convolutional Deep Auditory Model for Musical Chord Recognition
  3. Zanoni (2014) Chord and Harmony annotations of the first five albums by Robbie Williams