lilypond-user
[Top][All Lists]
Advanced

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

Re: Position of rests


From: Thomas Morley
Subject: Re: Position of rests
Date: Sun, 9 Sep 2018 20:51:23 +0200

2018-09-09 19:47 GMT+02:00 Kieren MacMillan <address@hidden>:
> Hi Joram,
>
> How is your Scheme-fu?
> Maybe you can adapt one of the snippets that applies different tweaks (e.g., 
> color, shape) to notes of different duration.

Hi Joram,

a walk-through:

(1) Create code example:

{ r2 r1 }

(2) Initiate a most simple override

a) Try to go for the desired property directly, i.e. \override
Rest.staff-position = ...
b) Set it to a procedure, i.e. \override Rest.staff-position =
#(lambda (grob) ...)
Probably let the grob be displayed in terminal to ensure adressing the
correct one, i.e.:
{
  \override Rest.staff-position = #(lambda (grob) (display grob))
  r2 r1
}

(3) Get the duration
Here the 'duration-log will be enough, let it display to ensure corrrect coding

{
  \override Rest.staff-position =
  #(lambda (grob)
    (let ((dur (ly:grob-property grob 'duration-log)))
    (newline)
    (display dur)))
  r2 r1
}

(4) Add a condition relying on the value of duration-log and provide
appropriate values for 'staff-position

{
    \override Rest.staff-position =
    #(lambda (grob)
      (let ((dur (ly:grob-property grob 'duration-log)))
        (if (= 0 dur)
            6
            -6)))
    r2 r1
}

Ofcours 6, -6 are not really appropriate values ...



HTH,
  Harm



reply via email to

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