From dee8621bf87e3427318b2ef147dd988e1128f687 Mon Sep 17 00:00:00 2001 From: Greg Chapman <75333244+gregchapman-dev@users.noreply.github.com> Date: Tue, 2 Apr 2024 20:25:09 -0700 Subject: [PATCH 1/5] Pedal chord was getting the wrong root string in its figure (was 'Bbpedal', should be 'B-pedal'). --- music21/harmony.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/music21/harmony.py b/music21/harmony.py index 73787a235..440d66bef 100644 --- a/music21/harmony.py +++ b/music21/harmony.py @@ -1104,9 +1104,9 @@ def chordSymbolFigureFromChord(inChord: chord.Chord, includeChordType=False): >>> harmony.chordSymbolFigureFromChord(c, True) ('CGr+6', 'German') - >>> c = chord.Chord(['C3']) - >>> harmony.chordSymbolFigureFromChord(c, True) - ('Cpedal', 'pedal') + >>> eflat = chord.Chord(['E-3']) + >>> harmony.chordSymbolFigureFromChord(eflat, True) + ('E-pedal', 'pedal') >>> c = chord.Chord(['C3', 'G3']) >>> harmony.chordSymbolFigureFromChord(c, True) @@ -1172,9 +1172,9 @@ def chordSymbolFigureFromChord(inChord: chord.Chord, includeChordType=False): if len(inChord.pitches) == 1: if includeChordType: - return (inChord.root().name.replace('-', 'b') + 'pedal', 'pedal') + return (inChord.root().name + 'pedal', 'pedal') else: - return inChord.root().name.replace('-', 'b') + 'pedal' + return inChord.root().name + 'pedal' d3 = inChord.semitonesFromChordStep(3) # 4 triad d5 = inChord.semitonesFromChordStep(5) # 7 triad From 48b06391407029f5925fb5bda2110efd65a49a60 Mon Sep 17 00:00:00 2001 From: Greg Chapman <75333244+gregchapman-dev@users.noreply.github.com> Date: Thu, 11 Apr 2024 16:17:46 -0700 Subject: [PATCH 2/5] Fix CHORD_TYPES[Neapolitan] list (was '1,2-,3,5-', is now '1,-2,3,-5'. --- music21/harmony.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/music21/harmony.py b/music21/harmony.py index 440d66bef..4f58a09d9 100644 --- a/music21/harmony.py +++ b/music21/harmony.py @@ -110,7 +110,7 @@ ('suspended-second', ['1,2,5', ['sus2']]), # Y ('suspended-fourth', ['1,4,5', ['sus', 'sus4']]), # Y ('suspended-fourth-seventh', ['1,4,5,-7', ['7sus', '7sus4']]), # Y - ('Neapolitan', ['1,2-,3,5-', ['N6']]), # Y + ('Neapolitan', ['1,-2,3,-5', ['N6']]), # Y ('Italian', ['1,#4,-6', ['It+6', 'It']]), # Y ('French', ['1,2,#4,-6', ['Fr+6', 'Fr']]), # Y ('German', ['1,-3,#4,-6', ['Gr+6', 'Ger']]), # Y From a6a13de1d101e18a37a7a48e48074838e062b068 Mon Sep 17 00:00:00 2001 From: Greg Chapman <75333244+gregchapman-dev@users.noreply.github.com> Date: Wed, 17 Apr 2024 15:33:54 -0700 Subject: [PATCH 3/5] If a chordsym has an alter for a degree not in the chord, turn it into an add. I'm assuming this is what "should we throw an exception???? for now yes, but maybe later we should" is referring to. --- music21/harmony.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/music21/harmony.py b/music21/harmony.py index 4f58a09d9..15a5542a7 100644 --- a/music21/harmony.py +++ b/music21/harmony.py @@ -1824,7 +1824,12 @@ def typeAlter(hD): elif chordStepModification.modType == 'subtract': typeSubtract(chordStepModification) elif chordStepModification.modType == 'alter': - typeAlter(chordStepModification) + try: + typeAlter(chordStepModification) + except ChordStepModificationException: + # fix it in place + chordStepModification.modType = 'add' + typeAdd(chordStepModification) return pitches From 60f9e4459158ef3ccedf36d84714aeeb75efd27f Mon Sep 17 00:00:00 2001 From: Michael Scott Asato Cuthbert Date: Thu, 25 Apr 2024 11:48:21 -1000 Subject: [PATCH 4/5] Fix docs to match --- music21/harmony.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/music21/harmony.py b/music21/harmony.py index 15a5542a7..8fcce313f 100644 --- a/music21/harmony.py +++ b/music21/harmony.py @@ -1134,7 +1134,7 @@ def chordSymbolFigureFromChord(inChord: chord.Chord, includeChordType=False): still be identified correctly even if it is missing the 5th 5. the type with the most identical matches is used, and if no type matches, "Chord Type Cannot Be Identified" is returned - 6. the output format for the chord symbol figure is the chord's root (with 'b' instead of '-'), + 6. the output format for the chord symbol figure is the chord's root, the chord type's Abbreviation (saved in CHORD_TYPES dictionary), a '/' if the chord is in an inversion, and the chord's bass @@ -1145,7 +1145,7 @@ def chordSymbolFigureFromChord(inChord: chord.Chord, includeChordType=False): Thus, by default the returned symbol is the first (element 0) in the CHORD_TYPES list. For example (Eb minor eleventh chord, second inversion): - root + chord-type-str + '/' + bass = 'Ebmin11/Bb' + root + chord-type-str + '/' + bass = 'E-min11/B-' Users who wish to change these defaults can simply change that entry in the CHORD_TYPES dictionary. @@ -1516,6 +1516,7 @@ class ChordSymbol(Harmony): You can also create a Chord Symbol by writing out each degree, and any alterations to that degree: + You must explicitly indicate EACH degree (a triad is NOT necessarily implied) >>> [str(p) for p in harmony.ChordSymbol('C35b7b9#11b13').pitches] @@ -1537,6 +1538,8 @@ class ChordSymbol(Harmony): >>> [str(p) for p in harmony.ChordSymbol('Db35').pitches] ['D3', 'F3', 'A3'] + (Note that this would be much better expressed just as 'Dm'.) + >>> [str(p) for p in harmony.ChordSymbol('D,35b7b9#11b13').pitches] ['D2', 'F#2', 'A2', 'E-3', 'G#3', 'B-3', 'C4'] From 28cfa0feea938340e7352e4d59342347bfee98a3 Mon Sep 17 00:00:00 2001 From: Michael Scott Asato Cuthbert Date: Thu, 25 Apr 2024 12:01:07 -1000 Subject: [PATCH 5/5] flake8 --- music21/harmony.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/music21/harmony.py b/music21/harmony.py index 8fcce313f..e6c2711f8 100644 --- a/music21/harmony.py +++ b/music21/harmony.py @@ -1516,7 +1516,7 @@ class ChordSymbol(Harmony): You can also create a Chord Symbol by writing out each degree, and any alterations to that degree: - + You must explicitly indicate EACH degree (a triad is NOT necessarily implied) >>> [str(p) for p in harmony.ChordSymbol('C35b7b9#11b13').pitches]