6

I'm using Lilypond 2.20 on Ubuntu to engrave scores for the instrument pipa.

Slurs with arrow is a very common notation in many east Asian music pieces. It sounds similar to glissando in some degree, but not completely the same. The official Lilypond does not offer this out of box. I found some usable code from a German-speaking Lilypond forum. The code is pasted below.

enter image description here

The slur-with-arrow looks already handsome. I'd like the arrow head to be a bit more catching (bigger, and with a solid yet curved arrow head), and the slur line could be thicker too. My question is, how to modify the code below to achieve this? This might be a hardcore Lisp question.....My hat off to the original author of this code.

Here is a folk song from Taiwan containing many usages of this Asian glissando played on a pipa. Pay attention to the musican's left hand, the horizontal movement on a fret demonstrates how to play this kind of glissando. I haven't seen this on classical guitars yet. Very beautiful tunes:

\version "2.20.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)))

    (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.open.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)
}
3
  • By the way, this kind of "glissando" looks just like a normal string bend, which is not really used in the classical music but it is abundant in the more modern genres of guitar playing.
    – Ramillies
    Nov 9, 2020 at 16:08
  • @Ramillies So how do guitarists notate string bend in a score? Nov 9, 2020 at 22:27
  • 1
    Well, that's the problem :—). They mostly don't because the people who use them don't read or write scores. I wasn't objecting to your notation, I just wanted to react to your statement that you have never seen something like that on the guitar.
    – Ramillies
    Nov 10, 2020 at 9:30

1 Answer 1

6

change arrowheads.open.01 to arrowheads.close.01

for thickness insert these two lines after (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)

experiment with the values (0.8 and 1.2) of these new lines - they are set to defaults for now

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.