Extracting chords from MIDI

CASSETTE (Chord estimation Applied to Symbolic music by Segmentation, Extraction and Tie-breaking TEmplate matching) is a chord_template-matching based algorithm for MIDI chord recognition that is easy to implement and understand. Similar to the good old cassette tapes, this algorithm is certainly not state of the art. However, it is simple to implement and does not require any training.

CASSETTE recognizes chords in a three-step procedure:

  1. It segments each audio-aligned midi file (on bar/beat/note level);

  2. It calculates a weighted chroma feature for each of the segments, based on the notes within that segment;

  3. It matches the features of each segment to the features of a predefined chord vocabulary and assigns each segment to the most similar chord.

The main function to use is classify_aligned_midis_for_song(), which calls CASSETTE on all MIDIs matched to the given Song.

decibel.midi_chord_recognizer.cassette.classify_aligned_midis_for_song(chord_vocabulary: decibel.music_objects.chord_vocabulary.ChordVocabulary, segmenter: decibel.midi_chord_recognizer.midi_segmenter_interface.MIDISegmenterInterface)[source]

Find chord labels for all re-aligned MIDIs of this song

Parameters
  • song – Song object for which we want to find the chord labels

  • chord_vocabulary – List of all chords

  • segmenter – Bar or beat segmenter