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