[ << Interfaces for programmers ] | [Top][Contents][Index][ ? ] | [ Literature list >> ] | ||
[ < Music functions ] | [ Up : Music functions ] | [ Simple substitution functions > ] |
6.1.1 Overview of music functions
Making a function which substitutes a variable into LilyPond code is easy. The general form of these functions is
function = #(define-music-function (parser location var1 var2...vari... ) (var1-type? var2-type?...vari-type?...) #{ ...music... #})
where
vari | ith variable |
vari-type? | type of ith variable |
...music... | normal LilyPond input, using
variables as |
There following input types may be used as variables in a music function. This list is not exhaustive; see other documentation specifically about Scheme for more variable types.
Input type | vari-type? notation |
---|---|
Integer | |
Float (decimal number) | |
Text string | |
Markup | |
Music expression | |
A pair of variables | |
The parser
and location
arguments are mandatory,
and are used in some advanced situations. The parser
argument is used to gain access to the value of another LilyPond
variable. The location
argument
is used to set the ‘origin’ of the music expression that is built
by the music function, so that in case of a syntax error LilyPond
can tell the user an appropriate place to look in the input file.
[ << Interfaces for programmers ] | [Top][Contents][Index][ ? ] | [ Literature list >> ] | ||
[ < Music functions ] | [ Up : Music functions ] | [ Simple substitution functions > ] |
Andere Sprachen: español.