lilypond-user
[Top][All Lists]
Advanced

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

Re: Parameterizing a LilyPond function


From: David Nalesnik
Subject: Re: Parameterizing a LilyPond function
Date: Sun, 2 Dec 2012 14:59:33 -0600

Hi Peter,

On Sun, Dec 2, 2012 at 2:36 PM, PMA <address@hidden> wrote:
> Hi List.
>
> I would like to alter this function...
>
> glissmove = {
>   \once \override Glissando #'(bound-details left Y) = #1.3
>   \once \override Glissando #'(bound-details right Y) = #1.3
> }
>
> to accept its 1.3 or whatever as an input parameter instead.
>
> I see docs on parameterizing Scheme functions, but not on
> doing this in LilyPond directly -- LP's param handing syntax.
> Have I overlooked something obvious?
>

Here you need to define a music function.  Something like the following:

\version "2.16.1"

glissmove =
#(define-music-function (parser location left-Y right-Y)
 (number? number?)
 #{
   \once \override Glissando #'(bound-details left Y) = #left-Y
   \once \override Glissando #'(bound-details right Y) = #right-Y
 #})

\relative c' {
  \glissmove #1.3 #1.3 c2\glissando c'
}

Note that if you're using one of the newer development versions, you
can write the overrides with nicer-looking syntax:

glissmove =
#(define-music-function (parser location left-Y right-Y)
 (number? number?)
 #{
   \once \override Glissando.bound-details.left.Y = #left-Y
   \once \override Glissando.bound-details.right.Y = #right-Y
 #})

There's plenty of documentation on writing music functions.  See
http://www.lilypond.org/doc/v2.16/Documentation/extending/music-functions

Hope this helps,
David



reply via email to

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