Skip to content

Commit fdb126c

Browse files
Roman Numerals: Don't substitute d for 0 in add10 (#1635)
1 parent 8baa273 commit fdb126c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

music21/roman.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2415,7 +2415,7 @@ def __init__(
24152415

24162416
# immediately fix low-preference figures
24172417
if isinstance(figure, str):
2418-
figure = figure.replace('0', 'o') # viio7
2418+
figure = re.sub(r'(?<!\d)0', 'o', figure) # viio7 (but don't alter 10.)
24192419
figure = figure.replace('º', 'o')
24202420
figure = figure.replace('°', 'o')
24212421
# /o is just a shorthand for ø -- so it should not be stored.
@@ -4349,6 +4349,10 @@ def testZeroForDiminished(self):
43494349
self.assertEqual([p.name for p in rn.pitches], ['B', 'D', 'F', 'A-'])
43504350
rn = roman.RomanNumeral('vii/07', 'c')
43514351
self.assertEqual([p.name for p in rn.pitches], ['B', 'D', 'F', 'A'])
4352+
# However, when there is a '10' somewhere in the figure, don't replace
4353+
# the 0 (this occurs in DCML corpora)
4354+
rn = roman.RomanNumeral('V7[add10]', 'c')
4355+
self.assertEqual([p.name for p in rn.pitches], ['G', 'B-', 'B', 'D', 'F'])
43524356

43534357
def testIII7(self):
43544358
c = chord.Chord(['E4', 'G4', 'B4', 'D5'])

0 commit comments

Comments
 (0)