lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Layout of a (piano) hand indicator


From: Andrew Bernard
Subject: Re: Layout of a (piano) hand indicator
Date: Sun, 6 May 2018 18:51:08 +1000

Hello foxfanfare,

I use this function from Simon a lot.

Here's a way to add extra parameters to this function. As an example, this lets you specify the length of the hook.

How is your Scheme coding skill? You'll notice the use of quasiquoting to get the length value where it is needed in the case.

Adding other parameters as you desire I leave as an exercise for the reader.


Andrew


=====

\version "2.19.81"

hook =
#(let ((direction? (lambda (n) (= 1 (abs n))))
       )

   (define-event-function (direction on-line len)
     (direction? boolean? number?)
     (let* ((self-al (if on-line 0.6 0.31))
            (self-al (if (= direction 1) (- self-al) self-al))
            (hook-markup #{
              \markup \path #0.175 #`((moveto 0 0)
                                      (rlineto -0.85 0)
                                      (rlineto 0 ,len))
              #})
            )
       #{
         \tweak self-alignment-Y $self-al
         \tweak extra-spacing-width #'(-.5 . 0)
         \finger \markup \scale #(cons 1 direction) #hook-markup
       #})))


\layout {
  \context {
    \Voice
    fingeringOrientations = #'(left)
  }
}

{
  <c''-\hook #DOWN ##f 2>4 <d''-\hook #UP ##t 6>
}

=====



reply via email to

[Prev in Thread] Current Thread [Next in Thread]