|
From: | Jean Abou Samra |
Subject: | Re: making arpeggios with straight lines |
Date: | Sun, 11 Jun 2023 18:33:22 +0200 |
User-agent: | Evolution 3.48.3 (3.48.3-1.fc38) |
Le dimanche 11 juin 2023 à 12:18 -0400, John Asmuth a écrit :
Hi everyone, I'm trying to draw an up or down arrow next to a chord. This is common notation in classical guitar for strum direction.
It seems that the most likely way to make this happen is to use \arpeggio and set the arpeggio stencil to draw a straight line. I saw https://lists.gnu.org/archive/html/lilypond-user/2019-12/msg00080.html that gives some hints about how to do stencils but maybe a more clear tutorial or set of examples would help.
Or, perhaps, there's a better way to do this. I am, of course, open to any suggestion.
Try something like this?
\version "2.24.1"
arrow =
\tweak stencil
#(lambda (grob)
(match-let*
((staff-space
(ly:staff-symbol-staff-space grob))
((and positions (bottom . top))
(interval-scale (ly:grob-property grob 'positions)
staff-space))
(dir (ly:grob-property grob 'arpeggio-direction)))
(grob-interpret-markup
grob
#{
\markup \overlay {
\path #0.3
#`((moveto ,0 ,bottom)
(lineto ,0 ,top))
\translate #(cons 0 (interval-index positions dir))
\general-align #Y #(- dir)
\arrow-head #Y #dir ##t
}
#})))
\arpeggio
arrowUp = \tweak arpeggio-direction #UP \arrow
arrowDown = \tweak arpeggio-direction #DOWN \arrow
{ <c' c''>2\arrowUp q\arrowDown }
Best,
Jean
signature.asc
Description: This is a digitally signed message part
[Prev in Thread] | Current Thread | [Next in Thread] |