I found this code for slur-arrows in this question and adapted this answer to make it look nicer.
\version "2.22.0"
slurArrow =
\once \override Slur.stencil =
#(lambda (grob)
(let* ((slur-dir (ly:grob-property grob 'direction))
(right-bound (ly:spanner-bound grob RIGHT))
(right-bound-stem (ly:grob-object right-bound 'stem))
(right-bound-stem-dir
(if (ly:grob? right-bound-stem)
(ly:grob-property right-bound-stem 'direction)
#f))
(c-ps (ly:grob-property grob 'control-points))
(frst (car c-ps))
(thrd (caddr c-ps))
;;; corr-values are my choice
(corr (cond ((not right-bound-stem-dir)
'(0 . 0))
((= slur-dir (* -1 right-bound-stem-dir))
(cons -0.4 (* 0.2 slur-dir)))
(else '(-0.4 . 0.2))))
(frth (offset-add (cadddr c-ps) corr)))
(ly:grob-set-property! grob 'control-points
(append (list-head c-ps 3) (list frth)))
(ly:grob-set-property! grob 'line-thickness 0.8)
(ly:grob-set-property! grob 'thickness 1.2)
(let* ((orig (ly:grob-original grob))
(siblings (ly:spanner-broken-into orig)))
(if (or (null? siblings)
(equal? grob (car (last-pair siblings))))
(let* ((default-stil (ly:slur::print grob))
(default-stil-lngth
(interval-length (ly:stencil-extent default-stil X)))
(delta-x-cps (- (car frth) (car frst)))
(diff (- default-stil-lngth delta-x-cps))
(delta-iv
(cons (- (car frth) (car thrd)) (- (cdr frth) (cdr thrd))))
(radians->degree (lambda (radians) (/ (* radians 180) PI)))
(ang (radians->degree (atan (cdr delta-iv) (car delta-iv))))
(arrowhead (ly:font-get-glyph (ly:grob-default-font grob)
"arrowheads.close.01"))
(rotated-arrowhead (ly:stencil-rotate arrowhead ang 0 0))
(arrowhead-lngth
(interval-length (ly:stencil-extent rotated-arrowhead X))))
(ly:stencil-add
default-stil
(ly:stencil-translate
rotated-arrowhead
;; Ugh, 3.8 found by trial and error
(cons (+ diff (/ arrowhead-lngth 3.8) (car frth))
(+ (cdr frth) 0)))))
(ly:slur::print grob)))))
\relative c'' {
\slurArrow
c'4( c \bar "" \break c c)
\slurArrow
\slurDown
c4( c c c)
\slurArrow
\stemUp
\slurUp
c4( c d a)
%% maybe add:
% \shape #'((0 . 0)(0 . 0)(0 . -0.5)(0 . -0.5)) Slur
\slurArrow
\slurDown
c4( a) \slurArrow f( d)
}
Is it possible to define the same arrow-heads for the left side of the slur, so I could use something like:
\slurArrowR
for the arrow in the right side (like in the example)
\slurArrowL
for the arrow on the left side (Asking how it works...)
Edit:
I found a quite more complex example here. There is arrow heads on both sides, enabling to switch the function on and off, but no possibility to change between -->
and <--
on
andoff
switching of the scripts functionality. A was asking if anybody knows a way to createslurs
with an arrow on the left side of the bow:<--
The scripts of the examples I posted, create and arrow on the right-->
or on both sides<-->
of the bow. I hope I understood your comment in the right way. Love, Nathanael\layout
and place appropriate\override
s immediately before the slur you want to modify.