diff --git a/music21/pitch.py b/music21/pitch.py index 4fc680c1c0..11d117047a 100644 --- a/music21/pitch.py +++ b/music21/pitch.py @@ -5060,6 +5060,14 @@ def set_displayStatus(newDisplayStatus: bool): and cautionaryNotImmediateRepeat is False and pPastInMeasure is False): set_displayStatus(True) + + # Avoid making early, incorrect assumptions if this pitch is part of a chord. + # pPast might include this note itself, in which case we should not say + # "natural already in past usage". (Filtering out the current note from pPast + # when calling this method is not sufficient, because there could be repetitions.) + elif (self._client is not None and self._client._chordAttached is not None): + continue + # other cases: already natural in past usage, do not need # natural again (and not in key sig) else: diff --git a/music21/stream/base.py b/music21/stream/base.py index dad222cff6..a8f8e851cd 100644 --- a/music21/stream/base.py +++ b/music21/stream/base.py @@ -6367,6 +6367,7 @@ def makeAccidentals( Changed in v.6: does not return anything if inPlace is True. Changed in v.7: default inPlace is False + Changed in v.8: altered unisons in Chords now supply clarifying naturals. All arguments are keyword only. ''' @@ -6452,6 +6453,7 @@ def makeAccidentals( # when reading a chord, this will apply an accidental # if pitches in the chord suggest an accidental seenPitchNames = set() + pitchPast += e.pitches for n in list(e): p = n.pitch @@ -6477,7 +6479,6 @@ def makeAccidentals( for pName in seenPitchNames: tiePitchSet.add(pName) - pitchPast += e.pitches else: tiePitchSet.clear() diff --git a/music21/stream/tests.py b/music21/stream/tests.py index 8066efae4b..0e220b71ca 100644 --- a/music21/stream/tests.py +++ b/music21/stream/tests.py @@ -2609,9 +2609,9 @@ def testMakeAccidentalsA(self): s.makeAccidentals(inPlace=True) self.assertTrue(n2.pitch.accidental.displayStatus) - # both a's in the chord now have naturals but are hidden - self.assertIsNone(c1.pitches[1].accidental) - # self.assertTrue(c1.pitches[2].accidental.displayStatus) + # Both A-naturals in the chord show accidentals + self.assertTrue(c1.pitches[1].accidental.displayStatus) + self.assertTrue(c1.pitches[2].accidental.displayStatus) # not getting a natural here because of chord tones # self.assertTrue(n3.pitch.accidental.displayStatus)