3 texidoc = "This example shows prelude in C major of WTK1, but coded
4 using Scheme functions to save typing work.
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"
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!}"
26 #(define (transform music)
27 (let* ((es (ly-get-mus-property music 'elements))
28 (n (ly-music-name music))
30 (if (not (equal? n "Sequential_music"))
31 (ly-warn "transform needs sequential music!")
33 (let recurse ((elts es))
34 (if (not (equal? elts '()))
36 ((trans (ly-get-mus-property (cadr elts) 'elements)) (car elts))
37 (set-cdr! elts (cddr elts))
48 #(define ((trans pitches) music)
49 (let* ((es (ly-get-mus-property music 'elements))
50 (e (ly-get-mus-property music 'element))
51 (p (ly-get-mus-property music 'pitch))
52 (body (ly-get-mus-property music 'body))
53 (alts (ly-get-mus-property music 'alternatives)))
58 (map (trans pitches) es)))
63 ((trans pitches) alts)))
68 ((trans pitches) body)))
76 (let* ((o (pitch-octave p))
77 (n (pitch-notename p))
79 (pes (ly-get-mus-property (list-ref pitches i) 'elements))
80 (pnew (ly-get-mus-property (car pes) 'pitch))
82 (ly-set-mus-property music 'pitch pnew)
95 pat = \notes \transpose c'' \repeat unfold 2 {
96 < { \context Staff=up {r8 e16 f g e f g } }
97 { \context Staff=down <
98 \context Voice=vup { \stemUp \tieUp r16 d8.~d4 }
99 \context Voice=vdwn { \stemDown c2 }
104 enda = \notes { r8 f,16 a, c f c a, \stemUp c \translator Staff = down
105 a, f, a, f, d, f, d, \translator Staff = up \stemBoth
106 r8 g16 h d' f' d' h d' h g h d f e-\prall d <e1 g c'^\fermata> \bar "|."
108 endb = \notes {\stemUp \tieUp r16 c,8.~c,4~c,2 r16 h,,8.~h,,4~h,,2 c,1 \bar "|."}
109 endc = \notes {\stemDown \tieDown c,,2~c,, c,,~c,, c,,1_\fermata }
112 \notes \transpose c'' \context PianoStaff <
113 \context Staff=up { \clef "G" s1*32 \enda }
114 \context Staff=down { \clef "F" s1*32 < \context Voice=vup \endb
115 \context Voice=vdwn \endc
117 { \apply #transform {\pat {c e g c' e' }
126 \pat {d, a, d fis c' }
128 \pat {g, b, e g cis' }
135 \pat {g,, d, g, h, f }
138 \pat {f,, f, a, c e }
139 \pat {fis,, c, a, c es }
140 \pat {as,, f, h, c d }
141 \pat {g,, f, g, h, d }
142 \pat {g,, e, g, c e }
143 \pat {g,, d, g, c f }
144 \pat {g,, d, g, h, f }
145 \pat {g,, es, a, c fis }
146 \pat {g,, e, g, c g }
147 \pat {g,, d, g, c f }
148 \pat {g,, d, g, h, f }
149 \pat {c,, c, g, b, e }
156 VerticalAlignment \override #'forced-distance = #10