]> git.donarmstrong.com Git - lilypond.git/blob - input/test/music-box.ly
*** empty log message ***
[lilypond.git] / input / test / music-box.ly
1
2 \header{
3 texidoc = "This example shows prelude in C major of WTK1, but coded
4 using Scheme functions to save typing work.
5 "
6
7
8
9   title =  "Preludium"
10   opus =   "BWV 846"
11   composer = "Johann Sebastian Bach (1685-1750)"
12   enteredby = "Rune Zedeler"
13   mutopiatitle = "Das Wohltemperierte Clavier I, Prelude 1 (c-major)"
14   mutopiacomposer = "J.S.Bach"
15   mutopiaopus = "BWV846"
16   mutopiainstrument = "Piano"
17   style = "baroque"
18   copyright = "Public Domain"
19   maintainer = "rz@daimi.au.dk"
20   lastupdated = "2001/mar/30"
21   tagline = "\\parbox{\hsize}{\\thefooter\\quad\\small \\\\This music is part of the Mutopia project, \\texttt{http://www.mutopiaproject.org/}\\\\It has been typeset and placed in the public domain by " + \maintainer + ".\\\\Unrestricted modification and redistribution is permitted and encouraged---copy this music and share it!}"
22 }
23
24 \include "deutsch.ly"
25 \version "1.7.16"
26
27 #(define (transform music)
28   (let* ((es (ly:get-mus-property music 'elements))
29          (n  (ly:music-name music))
30         )
31    (if (not (equal? n "Sequential_music"))
32      (ly:warn "transform needs sequential music!")
33      (begin
34       (let recurse ((elts es))
35        (if (not (equal? elts '()))
36          (begin
37            ((trans (ly:get-mus-property (cadr elts) 'elements)) (car elts))
38            (set-cdr! elts (cddr elts))
39            (recurse (cdr elts))
40          )
41        )
42       )
43      )
44    )
45    music
46   )
47  )
48
49 #(define ((trans pitches) music)
50   (let* ((es (ly:get-mus-property music 'elements))
51          (e (ly:get-mus-property music 'element))
52          (p (ly:get-mus-property music 'pitch)))
53
54     (if (pair? es)
55         (ly:set-mus-property!
56          music 'elements
57          (map (trans pitches) es)))
58
59     (if (ly:music? e)
60         (ly:set-mus-property!
61          music 'element
62          ((trans pitches) e)))
63
64     (if (ly:pitch? p)
65        (let* ((o (ly:pitch-octave p))
66               (n (ly:pitch-notename p))
67               (i (+ (* 7 o) n))
68               (pes (ly:get-mus-property (list-ref pitches i) 'elements))
69               (pnew (ly:get-mus-property (car pes) 'pitch))
70              )
71           (ly:set-mus-property! music 'pitch pnew)
72         )
73     )
74     music
75   )
76  )
77
78
79
80
81
82 \version "1.7.16"
83
84 pat = \notes \transpose c c' \repeat unfold 2 {
85   < { \context Staff=up {r8 e16 f g e f g } }
86     { \context Staff=down <
87       \context Voice=vup  { \stemUp \tieUp r16 d8.~d4 }
88       \context Voice=vdwn { \stemDown  c2 }
89     > }
90   >
91 }
92
93 enda = \notes { r8 f,16 a, c f c a, \stemUp c \translator Staff = down
94       a, f, a, f, d, f, d, \translator Staff = up \stemBoth
95       r8 g16 h d' f' d' h d' h g h d f e-\prall d <<e g c'>>1^\fermata \bar "|."
96 }
97 endb = \notes {\stemUp \tieUp r16 c,8.~c,4~c,2 r16 h,,8.~h,,4~h,,2 c,1 \bar "|."}
98 endc = \notes {\stemDown \tieDown c,,2~c,, c,,~c,, c,,1_\fermata }
99
100 \score {
101   \notes \transpose c c' \context PianoStaff <
102     \context Staff=up   { \clef "G" s1*32 \enda }
103     \context Staff=down { \clef "F" s1*32 < \context Voice=vup \endb
104                                              \context Voice=vdwn \endc
105                         > }
106     { \apply #transform {\pat {c e g c' e' }
107                          \pat {c d a d' f' }
108                          \pat {h, d g d' f' }
109                          \pat {c e g c' e' }
110                          \pat {c e a e' a' }
111                          \pat {c d fis a d'  }
112                          \pat {h, d g d' g' }
113                          \pat {h, c e g c' }
114                          \pat {a, c e g c'  }
115                          \pat {d, a, d fis c' }
116                          \pat {g, h, d g h }
117                          \pat {g, b, e g cis'  }
118                          \pat {f, a, d a d' }
119                          \pat {f, as, d f h }
120                          \pat {e, g, c g c' }
121                          \pat {e, f, a, c f }
122                          \pat {d, f, a, c f }
123
124                          \pat {g,, d, g, h, f }
125                          \pat {c, e, g, c e }
126                          \pat {c, g, b, c e }
127                          \pat {f,, f, a, c e  }
128                          \pat {fis,, c, a, c es }
129                          \pat {as,, f, h, c d }
130                          \pat {g,, f, g, h, d }
131                          \pat {g,, e, g, c e }
132                          \pat {g,, d, g, c f }
133                          \pat {g,, d, g, h, f }
134                          \pat {g,, es, a, c fis }
135                          \pat {g,, e, g, c g }
136                          \pat {g,, d, g, c f }
137                          \pat {g,, d, g, h, f }
138                          \pat {c,, c, g, b, e }
139                         }
140     }
141   >
142   \paper {
143     \translator {
144       \PianoStaffContext
145       VerticalAlignment \override #'forced-distance = #10
146     }
147
148     linewidth = 18.0 \cm
149   }
150   \midi {
151       \tempo 4 = 80
152   }
153 }
154 %% new-chords-done %%