lilypond-user
[Top][All Lists]
Advanced

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

Re: Half-note stem length Function help


From: Simon Albrecht
Subject: Re: Half-note stem length Function help
Date: Thu, 15 Dec 2016 23:43:32 +0100

Hi Carl,


On 15.12.2016 23:20, Carl Williams wrote:
I can't quite get my head around the syntax, but all I want to do is measure if the note is a half-note, and then change the length of that one accordingly.

you actually got pretty far there! Here’s it with the missing bits inserted:

%%%%%%%%%%%%
\version "2.18.2"

shorten-stems =
#(lambda (grob)
   ;if note is a half-note,
   ;then make Stem.length = 15 (value of 15 is just for testing)
   (if (= 1 (ly:grob-property grob 'duration-log))
       (ly:grob-set-property! grob 'length 15)))

\layout {
  \context {
    \TabVoice
    \override Stem.before-line-breaking = \shorten-stems
  }
}

\new TabStaff \with {
  stringTunings = #ukulele-tuning
  \tabFullNotation
  \stemUp
} \relative c' {
  \partial 2.. a'8 a4 a2 |
  a1 |
}
%%%%%%%%%%%

So:
– Don’t use a music-function, instead assign a procedure with (grob) as argument – a so-called callback – to one of the properties before-line-breaking and after-line-breaking.
– Use ly:grob-set-property!
– In Scheme, comments are triggered by ; not %
– For an introduction and very instructive examples on Scheme extending have a look at the Extending Manual.

HTH, Simon



reply via email to

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