Skip to content

Commit

Permalink
Fix problem with add#7
Browse files Browse the repository at this point in the history
Fixes #1369
  • Loading branch information
mscuthbert committed Aug 12, 2022
1 parent c538fb8 commit 3126a67
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion music21/roman.py
Original file line number Diff line number Diff line change
Expand Up @@ -3075,6 +3075,12 @@ def _updatePitches(self):
while addedPitch.ps < bassPitch.ps:
addedPitch.octave += 1

if (addedPitch.ps == bassPitch.ps
and addedPitch.diatonicNoteNum < bassPitch.diatonicNoteNum):
# RN('IV[add#7]', 'C') would otherwise result
# in E#4 as bass, not E#5 as highest note.
addedPitch.octave += 1

if addedPitch not in self.pitches:
self.add(addedPitch)

Expand Down Expand Up @@ -4280,7 +4286,14 @@ def new_fig_equals_old_figure(rn_in, k='C'):
self.assertEqual(rn4.figure, 'iv42[#7]')
new_fig_equals_old_figure(rn4, 'g')


def test_addedPitch_sharp7(self):
'''
Fixes issue #1369
'''
rn = RomanNumeral('IV[add#7]', 'C')
self.assertEqual(rn.bass().nameWithOctave, 'F4')
self.assertEqual([p.nameWithOctave for p in rn.pitches],
['F4', 'A4', 'C5', 'E#5'])

class TestExternal(unittest.TestCase):
show = True
Expand Down

0 comments on commit 3126a67

Please sign in to comment.