Am So., 24. Mai 2026 um 19:37 Uhr schrieb jeff <[email protected]>:
>
> Hello,
>
> I am trying to notate a guitar bend & release (half tone) on a single
> note in standard notation (not tablature).
>
> I managed to draw two curves using \path and \arrow-head with \rotate
> inside a \markup \overlay, but I cannot get the arrow heads to align
> precisely with the endpoints of the curves. The rotation offset makes
> exact positioning very difficult.
>
> Here is my current attempt:
>
> \version "2.24.4"
>
> bendRelease =
> #(define-music-function (note) (ly:music?)
>    #{
>      \once \override TextScript.outside-staff-priority = #50
>      \once \override TextScript.padding = #0.5
>      $note
>      ^\markup {
>        \overlay {
>          \translate #'(1.45 . 2.5)
>          \fontsize #-7 "1/2"
>          \path #0.1
>          #'((moveto 0 0)
>             (curveto 0.2 0.5 0.8 2 1.2 2.5))
>          \path #0.1
>          #'((moveto 1.8 2.5)
>             (curveto 2.2 2 2.8 0.5 3 0))
>          \translate #'(1.15 . 2.45)
>          \rotate #-45
>          \arrow-head #Y #UP ##f
>          \translate #'(2.95 . 0.05)
>          \rotate #45
>          \arrow-head #Y #DOWN ##f
>        }
>      }
>    #})
>
> \score {
>    \new Staff {
>      \clef treble
>      \time 4/4
>      \bendRelease cis''4
>      d''4 e''4 f''4 |
>    }
> }
>
> My questions are:
> 1. Is there a cleaner way to attach arrow heads precisely to the
> endpoints of a \path curve?
> 2. Is there an existing snippet on LSR or OpenLilyLib that handles
> guitar bend & release notation in standard staff (not TabStaff)?
> 3. Would a Scheme-level stencil approach give better control over arrow
> placement?
>
> Thanks in advance for any advice.
>
> Best regards
>
>

I once implemented the BendSpanner for use in TabStaff, I never found
the needed time to do similar for Voice, though.
That said, the engraver, grob etc works in Voice as well (more or
less), you'll need to change the default settings.

Before showing the code, as a musician, I do not understand your request:
If you bend cis'' to d'' then there is no need for a release, because
the d'' is already reached.
Or in other words, its _impossible_ to go _down_ from d'' to d''.
Or do you mean something else?

For the arrow-head:
In my experience the unfilled arrow-head never yields convincing
results here. Thus the default is a filled one (constructed from
cratch).
Nevertheless I copied some code from
input/regression/bend-spanner-details.ly to show the unfilled one.
Comment
  \override BendSpanner.after-line-breaking = #set-feta-arrow-stencil!
to switch to the default.

%% switch to arrow heads from feta
%% REMARK the result is not overwhelming, it does not scale properly with
%% changed fontSize, a TODO.
%% Maybe a better result happens if the arrow heads are slightly rotated,
%% relying on the curve's control-points
#(define (feta-arrow-head dir)
  (lambda (grob)
    (let* ((layout (ly:grob-layout grob))
           (props (ly:grob-alist-chain grob))
           (font (ly:paper-get-font layout (cons '((font-encoding . fetaMusic)
                                                   (font-name . #f))
                                                 props)))
           (glyph-string
             (format #f "arrowheads.open.1~a1" (if (> dir -1) "" "M"))))
      (ly:font-get-glyph font glyph-string))))

#(define set-feta-arrow-stencil!
  (lambda (grob)
    (ly:grob-set-nested-property! grob '(details arrow-stencil)
      (lambda (a b c d e) ;; thickness end-curve-coords height width dir
        (let* ((new-stil ((feta-arrow-head e) grob))
               (new-stil-y-ext (ly:stencil-extent new-stil Y))
               (new-stil-y-length (interval-length new-stil-y-ext))
               (font-size (ly:grob-property grob 'font-size))
               (size-factor (magstep font-size))
               (thick (ly:grob-property grob 'thickness))
               (staff-symbol-line-thickness
                 (ly:staff-symbol-line-thickness grob))

               (bend-line-thickness
                 (* staff-symbol-line-thickness
                    size-factor
                    (ly:grob-property grob 'thickness))))
        (ly:grob-set-nested-property! grob '(details bend-arrowhead-height)
            (if (> e -1)
                (- (cdr new-stil-y-ext) bend-line-thickness)
                (+ (car new-stil-y-ext) bend-line-thickness)))

        (ly:stencil-translate
          new-stil
          (cons
            (car b)
            (+ (cdr b)
               (* e new-stil-y-length)))))))))

\layout {
  \context {
      \Voice
      \consists Bend_spanner_engraver
  }
}

{
  \override BendSpanner.Y-offset = 1
  \override BendSpanner.details.y-distance-from-tabstaff-to-arrow-tip = 2
  \override BendSpanner.details.curvature-factor = #0
  \override BendSpanner.details.horizontal-left-padding = #-0.5
  \override BendSpanner.after-line-breaking = #set-feta-arrow-stencil!
  cis''4\^ d'' e'' f''
}

HTH,
  Harm

Attachment: atest-122.preview.pdf
Description: Adobe PDF document

Reply via email to