-
Notifications
You must be signed in to change notification settings - Fork 0
/
end.ly
61 lines (55 loc) · 1.69 KB
/
end.ly
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#(define (octavate-pitch pitch octaves)
(ly:make-pitch
(+ (ly:pitch-octave pitch) octaves)
(ly:pitch-notename pitch)
(ly:pitch-alteration pitch)))
#(define (articulation-is-of-type? art type)
(string=? (ly:music-property art 'articulation-type) type))
#(define (copy-articulation? art)
(cond ((music-is-of-type? art 'tie-event)
#t)
((and (music-is-of-type? art 'articulation-event)
(articulation-is-of-type? art "fermata"))
#f)
; TODO add more cases
(else
#f)))
#(define (octNote note)
(if (null? (ly:music-property note 'pitch))
note
(make-relative (note) note
(let ((note2 (ly:music-deep-copy note))
(pitch (ly:music-property note 'pitch)))
(set! (ly:music-property note2 'pitch)
(octavate-pitch pitch 1))
(set! (ly:music-property note2 'articulations)
(filter copy-articulation? (ly:music-property note2 'articulations)))
(make-event-chord (list note note2))))))
oct = #(define-music-function
(parser location music)
(ly:music?)
(music-map octNote music))
\new PianoStaff <<
\new Staff {
\key bes \major
\relative bes' \oct {
r2.
bes4~ | bes f'2
\tuplet 3/2 { es8 d c } | bes'2 f\fermata | \bar "|."
}
}
\new Dynamics {
s2.
s4 | s2.
s4-\tweak bound-details.left.text "rit." \startTextSpan | s2 s\stopTextSpan
}
\new Staff {
\key bes \major
\clef "bass"
\relative bes,, {
<bes bes' d f>1~ |
q~ |
q_\fermata |
}
}
>>