]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/engravers-one-by-one.ly
5d1bcf060c84c41cd90fa6a226837a686fe30e80
[lilypond.git] / Documentation / snippets / engravers-one-by-one.ly
1 %% DO NOT EDIT this file manually; it is automatically
2 %% generated from LSR http://lsr.di.unimi.it
3 %% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
4 %% and then run scripts/auxiliar/makelsr.py
5 %%
6 %% This file is in the public domain.
7 \version "2.19.7"
8
9 \header {
10   lsrtags = "contexts-and-engravers, specific-notation"
11
12   texidoc = "
13 The notation problem, creating a certain symbol, is handled by plugins.
14  Each plugin is called an Engraver. In this example, engravers are
15 switched on one by one, in the following order:
16
17 - note heads,
18
19
20 - staff symbol,
21
22
23 - clef,
24
25
26 - stem,
27
28
29 - beams, slurs, accents,
30
31
32 - accidentals, bar lines, time signature and key signature.
33
34
35
36 Engravers are grouped. For example, note heads, slurs, beams etc. form
37 a @code{Voice} context. Engravers for key signature, accidentals, bar
38 line, etc. form a @code{Staff} context.
39
40 "
41   doctitle = "Engravers one-by-one"
42 } % begin verbatim
43
44 %% sample music
45 topVoice = \relative c' {
46   \key d \major
47   es8([ g] a[ fis])
48   b4
49   b16[-. b-. b-. cis-.]
50   d4->
51 }
52
53 botVoice = \relative c' {
54   \key d \major
55   c8[( f] b[ a)]
56   es4
57   es16[-. es-. es-. fis-.]
58   b4->
59 }
60
61 hoom = \relative c {
62   \key d \major
63   \clef bass
64   g8-. r
65   r4
66   fis8-.
67   r8
68   r4
69   b'4->
70 }
71
72 pah = \relative c' {
73   r8 b-.
74   r4
75   r8 g8-.
76   r16 g-. r8
77   \clef treble
78   fis'4->
79 }
80
81 %
82 % setup for Request->Element conversion. Guru-only
83 %
84
85 MyStaff = \context {
86   \type "Engraver_group"
87   \name Staff
88
89   \description "Handles clefs, bar lines, keys, accidentals.  It can contain
90 @code{Voice} contexts."
91
92   \consists "Output_property_engraver"
93
94   \consists "Font_size_engraver"
95
96   \consists "Volta_engraver"
97   \consists "Separating_line_group_engraver"
98   \consists "Dot_column_engraver"
99
100   \consists "Ottava_spanner_engraver"
101   \consists "Rest_collision_engraver"
102   \consists "Piano_pedal_engraver"
103   \consists "Piano_pedal_align_engraver"
104   \consists "Instrument_name_engraver"
105   \consists "Grob_pq_engraver"
106   \consists "Forbid_line_break_engraver"
107   \consists "Axis_group_engraver"
108
109   \consists "Pitch_squash_engraver"
110
111   localAlterations = #'()
112
113   % explicitly set instrumentName, so we don't get
114   % weird effects when doing instrument names for
115   % piano staves
116
117   instrumentName = #'()
118   shortInstrumentName = #'()
119
120   \accepts "Voice"
121   \defaultchild "Voice"
122 }
123
124
125 MyVoice = \context {
126   \type "Engraver_group"
127   \name Voice
128
129   \description "
130     Corresponds to a voice on a staff.  This context handles the
131     conversion of dynamic signs, stems, beams, super- and subscripts,
132     slurs, ties, and rests.
133
134     You have to instantiate this explicitly if you want to have
135     multiple voices on the same staff."
136
137   localAlterations = #'()
138   \consists "Font_size_engraver"
139
140   % must come before all
141   \consists "Output_property_engraver"
142   \consists "Arpeggio_engraver"
143   \consists "Multi_measure_rest_engraver"
144   \consists "Text_spanner_engraver"
145   \consists "Grob_pq_engraver"
146   \consists "Note_head_line_engraver"
147   \consists "Glissando_engraver"
148   \consists "Ligature_bracket_engraver"
149   \consists "Breathing_sign_engraver"
150   % \consists "Rest_engraver"
151   \consists "Grace_beam_engraver"
152   \consists "New_fingering_engraver"
153   \consists "Chord_tremolo_engraver"
154   \consists "Percent_repeat_engraver"
155   \consists "Slash_repeat_engraver"
156
157   %{
158     Must come before text_engraver, but after note_column engraver.
159   %}
160   \consists "Text_engraver"
161   \consists "Dynamic_engraver"
162   \consists "Dynamic_align_engraver"
163   \consists "Fingering_engraver"
164
165   \consists "Script_column_engraver"
166   \consists "Rhythmic_column_engraver"
167   \consists "Cluster_spanner_engraver"
168   \consists "Tie_engraver"
169   \consists "Tie_engraver"
170   \consists "Tuplet_engraver"
171   \consists "Note_heads_engraver"
172   \consists "Rest_engraver"
173 }
174
175
176 \score {
177   \topVoice
178   \layout {
179     \context { \MyStaff }
180     \context { \MyVoice }
181   }
182 }
183
184
185 MyStaff = \context {
186   \MyStaff
187   \consists "Staff_symbol_engraver"
188 }
189
190 \score {
191   \topVoice
192   \layout {
193     \context { \MyStaff }
194     \context { \MyVoice }
195   }
196 }
197
198 MyStaff = \context {
199   \MyStaff
200   \consists "Clef_engraver"
201   \remove "Pitch_squash_engraver"
202 }
203
204 \score {
205   \topVoice
206   \layout {
207     \context { \MyStaff }
208     \context { \MyVoice }
209   }
210 }
211
212 MyVoice = \context {
213   \MyVoice
214   \consists "Stem_engraver"
215 }
216
217 \score {
218   \topVoice
219   \layout {
220     \context { \MyStaff }
221     \context { \MyVoice }
222   }
223 }
224
225 MyVoice = \context {
226   \MyVoice
227   \consists "Beam_engraver"
228 }
229
230 \score {
231   \topVoice
232   \layout {
233     \context { \MyStaff }
234     \context { \MyVoice }
235   }
236 }
237
238 MyVoice = \context {
239   \MyVoice
240   \consists "Phrasing_slur_engraver"
241   \consists "Slur_engraver"
242   \consists "Script_engraver"
243 }
244
245
246 \score {
247   \topVoice
248   \layout {
249     \context { \MyStaff }
250     \context { \MyVoice }
251   }
252 }
253
254 MyStaff = \context {
255   \MyStaff
256   \consists "Bar_engraver"
257   \consists "Time_signature_engraver"
258 }
259
260 \score {
261   \topVoice
262   \layout {
263     \context { \MyStaff }
264     \context { \MyVoice }
265   }
266 }
267
268 MyStaff = \context {
269   \MyStaff
270   \consists "Accidental_engraver"
271   \consists "Key_engraver"
272 }
273 \score {
274   \topVoice
275   \layout {
276     \context { \MyStaff }
277     \context { \MyVoice }
278   }
279 }