-
Notifications
You must be signed in to change notification settings - Fork 405
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
Handle endings in TSV -> music21 conversion #1503
Conversation
Merge remote-tracking branch 'upstream/master' into tsv_endings
Great thanks @malcolmsailor ! Wrt
Surely we want that included? I don't see what'd be gained by omitting it. Apologies if I've got the wrong end of the stick! |
Yes, I do mean omitting that repeat bar. Because we don't know where the corresponding forward repeat bar would be, so including it would lead to incoherent repeats. Moreover we don't necessarily know where the first ending repeat-bar should go either. For example, consider a TSV looking something like this
This is ambiguous between what could be written in romanText as
and
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, but see note on typing. If the TSV team would be willing to add mypy typing for the module, it'd help me from not needing to do it later (getting frustrated, etc., because I don't know the code well, etc.) -- it mostly means not allowing "None" for variables that are clearly meant to be strings.
music21/romanText/tsvConverter.py
Outdated
@@ -410,6 +407,7 @@ def __init__(self): | |||
super().__init__() | |||
self.mn = None | |||
self.mn_onset = None | |||
self.volta = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mentioning this because it's an addition, but it's the same for all of these. It would be better if the default for these was not None but '' because this sets the typing of the usage later. We're heading towards > 90% typing in mypy so it would be very helpful if these could be typed and if the typing was not str | None
but just str
which requires a '' default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice for instance, that you're not doing "and thisChord.volta is not None" but instead just "and thisChord.volta" so setting the default to an empty string won't cause a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK added some type hints in a new commit. Also initialized to the empty string where that didn't cause any hassle.
looks good to me. Merging. Happy New Year! |
In a #1412 (comment), I proposed the following two options for resolving the issue of 1st and 2nd endings being written to the same measure in TSV conversion:
In discussion at MarkGotham/When-in-Rome#58 (comment), @MarkGotham expressed a preference for option 1, and no one else seemed to express a preference, so that's what this PR implements.
One remaining issue (raised in the comments of my code) is