Hi Pierre-Luc,

Am 02.05.24 um 17:02 schrieb Pierre-Luc Gauthier:
Rambling here :

So, I *love* the simplicity and elegance of the \after command and I
am using it pretty much everywhere.

{
   <>(
   <>\<
   \after 2 \>
   \after 16*15 )
   \after 16*15 \!
   \repeat unfold 8 {e''16 d''} |
}

and since then I often end up doing head math to figure out what I
must add to \after for it to end up e.g. an 8th *before* the end of
the expression. In the above example it is quite easy :
a 16th before the end is... 16*#(- 16 1).

So what about a \beforeLast command that would do sort of the \after
job but starting from the end of the expression rather from the start
?
e.g. :
\beforeLast 16 \!

…
\pænultimus 16 )
\preantepenultimate 16 \!
^ Both above are strictly for laughing usage (provided it could have
such effect).

Should I :
https://gitlab.com/lilypond/lilypond/-/issues/new
and flag as Enhancement ?

Something like this?

%%%

\version "2.25.9"

fromEnd =
#(define-music-function (delta ev mus) (ly:duration? ly:music? ly:music?)
  (_i "Add music @var{ev} with a distance of @var{delta} before the end of

@var{ev} is usually a post-event.")
  #{
    \context Bottom
    <<
      {
        \skip $(make-duration-of-length (- (ly:music-length mus)
                                           (ly:duration-length delta)))
        <> $ev
      }
      #mus
  >> #})


{
  <>(
  <>\<
  \after 2 \>
  \after 16*15 )
  \fromEnd 16 \!
  \fromEnd 8 ->
  \repeat unfold 8 {e''16 d''} |
}

%%%%

\beforeLast (in the sense of "before the last note of the given music
argument") isn't likely to work though, since it's not guaranteed that
the music given is SequentialMusic: What is the last note of a << >>
expression?

Lukas


Reply via email to