| [ << Interfaces for programmers ] | [Top][Contents][Index][ ? ] | [ LilyPond Scheme interfaces >> ] | ||
| [ < Simple substitution functions ] | [ Up : Music functions ] | [ Mathematics in functions > ] | ||
2.1.3 Intermediate substitution functions
Intermediate substitution functions involve a mix of Scheme code and LilyPond code in the music expression to be returned.
Some \override commands require an argument consisting of
a pair of numbers (called a cons cell in Scheme).
The pair can be directly passed into the music function,
using a pair? variable:
manualBeam =
#(define-music-function
(parser location beg-end)
(pair?)
#{
\once \override Beam #'positions = $beg-end
#})
\relative c' {
\manualBeam #'(3 . 6) c8 d e f
}
Alternatively, the numbers making up the pair can be passed as separate arguments, and the Scheme code used to create the pair can be included in the music expression:
manualBeam =
#(define-music-function
(parser location beg end)
(number? number?)
#{
\once \override Beam #'positions = $(cons beg end)
#})
\relative c' {
\manualBeam #3 #6 c8 d e f
}
| [ << Interfaces for programmers ] | [Top][Contents][Index][ ? ] | [ LilyPond Scheme interfaces >> ] | ||
| [ < Simple substitution functions ] | [ Up : Music functions ] | [ Mathematics in functions > ] | ||