Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions mir_eval/chord.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,11 @@ def scale_degree_to_bitmap(scale_degree, modulo=False, length=BITMAP_LENGTH):
"maj9": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1],
"min9": [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0],
"9": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
"b9": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
"#9": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
"min11": [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0],
"11": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
"#11": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
"maj13": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1],
"min13": [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0],
"13": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
"b13": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
"1": [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"5": [1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
"": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
Expand Down
99 changes: 99 additions & 0 deletions test_chord_types.ipynb
Comment thread
bmcfee marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import mir_eval"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# REMOVED\n",
"# type problem: C:b9\n",
"# type problem: C:#9\n",
"# type problem: C:#11\n",
"# type problem: C:b13"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"for q in mir_eval.chord.QUALITIES:\n",
" chord_symbol = 'C' + ':'*(len(q)>0) + q\n",
" try:\n",
" x = mir_eval.chord.encode(chord_symbol, reduce_extended_chords=True)\n",
" except:\n",
" print('type problem: ', chord_symbol)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['minmaj7', 'maj9', 'min9', '9', 'b9', '#9', '11', '#11', '13', 'b13', 'min11', 'maj13', 'min13']\n"
]
}
],
"source": [
"extended_qualities = mir_eval.chord.EXTENDED_QUALITY_REDUX\n",
"extended_keys = list(extended_qualities.keys())\n",
"print(extended_keys)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(0, array([1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]), 0)\n"
]
}
],
"source": [
"c = 'C:minmaj7(b9)'\n",
"x = mir_eval.chord.encode(c, reduce_extended_chords=True)\n",
"print(x)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "mir_eval",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
6 changes: 6 additions & 0 deletions tests/test_chord.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,3 +638,9 @@ def test_validate():
# Test that error is thrown on different-length labels
with pytest.raises(ValueError):
mir_eval.chord.validate([], ["C"])

# @maximoskp
# make testing for all chord types
# quals = mir_eval.chord.QUALITIES
# for q in quals.keys():
# c = mir_eval.chord.encode('C' + (len(q) > 0)*':' + q, reduce_extended_chords=True)
Comment thread
bmcfee marked this conversation as resolved.
Outdated
Comment thread
bmcfee marked this conversation as resolved.
Outdated