Happy Holidays!
A number of versions ago, I created the following function to extend the top and bottom ends of the Arpeggio grob, which I find more aesthetically pleasing (generally), though I know it's not perfect:
\override Arpeggio.after-line-breaking =
#(lambda (grob)
(let* ((pos (ly:grob-property grob 'positions))
(p1 (car pos))
(p2 (cdr pos))
(btm (- p1 1.0))
(top (+ p2 0.5))
)
(ly:grob-set-property! grob 'positions (cons btm top))
))
It used to work perfectly (that I can remember), but now using either after-line-breaking or before-line-breaking, I can't get it to work correctly, especially when I need to use
\set PianoStaff.connectArpeggios = ##t.
Any thoughts as to why it no longer works and/or what I should be doing differently? Ideally, I'd like to use different values depending on if the associated note is in a space (like 1.0 space) or on a staff line (like 0.5 space), but I'd be happy with a single solution to start with like I have above.
Here's a small snippet showing the current default arpeggio in both single staff usage and cross-staff usage, another with my function used with before-line-breaking, and then finally the same function but with after-line-breaking. It almost works with before-line-breaking, but not the cross-staff one.
%<--------------------
\version "2.23"
\language "english"
\layout {
\set PianoStaff.connectArpeggios = ##t
}
pianoRH = \relative {
\clef treble
\time 3/4
\key bf \major
<< { d''4.\arpeggio ef8 c4 } \\ { <ef, gf>2.\arpeggio } >> |
<ef g bf ef>2.\arpeggio |
}
pianoLH = \relative {
\clef bass
ef8\arpeggio bf' c2 |
R2. |
}
\score {
\header {
piece = "Default"
}
<<
\new PianoStaff <<
\new Staff = "pianoRH" \pianoRH
\new Staff = "pianoLH" \pianoLH
>>
>>
\layout { }
}
\score {
\header {
piece = "Using before-line-breaking"
}
<<
\new PianoStaff <<
\new Staff = "pianoRH" \pianoRH
\new Staff = "pianoLH" \pianoLH
>>
>>
\layout {
\context {
\Score
\override Arpeggio.before-line-breaking =
#(lambda (grob)
(let* ((pos (ly:grob-property grob 'positions))
(p1 (car pos))
(p2 (cdr pos))
(btm (- p1 1.0))
(top (+ p2 0.5))
)
(ly:grob-set-property! grob 'positions (cons btm top))
))
}
}
}
\score {
\header {
piece = "Using after-line-breaking"
}
<<
\new PianoStaff <<
\new Staff = "pianoRH" \pianoRH
\new Staff = "pianoLH" \pianoLH
>>
>>
\layout {
\context {
\Score
\override Arpeggio.after-line-breaking =
#(lambda (grob)
(let* ((pos (ly:grob-property grob 'positions))
(p1 (car pos))
(p2 (cdr pos))
(btm (- p1 1.0))
(top (+ p2 0.5))
)
(ly:grob-set-property! grob 'positions (cons btm top))
))
}
}
}
%<---------------------------
Thanks,
Abraham