Re: quoted tuplet bracket within staff
Kieren MacMillan writes: > Hi David, > >> I admit that I went for another dive into the IR for TupletBracket when >> outside-staff-priority failed to do the trick. Turns out that >> outside-staff-interface should be #f by default anyway? > > Please elaborate: > You believe the default is incorrect (in which case I will work up a patch)? > Or something else…? No, the default already is #f I think. -- David Kastrup
Re: quoted tuplet bracket within staff
Le 26/11/2021 à 16:19, Lukas-Fabian Moser a écrit : I never really understood the outside-staff behaviour, to be honest. If it seems complicated, that's because it is. There are two mechanisms for general collision avoidance, incarnated in the side-position-interface and the outside-staff-interface. First, LilyPond places all grobs according to how they define their coordinates. Side-positioned grobs compute theirs according to padding and horizon-padding relative to their support elements. The set of support elements is defined in a specific way for each grob. Thus padding (and horizon-padding) is basically a way to ask for a default padding in the normal case, e.g. the padding of a MultiMeasureRestScript from its MultiMeasureRest. The staff-padding property addresses a frequent case, which is keeping objects from the staff symbol. side-position-interface callbacks thus add the staff symbol as support automatically with a special padding, which is the value of staff-padding. The story does not end here, however. Once all grobs have been placed, LilyPond will look at all those having outside-staff-priority and review their placement and outlines. If there are any collisions, or if there are grobs with a lower outside-staff-priority placed above grobs with a higher outside-staff-priority (I think this is the criterion but I am not sure), it will shift around grobs. This is the process that uses the values of outside-staff-padding and outside-staff-horizon-padding. These conceptually define the small gap that you want LilyPond to insert between colliding grobs when the staff is crowded. Jean
Re: quoted tuplet bracket within staff
Hi David, > I admit that I went for another dive into the IR for TupletBracket when > outside-staff-priority failed to do the trick. Turns out that > outside-staff-interface should be #f by default anyway? Please elaborate: You believe the default is incorrect (in which case I will work up a patch)? Or something else…? Thanks, Kieren.
Re: quoted tuplet bracket within staff
Kieren MacMillan writes: > Hi all, > >>> I never really understood the outside-staff behaviour, to be >>> honest. It's well possible that there's an elegant solution that just >>> tells LilyPond to go ahead and put the tuplet bracket into the staff. >> Uh, that's what setting outside-staff-priority to #f does. > > Uh, that was the first thing I tried — didn't work. > >> Well, you got the wrong property here. outside-staff-priority tells how >> to stack outside-staff objects with one another. What you need here is >>\override CueVoice.TupletBracket.staff-padding = ##f >> to stop TupletBracket from being shy of the staff itself, never mind >> other outside-staff objects. > > There we go. I admit that I went for another dive into the IR for TupletBracket when outside-staff-priority failed to do the trick. Turns out that outside-staff-interface should be #f by default anyway? -- David Kastrup
Re: quoted tuplet bracket within staff
>> Well, you got the wrong property here. outside-staff-priority >> tells how to stack outside-staff objects with one another. What >> you need here is >> >> \override CueVoice.TupletBracket.staff-padding = ##f Aah, I only tried `padding` to no avail. Thanks a lot! > So, Werner, this should be the solution you were looking for? Yes, that's it! Again, thanks a lot to all of you wonderful guys who provided a solution within a few hours. Below is what I'm going to use. Werner == tuplet-up = { \override CueVoice.TupletBracket.staff-padding = ##f \override CueVoice.TupletBracket.padding = #1.5 \override CueVoice.TupletBracket.direction = #UP } x = { r2 \tuplet 3/2 { g4 a b } r2 \tuplet 3/2 { c'4 a g } } \addQuote "qx" \x { r2 \cueDuring #"qx" #DOWN { \tuplet-up r2 r2 r2 } }
Re: quoted tuplet bracket within staff
Hi all, >> I never really understood the outside-staff behaviour, to be >> honest. It's well possible that there's an elegant solution that just >> tells LilyPond to go ahead and put the tuplet bracket into the staff. > Uh, that's what setting outside-staff-priority to #f does. Uh, that was the first thing I tried — didn't work. > Well, you got the wrong property here. outside-staff-priority tells how > to stack outside-staff objects with one another. What you need here is >\override CueVoice.TupletBracket.staff-padding = ##f > to stop TupletBracket from being shy of the staff itself, never mind > other outside-staff objects. There we go. Thanks, Kieren Kieren MacMillan, composer (he/him/his) ‣ website: www.kierenmacmillan.info ‣ email: kie...@kierenmacmillan.info
Re: quoted tuplet bracket within staff
Well, you got the wrong property here. outside-staff-priority tells how to stack outside-staff objects with one another. What you need here is \override CueVoice.TupletBracket.staff-padding = ##f to stop TupletBracket from being shy of the staff itself, never mind other outside-staff objects. Got it - thanks! So, Werner, this should be the solution you were looking for? Lukas
Re: quoted tuplet bracket within staff
Lukas-Fabian Moser writes: >>> I never really understood the outside-staff behaviour, to be >>> honest. It's well possible that there's an elegant solution that just >>> tells LilyPond to go ahead and put the tuplet bracket into the staff. >> Uh, that's what setting outside-staff-priority to #f does. > > Did I mention I never really understood it? :-) Thanks! > > But actually, I'm still at a loss, as > > \version "2.23.4" > > x = { r2 \tuplet 3/2 { g4 a b } } > > \addQuote "qx" \x > > { > r2 \cueDuring #"qx" #DOWN { > \override CueVoice.TupletBracket.direction = #UP > \override CueVoice.TupletBracket.outside-staff-priority = ##f > > { r2 } > } > } > > stills creates the attached image. Well, you got the wrong property here. outside-staff-priority tells how to stack outside-staff objects with one another. What you need here is \override CueVoice.TupletBracket.staff-padding = ##f to stop TupletBracket from being shy of the staff itself, never mind other outside-staff objects. -- David Kastrup
Re: quoted tuplet bracket within staff
Lukas-Fabian Moser writes: >>> For a general solution, one could probably write a callback for the >> positions property. >> I was hoping to use #'outside-staff-priority to try to allow the >> tuplet to float into the staff automatically, but gave up after a >> few minutes of not finding the right incantation… > > I never really understood the outside-staff behaviour, to be > honest. It's well possible that there's an elegant solution that just > tells LilyPond to go ahead and put the tuplet bracket into the staff. Uh, that's what setting outside-staff-priority to #f does. -- David Kastrup
Re: quoted tuplet bracket within staff
I never really understood the outside-staff behaviour, to be honest. It's well possible that there's an elegant solution that just tells LilyPond to go ahead and put the tuplet bracket into the staff. Uh, that's what setting outside-staff-priority to #f does. Did I mention I never really understood it? :-) Thanks! But actually, I'm still at a loss, as \version "2.23.4" x = { r2 \tuplet 3/2 { g4 a b } } \addQuote "qx" \x { r2 \cueDuring #"qx" #DOWN { \override CueVoice.TupletBracket.direction = #UP \override CueVoice.TupletBracket.outside-staff-priority = ##f { r2 } } } stills creates the attached image. Lukas
Re: quoted tuplet bracket within staff
>> For a general solution, one could probably write a callback for the >> positions property. > > I was hoping to use #'outside-staff-priority to try to allow the > tuplet to float into the staff automatically, [...] Me too. Werner
Re: quoted tuplet bracket within staff
>>\override CueVoice.TupletBracket.direction = #DOWN >>\override CueVoice.TupletBracket.edge-height = #'(-0.7 . -0.7) >>\override CueVoice.TupletBracket.extra-offset = #'(0 . 4.75) >>\override CueVoice.TupletNumber.extra-offset = #'(0 . 4.75) > > Hold the heavy machinery :-). You can just set the positions directly: > > \override CueVoice.TupletBracket.positions = #'(-2 . -1) > \override CueVoice.TupletBracket.direction = #UP Nice, thanks. > For a general solution, one could probably write a callback for the > positions property. How difficult this is probably depends on the > use case: Werner, how similar are the instances in your score? Can > we assume a monotonous sequence of pitches? May we assume that the > bracket should always be above? I need this to make the staves use less vertical space so that more staves can be added to a part page. This means that a solution with `extra-offset` is not helpful. Additionally, walking over all triplets is tedious; there are a lot of them... However, Kieren's approach is nice: It takes the slant of the beam and simply shifts it up. In general I think this is what I want: Use the original slant and shift the bracket up until it no longer collides with the note heads (plus some padding). Werner
Re: quoted tuplet bracket within staff
For a general solution, one could probably write a callback for the positions property. I was hoping to use #'outside-staff-priority to try to allow the tuplet to float into the staff automatically, but gave up after a few minutes of not finding the right incantation… I never really understood the outside-staff behaviour, to be honest. It's well possible that there's an elegant solution that just tells LilyPond to go ahead and put the tuplet bracket into the staff. A poor man's automated solution might be: \version "2.23.4" x = { r2 \tuplet 3/2 { g4 a b } r2 \tuplet 3/2 { c'4 a g } } \addQuote "qx" \x { r2 \cueDuring #"qx" #DOWN { \override CueVoice.TupletBracket.positions = #(lambda (grob) (define (get-top direction) (cdr (ly:grob-property (ly:spanner-bound grob direction) 'Y-extent))) (cons (+ (get-top LEFT) 1.5) (+ (get-top RIGHT) 1.5))) \override CueVoice.TupletBracket.direction = #UP { r2 r2 r2 } } } Lukas
Re: quoted tuplet bracket within staff
Hi Lukas, > Hold the heavy machinery :-) LOL > You can just set the positions directly: Nice. > For a general solution, one could probably write a callback for the positions > property. I was hoping to use #'outside-staff-priority to try to allow the tuplet to float into the staff automatically, but gave up after a few minutes of not finding the right incantation… Cheers, Kieren.
Re: quoted tuplet bracket within staff
Hi Kieren & Werner, There's surely a more elegant way… but if you're stuck, you can always hack it: x = { r2 \tuplet 3/2 { g4 a b } } \addQuote "qx" \x { r2 \cueDuring #"qx" #DOWN { \override CueVoice.TupletBracket.direction = #DOWN \override CueVoice.TupletBracket.edge-height = #'(-0.7 . -0.7) \override CueVoice.TupletBracket.extra-offset = #'(0 . 4.75) \override CueVoice.TupletNumber.extra-offset = #'(0 . 4.75) r2 } } Hold the heavy machinery :-). You can just set the positions directly: \version "2.23.4" x = { r2 \tuplet 3/2 { g4 a b } } \addQuote "qx" \x { r2 \cueDuring #"qx" #DOWN { \override CueVoice.TupletBracket.positions = #'(-2 . -1) \override CueVoice.TupletBracket.direction = #UP r2 } } For a general solution, one could probably write a callback for the positions property. How difficult this is probably depends on the use case: Werner, how similar are the instances in your score? Can we assume a monotonous sequence of pitches? May we assume that the bracket should always be above? Lukas
Re: quoted tuplet bracket within staff
>> What must I do to make the tuplet bracket be positioned within the >> staff, that is, below the rest? > > There's surely a more elegant way… but if you're stuck, you can > always hack it: [...] Thanks a lot! Of course I would like to have a solution that avoids `extra-offset` :-) > x = { r2 \tuplet 3/2 { g4 a b } } > > \addQuote "qx" \x > > { >r2 \cueDuring #"qx" #DOWN { > \override CueVoice.TupletBracket.direction = #DOWN > \override CueVoice.TupletBracket.edge-height = #'(-0.7 . -0.7) > \override CueVoice.TupletBracket.extra-offset = #'(0 . 4.75) > \override CueVoice.TupletNumber.extra-offset = #'(0 . 4.75) > r2 >} > } Of course, the next question is how to have such a setting globally so that I don't have insert the bunch of overrides again and again... Werner
Re: quoted tuplet bracket within staff
Hi Werner, > What must I do to make the tuplet bracket be positioned > within the staff, that is, below the rest? There's surely a more elegant way… but if you're stuck, you can always hack it: x = { r2 \tuplet 3/2 { g4 a b } } \addQuote "qx" \x { r2 \cueDuring #"qx" #DOWN { \override CueVoice.TupletBracket.direction = #DOWN \override CueVoice.TupletBracket.edge-height = #'(-0.7 . -0.7) \override CueVoice.TupletBracket.extra-offset = #'(0 . 4.75) \override CueVoice.TupletNumber.extra-offset = #'(0 . 4.75) r2 } } Cheers, Kieren. Kieren MacMillan, composer (he/him/his) ‣ website: www.kierenmacmillan.info ‣ email: kie...@kierenmacmillan.info