]> git.donarmstrong.com Git - lilypond.git/blob - input/regression/lily-in-scheme.ly
Make the length of beamlets configurable.
[lilypond.git] / input / regression / lily-in-scheme.ly
1 \header { texidoc = "LilyPond syntax can be used inside scheme to
2     build music expressions, with the @code{#@{ ... #@}} syntax.
3     Scheme forms can be introduced inside these blocks by escaping
4     them with a @code{$}, both in a LilyPond context or in a Scheme
5     context.
6
7 In this example, the @code{\withpaddingA}, @code{\withpaddingB} and
8 @code{\withpaddingC} music functions set different kinds of padding on
9 the @code{TextScript} grob.
10
11 "
12           
13       }
14
15 \version "2.11.51"
16 \layout { ragged-right = ##t }
17
18 withPaddingA = #(define-music-function (parser location padding music) (number? ly:music?)
19                  #{ \override TextScript #'padding = #$padding
20                  $music 
21                  \revert TextScript #'padding #})
22
23 withPaddingB = #(define-music-function (parser location padding music) (number? ly:music?)
24                  #{ \override TextScript #'padding = #$(* padding 2)
25                  $music 
26                  \revert TextScript #'padding #})
27
28 withPaddingC = #(define-music-function (parser location padding music) (number? ly:music?)
29                  #{ \override TextScript #'padding = #(+ 1 $(* padding 2))
30                     $music 
31                     \revert TextScript #'padding #})
32
33 {
34     c'^"1"
35     \withPaddingA #2
36     { c'^"2" c'^"3"}
37     c'^"4"
38     \withPaddingB #2
39     { c'^"5" c'^"6"}
40     c'^"7"
41     \withPaddingC #2
42     { c'^"8" c'^"9"}
43     c'^"10"
44 }