Am Sa., 27. Dez. 2025 um 07:15 Uhr schrieb Werner LEMBERG <[email protected]>:
>
>
> > Does this mean that I have to go through every note in a melody that
> > I want to add a fingering to, and put it in hairpin brackets?

We have the built-in event-chord-wrap! to wrap single rhythmic events
into event-chords.
Alas, it will not help you here unless you modify it:

#(define-public (partial-event-chord-wrap! music)
  "Wrap isolated rhythmic events and non-postevent events in
@var{music} inside of an @code{EventChord}.  Chord repeats @samp{q}
are expanded using the default settings of the parser."
  (map-some-music
   (lambda (m)
     (cond ((music-is-of-type? m 'event-chord)
            (if (pair? (ly:music-property m 'articulations))
                (begin
                  (set! (ly:music-property m 'elements)
                        (append (ly:music-property m 'elements)
                                (ly:music-property m 'articulations)))
                  (set! (ly:music-property m 'articulations) '())))
            m)
           ((music-is-of-type? m 'rhythmic-event)
            (let* ((arts (ly:music-property m 'articulations))
                   (finger-etc
                      (call-with-values
                        (lambda ()
                          (partition
                            (lambda (evt)
                              (or
                                (music-is-of-type? evt 'fingering-event)
                                (music-is-of-type? evt 'stroke-finger-event)
                                (music-is-of-type? evt 'string-number-event)))
                            arts))
                        cons)))
              (if (pair? arts)
                  (set! (ly:music-property m 'articulations) (car finger-etc)))
              (make-event-chord (cons m (cdr finger-etc)))))
           (else #f)))
   (expand-repeat-notes!
    (expand-repeat-chords!
     (cons 'rhythmic-event
           (ly:parser-lookup '$chord-repeat-events))
     music))))

partialEventChords =
#(define-music-function (music) (ly:music?)
   (_i "Compatibility function: Handle isolated rhythmic events in @var{music}.

Use this to wrap @code{EventChord} around isolated rhythmic events occuring
since version 2.15.28, after expanding repeat chords @samp{q}.
@code{FingeringEvent}, @code{StringNumberEvent} and @code{StrokeFingerEvent} at
isolated rhythmic events are not moved to the newly created @code{EventChord}.

Not needed for new code.")
   (partial-event-chord-wrap! music))


\score {
  \partialEventChords
  \new PianoStaff
  <<
     \new Staff {
       \clef "treble"
       \time 6/8
       \key c \major
       \set fingeringOrientations = #'(left)
       \set strokeFingerOrientations = #'(left)
       \set stringNumberOrientations = #'(left)

        e'2.-1\5\rightHandFinger #1
     }

     \new Staff {
       \clef "bass"
       \time 6/8
       \key c \major
       \set fingeringOrientations = #'(left)

       <c-5 e-3  g-1>2.
     }
  >>
}

I applied this new \partialEventChords generally, it could be applied
to selected parts as well.

CAVEAT:
It is not tested beyond the given code.
There were good reasons to change the ancient behavior (i.e. do all
with event-chords).
Please test thoroughly before you use it for serious work, there may
be draw-backs.

>
> LilyPond comes with two different fingering engines.  The simple one
> handles fingerings above and below a note, similar to other
> articulation like accents.  The advanced one applies to chords and can
> do handle more complex fingering layouts, including positioning to the
> left and right of a note.
>
> > Such a prospect seems incredibly cumbersome and dismays me.
>
> I guess that in most cases the simple engine suffices, no?

Speaking as someone often typing music for guitar:
No, in many cases the simple method is not sufficient.

Cheers,
  Harm

>
>
>     Werner
>

Reply via email to