Skip to content

Commit 13909a6

Browse files
maximoskpbmcfee
andauthored
Only "proper" chord types in mir_eval.chord.QUALITIES (#397)
* added some chord types in the chord.py regex * moved chords test * all chord types are understood * removed ureachable types * added test and removed notebook * correcting test * Update tests/test_chord.py * Update tests/test_chord.py --------- Co-authored-by: Brian McFee <[email protected]>
1 parent 935451d commit 13909a6

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

mir_eval/chord.py

-4
Original file line numberDiff line numberDiff line change
@@ -261,15 +261,11 @@ def scale_degree_to_bitmap(scale_degree, modulo=False, length=BITMAP_LENGTH):
261261
"maj9": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1],
262262
"min9": [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0],
263263
"9": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
264-
"b9": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
265-
"#9": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
266264
"min11": [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0],
267265
"11": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
268-
"#11": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
269266
"maj13": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1],
270267
"min13": [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0],
271268
"13": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
272-
"b13": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
273269
"1": [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
274270
"5": [1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
275271
"": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],

tests/test_chord.py

+8
Original file line numberDiff line numberDiff line change
@@ -638,3 +638,11 @@ def test_validate():
638638
# Test that error is thrown on different-length labels
639639
with pytest.raises(ValueError):
640640
mir_eval.chord.validate([], ["C"])
641+
642+
643+
@pytest.mark.parametrize("quality", list(mir_eval.chord.QUALITIES.keys()))
644+
def test_chord_qualities(quality):
645+
if len(quality) > 0:
646+
mir_eval.chord.encode(f"C:{quality}", reduce_extended_chords=True)
647+
else:
648+
mir_eval.chord.encode("C", reduce_extended_chords=True)

0 commit comments

Comments
 (0)