Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

match d43, d65, etc. #1363

Merged
merged 3 commits into from
Aug 10, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions music21/roman.py
Original file line number Diff line number Diff line change
Expand Up @@ -1606,13 +1606,20 @@ class RomanNumeral(harmony.Harmony):
>>> cp(r)
['A-5', 'C6', 'E-6', 'G-6']

>>> r = roman.RomanNumeral('VId7')
>>> r = roman.RomanNumeral('VId2')
>>> r.figure
'VId7'
'VId2'
malcolmsailor marked this conversation as resolved.
Show resolved Hide resolved

>>> 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)
Expand Down Expand Up @@ -1785,6 +1792,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']

mscuthbert marked this conversation as resolved.
Show resolved Hide resolved
>>> r = roman.RomanNumeral('vio', em)
>>> cp(r)
['C#5', 'E5', 'G5']
Expand Down Expand Up @@ -2334,10 +2346,9 @@ def _setImpliedQualityFromString(self, workingFigure):
workingFigure = workingFigure[1:]
impliedQuality = 'augmented'
# impliedQualitySymbol = '+'
elif workingFigure.endswith('d7'):
elif m := re.match(r'(?P<leading>.*)d(?P<figure>7|6/?5|4/?3|4/?2|2)$', workingFigure):
malcolmsailor marked this conversation as resolved.
Show resolved Hide resolved
# 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:
Expand Down