-
Notifications
You must be signed in to change notification settings - Fork 406
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
voice.makeRests() fills in missing notes in tuplets incorrectly #1237
Comments
What happens if you give a time signature? |
Same thing. (The real case has one)
… On Feb 27, 2022, at 2:36 PM, Michael Scott Cuthbert ***@***.***> wrote:
What happens if you give a time signature?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
I take it back!
If I put a time signature in the Voice itself, this works correctly.
In the real case, the time signature occurred earlier in the score. But the Voice is not yet inserted when I do the makeRests(), so it doesn’t know. I will try putting it in the score first, to see if that helps.
Greg
… On Feb 27, 2022, at 2:47 PM, Greg Chapman ***@***.***> wrote:
Same thing. (The real case has one)
> On Feb 27, 2022, at 2:36 PM, Michael Scott Cuthbert ***@***.***> wrote:
>
>
>
> What happens if you give a time signature?
>
> —
> Reply to this email directly, view it on GitHub <#1237 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AR6X47ERKW3MOFQYCBEPEEDU5KRNZANCNFSM5PPONFFQ>.
> You are receiving this because you authored the thread.
>
|
Ah. So it only works if the time signature is in the Voice itself. Having the voice inserted into the measure (which has an implied time signature from a previous measure) doesn’t help.
So I do need a fix here.
Greg
… On Feb 27, 2022, at 2:55 PM, Greg Chapman ***@***.***> wrote:
I take it back!
If I put a time signature in the Voice itself, this works correctly.
In the real case, the time signature occurred earlier in the score. But the Voice is not yet inserted when I do the makeRests(), so it doesn’t know. I will try putting it in the score first, to see if that helps.
Greg
> On Feb 27, 2022, at 2:47 PM, Greg Chapman ***@***.*** ***@***.***>> wrote:
>
> Same thing. (The real case has one)
>
>> On Feb 27, 2022, at 2:36 PM, Michael Scott Cuthbert ***@***.*** ***@***.***>> wrote:
>>
>>
>>
>> What happens if you give a time signature?
>>
>> —
>> Reply to this email directly, view it on GitHub <#1237 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AR6X47ERKW3MOFQYCBEPEEDU5KRNZANCNFSM5PPONFFQ>.
>> You are receiving this because you authored the thread.
>>
|
Most likely another manifestation of #904. When you say this works with a time signature (albeit not in a real world scenario), what is the result? A half rest, quarter rest, and two triplet eighths? If so, I would have thought #992 was needed for that (speaking of which, the procedure described there is probably your best workaround for now). |
I was wrong, in several ways. Nothing I have done so far actually makes a rest with a reasonable tuplet. I am investigating further.
Greg
… On Feb 27, 2022, at 3:02 PM, Greg Chapman ***@***.***> wrote:
Ah. So it only works if the time signature is in the Voice itself. Having the voice inserted into the measure (which has an implied time signature from a previous measure) doesn’t help.
So I do need a fix here.
Greg
> On Feb 27, 2022, at 2:55 PM, Greg Chapman ***@***.*** ***@***.***>> wrote:
>
> I take it back!
>
> If I put a time signature in the Voice itself, this works correctly.
>
> In the real case, the time signature occurred earlier in the score. But the Voice is not yet inserted when I do the makeRests(), so it doesn’t know. I will try putting it in the score first, to see if that helps.
>
> Greg
>
>> On Feb 27, 2022, at 2:47 PM, Greg Chapman ***@***.*** ***@***.***>> wrote:
>>
>> Same thing. (The real case has one)
>>
>>> On Feb 27, 2022, at 2:36 PM, Michael Scott Cuthbert ***@***.*** ***@***.***>> wrote:
>>>
>>>
>>>
>>> What happens if you give a time signature?
>>>
>>> —
>>> Reply to this email directly, view it on GitHub <#1237 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AR6X47ERKW3MOFQYCBEPEEDU5KRNZANCNFSM5PPONFFQ>.
>>> You are receiving this because you authored the thread.
>>>
>
|
Another very similar discussion at #572. |
I have tried a LOT of things now… Here’s the latest attempt, with everything but the kitchen sink thrown in.
The rest that makeRests creates is still that weird tuplet (12 notes in the space of 11).
Jacob, thanks for the pointer to #904. I’ll try that procedure described there as a workaround now.
restVoice = m21.stream.Voice()
timesig = m21.meter.TimeSignature('4/4')
restVoice.insert(0, timesig)
secondNote = m21.note.Rest()
secondNote.duration = m21.duration.Duration(Fraction(1, 3))
restVoice.insert(Fraction(11, 3), secondNote)
restVoice.makeRests(inPlace=True,
hideRests=True,
fillGaps=True,
timeRangeFromBarDuration=True,
refStreamOrTimeRange=timesig)
firstNote = restVoice.notesAndRests[0]
print('firstNote = ', firstNote)
print('firstNote tuplets = ', firstNote.duration.tuplets)
print('secondNote = ', secondNote)
print('secondNote tuplets = ', secondNote.duration.tuplets)
print('')
<stdout>
firstNote = <music21.note.Rest 11/3ql>
firstNote tuplets = (<music21.duration.Tuplet 12/11/16th>,)
secondNote = <music21.note.Rest 1/3ql>
secondNote tuplets = (<music21.duration.Tuplet 3/2/eighth>,)
|
OK, I tried using duration.TupletFixer, and it finds the right tupletGroup, but then fails to correct it, saying:
Crazy! 4.0 2.75 16/11
(once I uncommented that print, and fixed a typo in it)
I don’t blame it, I can’t get my head around what that first tuplet means, either.
Greg
|
Here's my code for that use of TupletFixer:
|
Thanks for looking into some workarounds. I'll be closing as a duplicate of #572, but I went ahead and re-opened a PR to fix it (#1240), so I'm hoping you might test it out. It's not truly mergeable until we have a solution for #904, but I'll open something for that soon and figured this way testing/feedback could get going, if you have some. Thanks. |
music21 version
7.2.1
Problem summary
If I put a single triplet eighth-note rest at the end of a 3-quarter-note voice (leaving a starting gap of 11 triplet eighth notes) and then call makeRests, it inserts a rest with duration.tuplets = (<music21.duration.Tuplet 12/11/16th>,) instead of what I would expect: duration.tuplets = (<music21.duration.Tuplet 3/2/eighth>,). The actual duration.quarterLength is correct (11/3ql), but I don't understand that weird tuplet choice (12 actual 16th notes in the space of 11 normal 16th notes).
Steps to reproduce
Expected vs. actual behavior
More information
The text was updated successfully, but these errors were encountered: