Skip to content

Commit

Permalink
Merge b70072f into 2e1a8e7
Browse files Browse the repository at this point in the history
  • Loading branch information
mscuthbert committed Mar 23, 2020
2 parents 2e1a8e7 + b70072f commit 2787f32
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 77 deletions.
14 changes: 14 additions & 0 deletions music21/roman.py
Original file line number Diff line number Diff line change
Expand Up @@ -1390,10 +1390,17 @@ def __init__(self, figure=None, keyOrScale=None, caseMatters=True, **keywords):
self.caseMatters = False
figure = common.toRoman(figure)

# immediately fix low-preference figures
if isinstance(figure, str):
figure = figure.replace('0', 'o') # viio7

if isinstance(figure, str):
# /o is just a shorthand for ø -- so it should not be stored.
figure = figure.replace('/o', 'ø')

# end immediate fixes


# Store raw figure before calling setKeyOrScale:
self._figure = figure
# This is set when _setKeyOrScale() is called:
Expand Down Expand Up @@ -2908,6 +2915,13 @@ def p(c):
rn = roman.RomanNumeral('Sw43', k)
self.assertEqual(p(rn), 'F5 A5 B#5 D#6')

def testZeroForDiminished(self):
from music21 import roman
rn = roman.RomanNumeral('vii07', 'c')
self.assertEqual([p.name for p in rn.pitches], ['B', 'D', 'F', 'A-'])
rn = roman.RomanNumeral('vii/07', 'c')
self.assertEqual([p.name for p in rn.pitches], ['B', 'D', 'F', 'A'])

def testIII7(self):
c = chord.Chord(['E4', 'G4', 'B4', 'D5'])
k = key.Key('C')
Expand Down
Loading

0 comments on commit 2787f32

Please sign in to comment.