Skip to content

Commit

Permalink
Merge pull request #1374 from malcolmsailor/master
Browse files Browse the repository at this point in the history
  • Loading branch information
mscuthbert authored Aug 12, 2022
2 parents 59e1223 + d0d9d4f commit 1a0ec50
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions music21/romanText/tsvConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,11 @@ def handleAddedTones(dcmlChord: str) -> str:
>>> romanText.tsvConverter.handleAddedTones('ii6(11#7b6)')
'ii6[no8][no5][add11][add#7][addb6]'
'0' can be used to indicate root-replacement by 7 in a root-position chord.
We need to change '0' to '7' because music21 changes the 0 to 'o' (i.e.,
a diminished chord).
>>> romanText.tsvConverter.handleAddedTones('i(#0)')
'i[no1][add#7]'
'''
m = re.match(
r'(?P<primary>.*?(?P<figure>\d*(?:/\d+)*))\((?P<added_tones>.*)\)(?P<secondary>/.*)?',
Expand All @@ -971,7 +975,7 @@ def handleAddedTones(dcmlChord: str) -> str:
(\+|-)? # indicates whether to add or remove chord factor
(\^|v)? # indicates whether tone replaces chord factor above/below
(\#+|b+)? # alteration
(1\d|\d) # figures 0-19, in practice 1-14
(1\d|\d) # figures 0-19, in practice 0-14
''',
added_tones,
re.VERBOSE
Expand Down Expand Up @@ -1004,6 +1008,8 @@ def handleAddedTones(dcmlChord: str) -> str:
omissions.append(f'[no{factor + 1}]')
else:
omissions.append(f'[no{factor - 1}]')
if factor == 0:
factor = 7
additions.append(f'[add{alteration}{factor}]')
return primary + ''.join(omissions) + ''.join(additions) + secondary

Expand Down

0 comments on commit 1a0ec50

Please sign in to comment.