diff --git a/music21/roman.py b/music21/roman.py index 9db846d710..395baaee08 100644 --- a/music21/roman.py +++ b/music21/roman.py @@ -1597,7 +1597,8 @@ class RomanNumeral(harmony.Harmony): >>> rn_minor_64_secondary.secondaryRomanNumeral - Dominant 7ths can be specified by putting d7 at end: + Dominant 7ths can be specified by the character 'd' followed by the figure + indicating the inversion of the chord: >>> r = roman.RomanNumeral('bVIId7', key.Key('B-')) >>> r.figure @@ -1606,13 +1607,20 @@ class RomanNumeral(harmony.Harmony): >>> cp(r) ['A-5', 'C6', 'E-6', 'G-6'] - >>> r = roman.RomanNumeral('VId7') + >>> r = roman.RomanNumeral('VId42') >>> r.figure - 'VId7' + 'VId42' >>> r.key = key.Key('B-') >>> cp(r) - ['G5', 'B5', 'D6', 'F6'] + ['F5', 'G5', 'B5', 'D6'] + + >>> r = roman.RomanNumeral('IVd43', key.Key('B-')) + >>> r.figure + 'IVd43' + + >>> cp(r) + ['B-4', 'D-5', 'E-5', 'G5'] >>> r2 = roman.RomanNumeral('V42/V7/vi', key.Key('C')) >>> cp(r2) @@ -1803,6 +1811,11 @@ class RomanNumeral(harmony.Harmony): >>> cp(r) ['G5', 'B5', 'D6', 'F6'] + >>> r = roman.RomanNumeral('IVd6/5') + >>> r.key = key.Key('Eb') + >>> cp(r) + ['C5', 'E-5', 'G-5', 'A-5'] + >>> r = roman.RomanNumeral('vio', em) >>> cp(r) ['C#5', 'E5', 'G5'] @@ -2361,10 +2374,14 @@ def _setImpliedQualityFromString(self, workingFigure): workingFigure = workingFigure[1:] impliedQuality = 'augmented' # impliedQualitySymbol = '+' - elif workingFigure.endswith('d7'): + elif 'd' in workingFigure: + m = re.match(r'(?P.*)d(?P
7|6/?5|4/?3|4/?2|2)$', workingFigure) + if m is None: + raise RomanException( + f'Cannot make a dominant-seventh chord out of {workingFigure}. ' + "Figure should be in ('7', '65', '43', '42', '2').") # this one is different - # # TODO(msc): what about d65, etc.? - workingFigure = workingFigure[:-2] + '7' + workingFigure = m.group('leading') + m.group('figure') impliedQuality = 'dominant-seventh' # impliedQualitySymbol = '(dom7)' elif self.caseMatters and self.romanNumeralAlone.upper() == self.romanNumeralAlone: