]> git.donarmstrong.com Git - lilypond.git/blob - input/regression/lily-in-scheme.ly
release commit
[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 FIXME: this is broken.
12 "
13     
14 }
15
16
17 \score{ c'4^"FIXME" }
18 %{
19
20 \version "2.3.4"
21 \paper { raggedright = ##t }
22
23 withPaddingA = #(def-music-function (location padding music) (number? ly:music?)
24                    #{ \override TextScript #'padding = #$padding
25                       $music 
26                       \revert TextScript #'padding #})
27   
28 withPaddingB = #(def-music-function (location padding music) (number? ly:music?)
29                    #{ \override TextScript #'padding = #$(* padding 2)
30                       $music 
31                       \revert TextScript #'padding #})
32   
33 withPaddingC = #(def-music-function (location padding music) (number? ly:music?)
34                    #{ \override TextScript #'padding = #(+ 1 $(* padding 2))
35                       $music 
36                       \revert TextScript #'padding #})
37   
38   \score {
39       \notes {
40           c'^"1"
41           \withPaddingA #2
42             { c'^"2" c'^"3"}
43           c'^"4"
44           \withPaddingB #2
45             { c'^"5" c'^"6"}
46           c'^"7"
47           \withPaddingC #2
48             { c'^"8" c'^"9"}
49           c'^"10"
50       }
51   }
52 %}