Skip to content

Commit

Permalink
don't match 'add13' when performing dominant 'd' substitution
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolmsailor committed Jul 17, 2023
1 parent 8baa273 commit 3babd94
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions music21/romanText/tsvConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,15 @@ def _changeRepresentation(self) -> None:
self.extra.get('chord_type', '') == 'Mm7'
and self.numeral != 'V'
):
# we need to make sure not to match [add4] and the like
self.chord = re.sub(r'(\d+)(?!])', r'd\1', self.chord)
# we need to make sure not to match [add13] and the like
self.chord = re.sub(
r'''
(\d+) # match one or more digits
(?![\]\d]) # without a digit or a ']' to the right
''',
r'd\1',
self.chord,
flags=re.VERBOSE)

# Local - relative and figure
if isMinor(self.local_key):
Expand Down

0 comments on commit 3babd94

Please sign in to comment.