From 04e54927166057ec0d0f25c0b1003a17aeaa040a Mon Sep 17 00:00:00 2001 From: Tim Beyer <35711942+TimFelixBeyer@users.noreply.github.com> Date: Sat, 18 Nov 2023 20:31:53 +0800 Subject: [PATCH 1/3] Correct inversionDefaultPitchClasses --- music21/chord/tables.py | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/music21/chord/tables.py b/music21/chord/tables.py index 83d10b9f51..9791144634 100644 --- a/music21/chord/tables.py +++ b/music21/chord/tables.py @@ -403,6 +403,8 @@ class ChordTablesException(exceptions21.Music21Exception): # inverted form of Forte class 3-11 (minor/major triad) return 0, 2, 3 # (the zero could be assumed, but it makes my brain easier to have it there). # It is faster to store this than to recompute it every time. +# Data cross-checked with +# https://web.archive.org/web/20130118035710/http://solomonsmusic.net/pcsets.htm inversionDefaultPitchClasses = { (3, 2): (0, 2, 3), (3, 3): (0, 3, 4), @@ -421,7 +423,7 @@ class ChordTablesException(exceptions21.Music21Exception): (4,15): (0, 2, 5, 6), (4,16): (0, 2, 6, 7), (4,18): (0, 3, 6, 7), - (4,19): (0, 4, 7, 8), + (4,19): (0, 3, 4, 8), (4,22): (0, 3, 5, 7), (4,27): (0, 3, 6, 8), (4,29): (0, 4, 6, 7), @@ -434,7 +436,7 @@ class ChordTablesException(exceptions21.Music21Exception): (5, 9): (0, 2, 4, 5, 6), (5,10): (0, 2, 3, 5, 6), (5,11): (0, 3, 4, 5, 7), - (5,13): (0, 4, 6, 7, 8), + (5,13): (0, 2, 3, 4, 8), (5,14): (0, 2, 5, 6, 7), (5,16): (0, 3, 4, 6, 7), (5,18): (0, 2, 3, 6, 7), @@ -449,8 +451,8 @@ class ChordTablesException(exceptions21.Music21Exception): (5,28): (0, 2, 5, 6, 8), (5,29): (0, 2, 5, 7, 8), (5,30): (0, 2, 4, 7, 8), - (5,31): (0, 3, 6, 8, 9), - (5,32): (0, 3, 5, 8, 9), + (5,31): (0, 2, 3, 6, 9), + (5,32): (0, 1, 4, 7, 9), (5,36): (0, 3, 5, 6, 7), (5,38): (0, 3, 6, 7, 8), (6, 2): (0, 2, 3, 4, 5, 6), @@ -470,7 +472,7 @@ class ChordTablesException(exceptions21.Music21Exception): (6,22): (0, 2, 4, 6, 7, 8), (6,24): (0, 2, 4, 5, 7, 8), (6,25): (0, 2, 3, 5, 7, 8), - (6,27): (0, 3, 5, 6, 8, 9), + (6,27): (0, 2, 3, 5, 6, 9), (6,30): (0, 2, 3, 6, 8, 9), (6,31): (0, 1, 4, 6, 8, 9), (6,33): (0, 2, 4, 6, 7, 9), @@ -480,9 +482,9 @@ class ChordTablesException(exceptions21.Music21Exception): (6,40): (0, 3, 5, 6, 7, 8), (6,41): (0, 2, 5, 6, 7, 8), (6,43): (0, 2, 3, 6, 7, 8), - (6,44): (0, 3, 4, 7, 8, 9), - (6,46): (0, 3, 5, 7, 8, 9), - (6,47): (0, 2, 5, 7, 8, 9), + (6,44): (0, 1, 2, 5, 8, 9), + (6,46): (0, 2, 4, 5, 6, 9), + (6,47): (0, 2, 3, 4, 7, 9), (7, 2): (0, 2, 3, 4, 5, 6, 7), (7, 3): (0, 3, 4, 5, 6, 7, 8), (7, 4): (0, 1, 3, 4, 5, 6, 7), @@ -490,15 +492,15 @@ class ChordTablesException(exceptions21.Music21Exception): (7, 6): (0, 1, 4, 5, 6, 7, 8), (7, 7): (0, 1, 2, 5, 6, 7, 8), (7, 9): (0, 2, 4, 5, 6, 7, 8), - (7,10): (0, 3, 5, 6, 7, 8, 9), + (7,10): (0, 2, 3, 4, 5, 6, 9), (7,11): (0, 2, 3, 4, 5, 7, 8), (7,13): (0, 2, 3, 4, 6, 7, 8), (7,14): (0, 1, 3, 5, 6, 7, 8), - (7,16): (0, 3, 4, 6, 7, 8, 9), + (7,16): (0, 1, 3, 4, 5, 6, 9), (7,18): (0, 1, 4, 6, 7, 8, 9), - (7,19): (0, 2, 3, 6, 7, 8, 9), + (7,19): (0, 1, 2, 3, 6, 8, 9), (7,20): (0, 1, 2, 5, 7, 8, 9), - (7,21): (0, 1, 4, 5, 7, 8, 9), + (7,21): (0, 1, 3, 4, 5, 8, 9), (7,23): (0, 2, 4, 5, 6, 7, 9), (7,24): (0, 2, 4, 6, 7, 8, 9), (7,25): (0, 2, 3, 5, 6, 7, 9), @@ -522,16 +524,16 @@ class ChordTablesException(exceptions21.Music21Exception): (8,16): (0, 1, 2, 4, 6, 7, 8, 9), (8,18): (0, 1, 3, 4, 6, 7, 8, 9), (8,19): (0, 1, 3, 4, 5, 7, 8, 9), - (8,22): (0, 2, 4, 5, 7, 8, 9,10), - (8,27): (0, 2, 3, 5, 6, 8, 9,10), + (8,22): (0, 1, 2, 3, 5, 7, 9,10), + (8,27): (0, 1, 2, 4, 6, 7, 9,10), (8,29): (0, 2, 3, 4, 6, 7, 8, 9), (9, 2): (0, 2, 3, 4, 5, 6, 7, 8, 9), (9, 3): (0, 1, 3, 4, 5, 6, 7, 8, 9), (9, 4): (0, 1, 2, 4, 5, 6, 7, 8, 9), (9, 5): (0, 1, 2, 3, 5, 6, 7, 8, 9), - (9, 7): (0, 2, 3, 5, 6, 7, 8, 9,10), - (9, 8): (0, 2, 3, 4, 6, 7, 8, 9,10), - (9,11): (0, 1, 3, 4, 5, 7, 8, 9,10), + (9, 7): (0, 1, 2, 3, 4, 5, 7, 9,10), + (9, 8): (0, 1, 2, 3, 4, 6, 8, 9,10), + (9,11): (0, 1, 2, 3, 5, 6, 8, 9,10), } # to access the data for a single form, use: # forte [size(tetra)] = 4 From 64f37460bf173182dd8468e115ab5542c0dfcc7b Mon Sep 17 00:00:00 2001 From: Tim Beyer <35711942+TimFelixBeyer@users.noreply.github.com> Date: Sat, 18 Nov 2023 20:33:24 +0800 Subject: [PATCH 2/3] Add regression test --- music21/chord/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/music21/chord/__init__.py b/music21/chord/__init__.py index 17702aa5c9..89736fe429 100644 --- a/music21/chord/__init__.py +++ b/music21/chord/__init__.py @@ -5447,6 +5447,9 @@ def normalOrder(self): >>> chord.Chord('E#3 A3 C#4').normalOrder [1, 5, 9] + >>> chord.Chord('B5 G4 D5 E-5 D6').normalOrder + [11, 2, 3, 7] + >>> chord.Chord().normalOrder [] ''' From 4747dfc01658a74f5607b64ed02b2a0aae9eff3b Mon Sep 17 00:00:00 2001 From: Tim Beyer <35711942+TimFelixBeyer@users.noreply.github.com> Date: Sat, 18 Nov 2023 20:39:53 +0800 Subject: [PATCH 3/3] lint --- music21/chord/tables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/music21/chord/tables.py b/music21/chord/tables.py index 9791144634..cee1bbd341 100644 --- a/music21/chord/tables.py +++ b/music21/chord/tables.py @@ -403,7 +403,7 @@ class ChordTablesException(exceptions21.Music21Exception): # inverted form of Forte class 3-11 (minor/major triad) return 0, 2, 3 # (the zero could be assumed, but it makes my brain easier to have it there). # It is faster to store this than to recompute it every time. -# Data cross-checked with +# Data cross-checked with # https://web.archive.org/web/20130118035710/http://solomonsmusic.net/pcsets.htm inversionDefaultPitchClasses = { (3, 2): (0, 2, 3),