From 4d925126672dcb57c76fcf21d705fc6e5621724f Mon Sep 17 00:00:00 2001 From: maximoskp Date: Tue, 26 Nov 2024 07:27:49 +0200 Subject: [PATCH 1/4] added some chord types in the chord.py regex --- mir_eval/chord.py | 2 +- test_chord_types.ipynb | 100 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 test_chord_types.ipynb diff --git a/mir_eval/chord.py b/mir_eval/chord.py index e54a1153..3b1cdb4a 100644 --- a/mir_eval/chord.py +++ b/mir_eval/chord.py @@ -344,7 +344,7 @@ def reduce_extended_quality(quality): # which is in turn derived from the context-free grammar of # Harte et al., 2005. CHORD_RE = re.compile( - r"""^((N|X)|(([A-G](b*|#*))((:(maj|min|dim|aug|1|5|sus2|sus4|maj6|min6|7|maj7|min7|dim7|hdim7|minmaj7|aug7|9|maj9|min9|11|maj11|min11|13|maj13|min13)(\((\*?((b*|#*)([1-9]|1[0-3]?))(,\*?((b*|#*)([1-9]|1[0-3]?)))*)\))?)|(:\((\*?((b*|#*)([1-9]|1[0-3]?))(,\*?((b*|#*)([1-9]|1[0-3]?)))*)\)))?((/((b*|#*)([1-9]|1[0-3]?)))?)?))$""" + r"""^((N|X)|(([A-G](b*|#*))((:(maj|min|dim|aug|1|5|sus2|sus4|maj6|min6|7|maj7|min7|dim7|hdim7|minmaj7|aug7|9|maj9|min9|b9|#9|11|#11|maj11|min11|13|maj13|min13|b13)(\((\*?((b*|#*)([1-9]|1[0-3]?))(,\*?((b*|#*)([1-9]|1[0-3]?)))*)\))?)|(:\((\*?((b*|#*)([1-9]|1[0-3]?))(,\*?((b*|#*)([1-9]|1[0-3]?)))*)\)))?((/((b*|#*)([1-9]|1[0-3]?)))?)?))$""" ) # nopep8 diff --git a/test_chord_types.ipynb b/test_chord_types.ipynb new file mode 100644 index 00000000..93ffb007 --- /dev/null +++ b/test_chord_types.ipynb @@ -0,0 +1,100 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import mir_eval" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'maj': [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], 'min': [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], 'aug': [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], 'dim': [1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], 'sus4': [1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], 'sus2': [1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], '7': [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], 'maj7': [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1], 'min7': [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0], 'minmaj7': [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], 'maj6': [1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0], 'min6': [1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0], 'dim7': [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], 'hdim7': [1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0], '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]}\n" + ] + } + ], + "source": [ + "# test chord types\n", + "quals = mir_eval.chord.QUALITIES\n", + "print(quals)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "maj (0, array([1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0]), 0)\n", + "min (0, array([1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0]), 0)\n", + "aug (0, array([1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]), 0)\n", + "dim (0, array([1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0]), 0)\n", + "sus4 (0, array([1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0]), 0)\n", + "sus2 (0, array([1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0]), 0)\n", + "7 (0, array([1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]), 0)\n", + "maj7 (0, array([1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1]), 0)\n", + "min7 (0, array([1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0]), 0)\n", + "minmaj7 (0, array([1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]), 0)\n", + "maj6 (0, array([1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0]), 0)\n", + "min6 (0, array([1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0]), 0)\n", + "dim7 (0, array([1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0]), 0)\n", + "hdim7 (0, array([1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0]), 0)\n", + "maj9 (0, array([1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1]), 0)\n", + "min9 (0, array([1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0]), 0)\n", + "9 (0, array([1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0]), 0)\n", + "b9 (0, array([1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]), 0)\n", + "#9 (0, array([1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0]), 0)\n", + "min11 (0, array([1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0]), 0)\n", + "11 (0, array([1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0]), 0)\n", + "#11 (0, array([1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0]), 0)\n", + "maj13 (0, array([1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1]), 0)\n", + "min13 (0, array([1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0]), 0)\n", + "13 (0, array([1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0]), 0)\n", + "b13 (0, array([1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0]), 0)\n", + "1 (0, array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 0)\n", + "5 (0, array([1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]), 0)\n", + " (0, array([1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0]), 0)\n" + ] + } + ], + "source": [ + "for q in quals.keys():\n", + " c = mir_eval.chord.encode('C' + (len(q) > 0)*':' + q, reduce_extended_chords=True)\n", + " print(q, c)" + ] + } + ], + "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 +} From cbd5cafed7ac84ac48a68094c9faf19f1289678e Mon Sep 17 00:00:00 2001 From: maximoskp Date: Tue, 26 Nov 2024 07:29:38 +0200 Subject: [PATCH 2/4] moved chords test --- test_chord_types.ipynb => tests/test_chord_types.ipynb | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test_chord_types.ipynb => tests/test_chord_types.ipynb (100%) diff --git a/test_chord_types.ipynb b/tests/test_chord_types.ipynb similarity index 100% rename from test_chord_types.ipynb rename to tests/test_chord_types.ipynb From e4656a8a1db7445bd84ad5fa01bce7ca480aa16a Mon Sep 17 00:00:00 2001 From: maximoskp Date: Fri, 29 Nov 2024 07:07:56 +0200 Subject: [PATCH 3/4] all chord types are understood --- tests/test_chord.py | 6 +++ tests/test_chord_types.ipynb | 100 ----------------------------------- 2 files changed, 6 insertions(+), 100 deletions(-) delete mode 100644 tests/test_chord_types.ipynb diff --git a/tests/test_chord.py b/tests/test_chord.py index 0e70cf97..402305de 100644 --- a/tests/test_chord.py +++ b/tests/test_chord.py @@ -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) \ No newline at end of file diff --git a/tests/test_chord_types.ipynb b/tests/test_chord_types.ipynb deleted file mode 100644 index 93ffb007..00000000 --- a/tests/test_chord_types.ipynb +++ /dev/null @@ -1,100 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "import mir_eval" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'maj': [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], 'min': [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], 'aug': [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], 'dim': [1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], 'sus4': [1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], 'sus2': [1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], '7': [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], 'maj7': [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1], 'min7': [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0], 'minmaj7': [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], 'maj6': [1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0], 'min6': [1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0], 'dim7': [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], 'hdim7': [1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0], '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]}\n" - ] - } - ], - "source": [ - "# test chord types\n", - "quals = mir_eval.chord.QUALITIES\n", - "print(quals)" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "maj (0, array([1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0]), 0)\n", - "min (0, array([1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0]), 0)\n", - "aug (0, array([1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]), 0)\n", - "dim (0, array([1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0]), 0)\n", - "sus4 (0, array([1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0]), 0)\n", - "sus2 (0, array([1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0]), 0)\n", - "7 (0, array([1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]), 0)\n", - "maj7 (0, array([1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1]), 0)\n", - "min7 (0, array([1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0]), 0)\n", - "minmaj7 (0, array([1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]), 0)\n", - "maj6 (0, array([1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0]), 0)\n", - "min6 (0, array([1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0]), 0)\n", - "dim7 (0, array([1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0]), 0)\n", - "hdim7 (0, array([1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0]), 0)\n", - "maj9 (0, array([1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1]), 0)\n", - "min9 (0, array([1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0]), 0)\n", - "9 (0, array([1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0]), 0)\n", - "b9 (0, array([1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]), 0)\n", - "#9 (0, array([1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0]), 0)\n", - "min11 (0, array([1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0]), 0)\n", - "11 (0, array([1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0]), 0)\n", - "#11 (0, array([1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0]), 0)\n", - "maj13 (0, array([1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1]), 0)\n", - "min13 (0, array([1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0]), 0)\n", - "13 (0, array([1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0]), 0)\n", - "b13 (0, array([1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0]), 0)\n", - "1 (0, array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 0)\n", - "5 (0, array([1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]), 0)\n", - " (0, array([1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0]), 0)\n" - ] - } - ], - "source": [ - "for q in quals.keys():\n", - " c = mir_eval.chord.encode('C' + (len(q) > 0)*':' + q, reduce_extended_chords=True)\n", - " print(q, c)" - ] - } - ], - "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 -} From 21869f9700a841a22f6f703b67b921ca9fba6078 Mon Sep 17 00:00:00 2001 From: maximoskp Date: Sat, 7 Dec 2024 08:02:09 +0200 Subject: [PATCH 4/4] removed ureachable types --- mir_eval/chord.py | 6 +-- test_chord_types.ipynb | 99 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 5 deletions(-) create mode 100644 test_chord_types.ipynb diff --git a/mir_eval/chord.py b/mir_eval/chord.py index 3b1cdb4a..3dd5b649 100644 --- a/mir_eval/chord.py +++ b/mir_eval/chord.py @@ -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], @@ -344,7 +340,7 @@ def reduce_extended_quality(quality): # which is in turn derived from the context-free grammar of # Harte et al., 2005. CHORD_RE = re.compile( - r"""^((N|X)|(([A-G](b*|#*))((:(maj|min|dim|aug|1|5|sus2|sus4|maj6|min6|7|maj7|min7|dim7|hdim7|minmaj7|aug7|9|maj9|min9|b9|#9|11|#11|maj11|min11|13|maj13|min13|b13)(\((\*?((b*|#*)([1-9]|1[0-3]?))(,\*?((b*|#*)([1-9]|1[0-3]?)))*)\))?)|(:\((\*?((b*|#*)([1-9]|1[0-3]?))(,\*?((b*|#*)([1-9]|1[0-3]?)))*)\)))?((/((b*|#*)([1-9]|1[0-3]?)))?)?))$""" + r"""^((N|X)|(([A-G](b*|#*))((:(maj|min|dim|aug|1|5|sus2|sus4|maj6|min6|7|maj7|min7|dim7|hdim7|minmaj7|aug7|9|maj9|min9|11|maj11|min11|13|maj13|min13)(\((\*?((b*|#*)([1-9]|1[0-3]?))(,\*?((b*|#*)([1-9]|1[0-3]?)))*)\))?)|(:\((\*?((b*|#*)([1-9]|1[0-3]?))(,\*?((b*|#*)([1-9]|1[0-3]?)))*)\)))?((/((b*|#*)([1-9]|1[0-3]?)))?)?))$""" ) # nopep8 diff --git a/test_chord_types.ipynb b/test_chord_types.ipynb new file mode 100644 index 00000000..4dcddc25 --- /dev/null +++ b/test_chord_types.ipynb @@ -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 +}