def from_midi_file(cls, filename: str) -> "ChordProgression": notes = read_midi_file(filename) progression = [] for chord in group_notes_to_chords(notes): progression.append(Chord.from_midi([note.note for note in chord])) return cls(progression)
def test_chord_from_midi(midi, name): assert Chord.from_midi(midi).name == name