3 texidoc = "This example shows prelude in C major of WTK1, but coded
4 using Scheme functions to save typing work.
12 #(define (transform music)
13 (let* ((es (ly:get-mus-property music 'elements))
14 (n (ly:music-name music))
16 (if (not (equal? n "Sequential_music"))
17 (ly:warn "transform needs sequential music!")
19 (let recurse ((elts es))
20 (if (not (equal? elts '()))
22 ((trans (ly:get-mus-property (cadr elts) 'elements)) (car elts))
23 (set-cdr! elts (cddr elts))
34 #(define ((trans pitches) music)
35 (let* ((es (ly:get-mus-property music 'elements))
36 (e (ly:get-mus-property music 'element))
37 (p (ly:get-mus-property music 'pitch)))
42 (map (trans pitches) es)))
50 (let* ((o (ly:pitch-octave p))
51 (n (ly:pitch-notename p))
53 (pes (ly:get-mus-property (list-ref pitches i) 'elements))
54 (pnew (ly:get-mus-property (car pes) 'pitch))
56 (ly:set-mus-property! music 'pitch pnew)
69 pat = \notes \transpose c c' \repeat unfold 2 {
70 < { \context Staff=up {r8 e16 f g e f g } }
71 { \context Staff=down <
72 \context Voice=vup { \stemUp \tieUp r16 d8.~d4 }
73 \context Voice=vdwn { \stemDown c2 }
78 enda = \notes { r8 f,16 a, c f c a, \stemUp c \translator Staff = down
79 a, f, a, f, d, f, d, \translator Staff = up \stemBoth
80 r8 g16 h d' f' d' h d' h g h d f e-\prall d <<e g c'>>1^\fermata \bar "|."
82 endb = \notes {\stemUp \tieUp r16 c,8.~c,4~c,2 r16 h,,8.~h,,4~h,,2 c,1 \bar "|."}
83 endc = \notes {\stemDown \tieDown c,,2~c,, c,,~c,, c,,1_\fermata }
86 \notes \transpose c c' \context PianoStaff <
87 \context Staff=up { \clef "G" s1*32 \enda }
88 \context Staff=down { \clef "F" s1*32 < \context Voice=vup \endb
89 \context Voice=vdwn \endc
91 { \apply #transform {\pat {c e g c' e' }
100 %we get the idea now.
109 \pat {d, a, d fis c' }
111 \pat {g, b, e g cis' }
118 \pat {g,, d, g, h, f }
121 \pat {f,, f, a, c e }
122 \pat {fis,, c, a, c es }
123 \pat {as,, f, h, c d }
124 \pat {g,, f, g, h, d }
125 \pat {g,, e, g, c e }
126 \pat {g,, d, g, c f }
127 \pat {g,, d, g, h, f }
128 \pat {g,, es, a, c fis }
129 \pat {g,, e, g, c g }
130 \pat {g,, d, g, c f }
131 \pat {g,, d, g, h, f }
132 \pat {c,, c, g, b, e }
139 VerticalAlignment \override #'forced-distance = #10
148 %% new-chords-done %%