-
Notifications
You must be signed in to change notification settings - Fork 0
/
elements.ily
225 lines (214 loc) · 7.77 KB
/
elements.ily
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
%! File: elements.ily
%! This file contains definition of typical musical elements that are not contained in
%! the standard library. The PDQ stylesheet automatically includes this file so all of
%! this is automatically avaliable when using PDQ.
\version "2.24.0"
%!--------------------------------------------------------------------------------------
%! Group: Musical Functions
%!--------------------------------------------------------------------------------------
%! Function: ellipsis
%! --- Prototype
%! \ellipsis duration
%! ---
%! Marks a multi measure rest as an ellipsis. Unlike multi measure rests an ellipsis
%! does not show its length but is represented as two diagonal lines. This can be used
%! in exerpts where you might only want to include certain parts of a piece. This only
%! works with multi measure rests.
%!
%! Example:
%! --- LilyPond
%! \ellipsis R1*100
%! ---
%! This ellipsis would span 100 bars. As the ellipsis uses a MMR internally bar numbers
%! will resume correctly after the ellipsis.
%!
%! Parameters:
%! duration - The duration of the ellipsis. Must be a multi measure rest.
ellipsis = {
\once \override MultiMeasureRest.minimum-length = #0
\once \override MultiMeasureRest.expand-limit = #1
\once \override MultiMeasureRest.transparent = ##t
\once \override MultiMeasureRestNumber.layer = #-1
\once \override MultiMeasureRestNumber.Y-offset = #0
\once \override MultiMeasureRestNumber.stencil = #(lambda (grob) (grob-interpret-markup grob
(markup #:vcenter #:pad-x 1 (ly:grob-property grob 'text))))
\once \override MultiMeasureRestNumber.text = \markup { \vspace #1 \draw-line #'(6 . 3) \hspace #-5.9 \draw-line #'(6 . 3) }
}
%! Function: noSignature
%! --- Prototype
%! \noSignature
%! ---
%! Suppresses the time and key signature at the point where this function is used.
noSignature = {
\once \override Staff.TimeSignature.break-visibility = #end-of-line-invisible
\once \override Staff.KeySignature.break-visibility = #end-of-line-invisible
\once \set Staff.explicitKeySignatureVisibility = #end-of-line-invisible
\once \set Staff.printKeyCancellation = ##f
}
%! Function: forceBarNumber
%! --- Prototype
%! \forceBarNumber
%! ---
%! Forces LilyPond to output a bar number in the current bar. This can be very useful in
%! combination with <ellipsis> to inform the reader at which bar an exerpt continues
%! after an ellipsis.
forceBarNumber = \once \override Score.BarNumber.break-visibility = #end-of-line-invisible
%! Function: pDolce
%! --- Prototype
%! \pDolce
%! ---
%! Dynamic command for piano dolce.
%!
%! Example:
%! --- LilyPond
%! c d e\pDolce f
%! ---
pDolce = #(make-dynamic-script
(markup #:hspace 5
#:dynamic "p"
#:normal-text #:italic "dolce"))
%! Function: pizz
%! --- Prototype
%! \pizz
%! ---
%! Markup command that prints a pizzicato mark at the current note.
%!
%! Example:
%! --- LilyPond
%! c d e^\pizz f
%! ---
pizz = \markup { \upright "pizz." }
%! Function: arco
%! --- Prototype
%! \pizz
%! ---
%! Markup command that prints an arco mark at the current note.
%!
%! Example:
%! --- LilyPond
%! c d e^\arco f
%! ---
arco = \markup { \upright "arco" }
%! Function: staccsOn
%! --- Prototype
%! \staccsOn number
%! ---
%! Begins using multiple staccato marks on every following note. The staccatos will
%! continue until <staccsOff> is used. This is usually used in combination with tremolo
%! repeats.
%!
%! Parameters:
%! number - The number of staccatos to use on each note.
%!
%! See Also:
%! <staccsUpOn>, <staccsDownOn>, <staccsOff>
staccsOn = #(define-music-function (dots) (number?)
#{
\override Script.stencil = #ly:text-interface::print
\override Script.text = #(lambda (grob)
(define (build-lst count)
(let ((lst (list #:musicglyph "scripts.staccato")))
(if (> count 1) (append lst '(#:hspace 0.1) (build-lst (- count 1))) lst)))
(eval (list 'markup #:concat (build-lst dots)) (interaction-environment)))
\override Script.X-offset =
#(lambda (grob)
(let* ((parent (ly:grob-parent grob X))
(parent-extent (ly:grob-property parent 'X-extent '(0 . 0)))
(parent-start (car parent-extent))
(parent-end (cdr parent-extent))
(parent-center (/ (+ parent-start parent-end) 2.0))
(extent (ly:grob-property grob 'X-extent '(0 . 0)))
(start (car extent))
(end (cdr extent))
(val (- parent-center (/ (- end start) 2.0))))
val))
#})
%! Function: staccsUpOn
%! --- Prototype
%! \staccsUpOn number
%! ---
%! Begins using multiple staccatissimo marks on every following note. The marks will
%! continue until <staccsOff> is used. This is usually used in combination with tremolo
%! repeats.
%!
%! This function uses staccatissimo pointing upward. To use the downward direction use
%! <staccsDownOn> instead.
%!
%! Parameters:
%! number - The number of staccatissimo marks to use on each note.
%!
%! See Also:
%! <staccsOn>, <staccsDownOn>, <staccsOff>
staccsUpOn = #(define-music-function (dots) (number?)
#{
\override Script.stencil = #ly:text-interface::print
\override Script.text = #(lambda (grob)
(define (build-lst count)
(let ((lst (list #:musicglyph "scripts.dstaccatissimo")))
(if (> count 1) (append lst '(#:hspace 0.1) (build-lst (- count 1))) lst)))
(eval (list 'markup #:concat (build-lst dots)) (interaction-environment)))
\override Script.X-offset =
#(lambda (grob)
(let* ((parent (ly:grob-parent grob X))
(parent-extent (ly:grob-property parent 'X-extent '(0 . 0)))
(parent-start (car parent-extent))
(parent-end (cdr parent-extent))
(parent-center (/ (+ parent-start parent-end) 2.0))
(extent (ly:grob-property grob 'X-extent '(0 . 0)))
(start (car extent))
(end (cdr extent))
(val (- parent-center (/ (- end start) 2.0))))
val))
#})
%! Function: staccsDownOn
%! --- Prototype
%! \staccsDownOn number
%! ---
%! Begins using multiple staccatissimo marks on every following note. The marks will
%! continue until <staccsOff> is used. This is usually used in combination with tremolo
%! repeats.
%!
%! This function uses staccatissimo pointing downward. To use the upward direction use
%! <staccsUpOn> instead.
%!
%! Parameters:
%! number - The number of staccatissimo marks to use on each note.
%!
%! See Also:
%! <staccsOn>, <staccsUpOn>, <staccsOff>
staccsDownOn = #(define-music-function (dots) (number?)
#{
\override Script.stencil = #ly:text-interface::print
\override Script.text = #(lambda (grob)
(define (build-lst count)
(let ((lst (list #:musicglyph "scripts.ustaccatissimo")))
(if (> count 1) (append lst '(#:hspace 0.1) (build-lst (- count 1))) lst)))
(eval (list 'markup #:concat (build-lst dots)) (interaction-environment)))
\override Script.X-offset =
#(lambda (grob)
(let* ((parent (ly:grob-parent grob X))
(parent-extent (ly:grob-property parent 'X-extent '(0 . 0)))
(parent-start (car parent-extent))
(parent-end (cdr parent-extent))
(parent-center (/ (+ parent-start parent-end) 2.0))
(extent (ly:grob-property grob 'X-extent '(0 . 0)))
(start (car extent))
(end (cdr extent))
(val (- parent-center (/ (- end start) 2.0))))
val))
#})
%! Function: staccsOff
%! --- Prototype
%! \staccsOff
%! ---
%! Stops using staccato or staccatissimo marks on each note. Use this after using
%! <staccsOn>, <staccsUpOn>, or <staccsDownOn>.
%!
%! See Also:
%! <staccsOn>, <staccsUpOn>, <staccsDownOn>
staccsOff =
{
\revert Script.stencil
\revert Script.text
\revert Script.X-offset
}