Beispiel #1
0
def test_github_issue_8_sloppy_midi():
    prog = ChordProgression.from_midi_file(
        os.path.join(os.path.dirname(__file__), "test_data", "issue_8.mid"))
    assert prog == ChordProgression([
        Chord(
            name="A#min",
            root=Note("A#", 3),
            intervals=Intervals(name="min", semitones=[0, 3, 7]),
        ),
        Chord(
            name="D#",
            root=Note("D#", 4),
            intervals=Intervals(name="", semitones=[0, 4, 7]),
        ),
        Chord(
            name="D#min",
            root=Note("D#", 4),
            intervals=Intervals(name="min", semitones=[0, 3, 7]),
        ),
        Chord(
            name="A#min/G#",
            root=Note("G#", 3),
            intervals=Intervals(name="min/b7", semitones=[0, 5, 9, 14]),
        ),
    ])
Beispiel #2
0
def test_progression_from_midi():
    midi_filename = os.path.join(os.path.dirname(__file__), "test_data",
                                 "test_progression.midi")

    original = ChordProgression.from_string("""C Fm C G7 C E7 Am G G G G G""")
    try:
        original.to_midi(midi_filename)
        assert ChordProgression.from_midi_file(midi_filename) == original
    finally:
        os.remove(midi_filename)