Repository: cuthbertLab/music21 (python)

Issue:
Make cautionaryPitchClass work inside a single chord
**Motivation**
`cautionaryPitchClass=True` could make the following example print an F-natural at the bottom.

```python
>>> c = chord.Chord('F4 F#5')
>>> c.show()
```
Current:
![Screen Shot 2022-02-18 at 2 02 42 PM](https://user-images.githubusercontent.com/38668450/154745938-80a68f1e-09fe-4b72-bdd7-8dd9a722a4d7.png)


**Feature summary**
I think this could be on by default, even in a diatonic context. Or we can just do this in keyless contexts.

**Proposed implementation**
Similar to #1190 , maybe handle in tandem

**Intent**
<!-- Please check one or more boxes -->

[x] I plan on implementing this myself
[ ] I am willing to pay to have this feature added.
[ ] I am starting a discussion with the hope that community members will volunteer their time to create this. I understand that individuals work on features of interest to them and that this feature may never be implemented.

Pull request description:
Make cautionaryPitchClass=True work with chords
Fixes #1227 

Patch:
diff --git a/music21/pitch.py b/music21/pitch.py
index 250dc7235..c23d38cd3 100644
--- a/music21/pitch.py
+++ b/music21/pitch.py
@@ -5039,6 +5039,14 @@ class Pitch(prebase.ProtoM21Object):
                       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 961420a92..7e8d90544 100644
--- a/music21/stream/base.py
+++ b/music21/stream/base.py
@@ -6368,6 +6368,7 @@ class Stream(core.StreamCore, Generic[M21ObjType]):
 
         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.
         '''
@@ -6453,6 +6454,7 @@ class Stream(core.StreamCore, Generic[M21ObjType]):
                 # 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
@@ -6478,7 +6480,6 @@ class Stream(core.StreamCore, Generic[M21ObjType]):
                 for pName in seenPitchNames:
                     tiePitchSet.add(pName)
 
-                pitchPast += e.pitches
             else:
                 tiePitchSet.clear()
 


Test patch:
diff --git a/music21/stream/tests.py b/music21/stream/tests.py
index 8066efae4..0e220b71c 100644
--- a/music21/stream/tests.py
+++ b/music21/stream/tests.py
@@ -2609,9 +2609,9 @@ class Test(unittest.TestCase):
         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)