-
Notifications
You must be signed in to change notification settings - Fork 403
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
Apply tuplet to multiple components to express durations like 5/6 or 7/3 QL #1240
base: master
Are you sure you want to change the base?
Conversation
Doesn't work yet, but it's trying hard! Looks like the loop that creates all the components is just creating component after component, each with type smaller than the last, until it hits 8 iterations and gives up. Here's my test code snippet (note that your loop doesn't run until the first print, because of lazy components update):
|
Yeah, this looks usable for my case, although I really was hoping for a half rest, a quarter rest, and then the one eighth-rest triplet I really need.
Greg
… On Mar 1, 2022, at 5:41 PM, Jacob Walls ***@***.***> wrote:
@jacobtylerwalls commented on this pull request.
In music21/duration.py <#1240 (comment)>:
> # remove the largest type out there and keep going.
qLenRemainder = opFrac(qLen - typeToDuration[closestSmallerType])
+
+ # one opportunity to define a tuplet if remainder can be expressed as one
+ # by expressing the largest type (components[0]) in terms of the same tuplet
+ if isinstance(qLenRemainder, fractions.Fraction):
@gregchapman-dev <https://github.com/gregchapman-dev> game to take another look?
11/3 now gives this (and the consolidation back into quarter rests for the first three beats is then the task for #904 <#904>...)
<https://user-images.githubusercontent.com/38668450/156278441-fccef907-d427-4226-9e81-ab5799a44e90.png>
—
Reply to this email directly, view it on GitHub <#1240 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AR6X47EDQ36K7UCFTFN3KV3U53BMLANCNFSM5PUINDBA>.
You are receiving this because you were mentioned.
|
Right, that's next in #904. Hoping to ping you for a test then also :-) |
You bet.
|
This is looking good, but I don't think I want to go forward w/o allowing for the current usage as well, which is often seen in certain new complexity scores. I'd prefer only to merge when the #904/merging fix is also in, because I'm not sure that 11 rests for one note is definitely better than one strange tuplet in all cases. |
15f7c59
to
d34cf4f
Compare
Let me know when this is ready for a review. |
It's ready 🏁 |
# Do this again, since makeNotation() might create complex rests | ||
self.stream = self.stream.splitAtDurations(recurse=True)[0] |
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.
It's fairly rare to go through fixupNotationFlat()
, since even "flat" scores go through a "general object conversion". You'd need a not-well-formed score or makeNotation=False to end up here. So that's why I thought this was not terrible to do this twice (better than erroring out with complex duration failures).
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry I ahven't had a chance to look at this -- will try to get to it this week. |
Hi Jacob -- let me know if after everything this is still relevant -- this is one of the few PRs that I'll merge during sabbatical. Thanks! |
Yep, it's still solving the problem of a 5/6QL note looking bizarre when exported. Happy to give this a once-over myself for style/readability, but it should be ready for review as of now. Thanks for offering to look. |
I guess my biggest concern was and remains that I'm not so sure that:
is superior to:
even though the tuplet is way complex, there's something better about returning one note than seven. I think I'd merge immediately if the output were something like this:
or even:
And for this one:
we might see:
Would this work in the system? Either of these look superior to the current output and proposed new output. |
Fixes #572
Same PR as #763, just with conflicts fixed and commits squashed
Before: Durations such as 5/6 or 7/3 QL were expressed as non-power of 2 tuplets, which caused display problems.
Now: Upon extracting the largest type (such as 0.5 QL from 5/6 QL or 2.0 QL from 7/3 QL), if the remainder can be expressed as a single tuplet, express the largest type and the remainder in smaller components over which a tuplet can be applied.
@gregchapman-dev would you be able see if it helps with your
makeRests()
issues?This is not mergeable until we have a solution for #904. I have a diff for that I should be able to PR in a week or so--still testing it.Edit: done!