]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/educational.itely
Inspirational headwords from Trevor B, thanks!
[lilypond.git] / Documentation / user / educational.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @ignore
3     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
4
5     When revising a translation, copy the HEAD committish of the
6     version that you are working on.  See TRANSLATION for details.
7 @end ignore
8
9 @node Editorial annotations
10 @section Editorial annotations
11
12 @lilypondfile[ragged-right,line-width=16\cm,staffsize=16,quote]
13 {editorial-headword.ly}
14
15 @menu
16 * Inside the staff::            
17 * Outside the staff::           
18 @end menu
19
20
21 @node Inside the staff
22 @subsection Inside the staff
23
24
25 @menu
26 * Selecting notation font size::  
27 * Fingering instructions::      
28 * Hidden notes::                
29 * Coloring objects::            
30 * Parentheses::                 
31 * Stems::                       
32 @end menu
33
34 @node Selecting notation font size
35 @unnumberedsubsubsec Selecting notation font size
36
37 The easiest method of setting the font size of any context is by
38 setting the @code{fontSize} property.
39
40 @lilypond[quote,fragment,relative=1,verbatim]
41 c8
42 \set fontSize = #-4
43 c f
44 \set fontSize = #3
45 g
46 @end lilypond
47
48 @noindent
49 It does not change the size of variable symbols, such as beams or
50 slurs.
51
52 Internally, the @code{fontSize} context property will cause the
53 @code{font-size} property to be set in all layout objects.  The
54 value of @code{font-size} is a number indicating the size relative
55 to the standard size for the current staff height.  Each step up
56 is an increase of approximately 12% of the font size.  Six steps
57 is exactly a factor two.  The Scheme function @code{magstep}
58 converts a @code{font-size} number to a scaling factor.  The
59 @code{font-size} property can also be set directly, so that only
60 certain layout objects are affected.
61
62 @lilypond[quote,fragment,relative=1,verbatim]
63 c8
64 \override NoteHead #'font-size = #-4
65 c f
66 \override NoteHead #'font-size = #3
67 g
68 @end lilypond
69
70 Font size changes are achieved by scaling the design size that is
71 closest to the desired size.  The standard font size (for
72 @code{font-size} equals 0), depends on the standard staff height.
73 For a 20pt staff, a 10pt font is selected.
74
75 The @code{font-size} property can only be set on layout objects
76 that use fonts.  These are the ones supporting the
77 @internalsref{font-interface} layout interface.
78
79 @refcommands
80
81 The following commands set @code{fontSize} for the current voice:
82
83 @funindex \tiny
84 @code{\tiny},
85 @funindex \small
86 @code{\small},
87 @funindex \normalsize
88 @code{\normalsize}.
89
90
91 @node Fingering instructions
92 @unnumberedsubsubsec Fingering instructions
93
94 @cindex fingering
95 @cindex finger change
96
97 Fingering instructions can be entered using
98
99 @example
100 @var{note}-@var{digit}
101 @end example
102
103 For finger changes, use markup texts
104
105 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
106 c4-1 c-2 c-3 c-4
107 c^\markup { \finger "2 - 3" }
108 @end lilypond
109
110 You can use the thumb-script to indicate that a note should be
111 played with the thumb (e.g., in cello music)
112
113 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
114 <a_\thumb a'-3>8 <b_\thumb b'-3>
115 @end lilypond
116
117 Fingerings for chords can also be added to individual notes of the
118 chord by adding them after the pitches
119
120 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
121 < c-1 e-2 g-3 b-5 >4
122 @end lilypond
123
124
125 @commonprop
126
127 You may exercise greater control over fingering chords by setting
128 @code{fingeringOrientations}
129
130 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
131 \set fingeringOrientations = #'(left down)
132 <c-1 es-2 g-4 bes-5 > 4
133 \set fingeringOrientations = #'(up right down)
134 <c-1 es-2 g-4 bes-5 > 4
135 @end lilypond
136
137 Using this feature, it is also possible to put fingering
138 instructions very close to note heads in monophonic music,
139
140 @lilypond[verbatim,ragged-right,quote,fragment]
141 \set fingeringOrientations = #'(right)
142 <es'-2>4
143 @end lilypond
144
145
146 @seealso
147
148 Internals Reference: @internalsref{Fingering}.
149
150 Examples: @lsr{expressive,fingering-chords.ly}
151
152
153
154 @node Hidden notes
155 @unnumberedsubsubsec Hidden notes
156
157 @cindex Hidden notes
158 @cindex Invisible notes
159 @cindex Transparent notes
160
161 @funindex \hideNotes
162 @funindex \unHideNotes
163
164 Hidden (or invisible or transparent) notes can be useful in
165 preparing theory or composition exercises.
166
167 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
168 c4 d4
169 \hideNotes
170 e4 f4
171 \unHideNotes
172 g4 a
173 @end lilypond
174
175
176 @node Coloring objects
177 @unnumberedsubsubsec Coloring objects
178
179 Individual objects may be assigned colors.  You may use the color
180 names listed in the @ref{List of colors}.
181
182 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
183 \override NoteHead #'color = #red
184 c4 c
185 \override NoteHead #'color = #(x11-color 'LimeGreen)
186 d
187 \override Stem #'color = #blue
188 e
189 @end lilypond
190
191 The full range of colors defined for X11 can be accessed by using
192 the Scheme function x11-color.  The function takes one argument
193 that can be a symbol
194
195 @example
196 \override Beam #'color = #(x11-color 'MediumTurquoise)
197 @end example
198
199 or a string
200
201 @example
202 \override Beam #'color = #(x11-color "MediumTurquoise")
203 @end example
204
205 The first form is quicker to write and is more efficient.
206 However, using the second form it is possible to access X11 colors
207 by the multi-word form of its name
208
209 @example
210 \override Beam #'color = #(x11-color "medium turquoise")
211 @end example
212
213 If x11-color cannot make sense of the parameter then the color
214 returned defaults to black.  It should be obvious from the final
215 score that something is wrong.
216
217 This example illustrates the use of x11-color.  Notice that the
218 stem color remains black after being set to (x11-color 'Boggle),
219 which is deliberate nonsense.
220
221 @lilypond[quote,ragged-right,verbatim]
222 {
223   \override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
224   \set Staff.instrumentName = \markup {
225     \with-color #(x11-color 'navy) "Clarinet"
226   }
227   \time 2/4
228   gis''8 a''
229   \override Beam #'color = #(x11-color "medium turquoise")
230   gis'' a''
231   \override NoteHead #'color = #(x11-color "LimeGreen")
232   gis'' a''
233   \override Stem #'color = #(x11-color 'Boggle)
234   gis'' a''
235 }
236 @end lilypond
237
238
239 TODO
240 you can get exact RGB colors by specifying
241
242 % black
243 \override Stem #'color = #(rgb-color 0 0 0)
244 % white
245 \override Stem #'color = #(rgb-color 1 1 1)
246 % dark blue
247 \override Stem #'color = #(rgb-color 0 0 0.5) 
248
249
250 @seealso
251
252 Appendix: @ref{List of colors}.
253
254
255 @refbugs
256 Not all x11 colors are distinguishable in a web browser.  For web
257 use normal colors are recommended.
258
259 An x11 color is not necessarily exactly the same shade as a
260 similarly named normal color.
261
262 Notes in a chord cannot be colored with @code{\override}; use
263 @code{\tweak} instead.  See @ref{Objects connected to the input},
264 for details.
265
266
267 @node Parentheses
268 @unnumberedsubsubsec Parentheses
269
270 @cindex ghost notes
271 @cindex notes, ghost
272 @cindex notes, parenthesized
273
274 Objects may be parenthesized by prefixing @code{\parenthesize} to
275 the music event,
276
277 @lilypond[relative=2,fragment,verbatim,ragged-right]
278 <
279   c
280   \parenthesize d
281   g
282 >4-\parenthesize -.
283 @end lilypond
284
285 This only functions inside chords, even for single notes
286
287 @example
288 < \parenthesize NOTE>
289 @end example
290
291
292 @node Stems
293 @unnumberedsubsubsec Stems
294
295 Whenever a note is found, a @internalsref{Stem} object is created
296 automatically.  For whole notes and rests, they are also created
297 but made invisible.
298
299 @refcommands
300
301 @funindex \stemUp
302 @code{\stemUp},
303 @funindex \stemDown
304 @code{\stemDown},
305 @funindex \stemNeutral
306 @code{\stemNeutral}.
307
308
309 @commonprop
310
311 To change the direction of stems in the middle of the staff, use
312
313 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
314 a4 b c b
315 \override Stem #'neutral-direction = #up
316 a4 b c b
317 \override Stem #'neutral-direction = #down
318 a4 b c b
319 @end lilypond
320
321
322 @node Outside the staff
323 @subsection Outside the staff
324
325
326 @menu
327 * Balloon help::                
328 * Grid lines::                  
329 * Blank music sheet::           
330 * Analysis brackets::           
331 @end menu
332
333 @node Balloon help
334 @unnumberedsubsubsec Balloon help
335
336 Elements of notation can be marked and named with the help of a
337 square balloon.  The primary purpose of this feature is to explain
338 notation.
339
340 The following example demonstrates its use.
341
342 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
343 \new Voice \with { \consists "Balloon_engraver" }
344 {
345   \balloonGrobText #'Stem #'(3 . 4) \markup { "I'm a Stem" }
346   <c-\balloonText #'(-2 . -2) \markup { Hello }  >8
347 }
348 @end lilypond
349
350 @noindent
351 There are two music functions, @code{balloonText} and
352 @code{balloonGrobText}.  The latter takes the name of the grob to
353 adorn, while the former may be used as an articulation on a note.
354 The other arguments  are the offset and the text of the label.
355
356 @cindex balloon
357 @cindex notation, explaining
358
359 @seealso
360
361 Internals Reference: @internalsref{text-balloon-interface}.
362
363
364 @node Grid lines
365 @unnumberedsubsubsec Grid lines
366
367 Vertical lines can be drawn between staves synchronized with the
368 notes.
369
370 @lilypond[ragged-right,quote,verbatim]
371 \layout {
372   \context {
373     \Staff
374     \consists "Grid_point_engraver" %% sets of grid
375     gridInterval = #(ly:make-moment 1 4)
376   }
377 }
378
379 \new Score \with {
380   \consists "Grid_line_span_engraver"
381   %% centers grid lines  horizontally below noteheads
382   \override NoteColumn #'X-offset = #-0.5
383 }
384
385 \new ChoirStaff <<
386   \new Staff {
387     \stemUp
388     \relative {
389       c'4. d8 e8 f g4
390     }
391   }
392   \new Staff {
393     %% centers grid lines  vertically
394     \override Score.GridLine #'extra-offset = #'( 0.0 . 1.0 )
395     \stemDown
396     \clef bass
397     \relative c {
398       c4  g'  f  e
399     }
400   }
401 >>
402 @end lilypond
403
404 Examples: @lsrdir{education}
405
406
407 @node Blank music sheet
408 @unnumberedsubsubsec Blank music sheet
409
410 @cindex Sheet music, empty
411 @cindex Staves, blank sheet
412
413 A blank music sheet can be produced also by using invisible notes,
414 and removing @code{Bar_number_engraver}.
415
416
417 @lilypond[quote,verbatim]
418 \layout{ indent = #0 }
419 emptymusic = {
420   \repeat unfold 2 % Change this for more lines.
421   { s1\break }
422   \bar "|."
423 }
424 \new Score \with {
425   \override TimeSignature #'transparent = ##t
426 % un-comment this line if desired
427 %  \override Clef #'transparent = ##t
428   defaultBarType = #""
429   \remove Bar_number_engraver
430 } <<
431
432 % modify these to get the staves you want
433   \new Staff \emptymusic
434   \new TabStaff \emptymusic
435 >>
436 @end lilypond
437
438
439 @node Analysis brackets
440 @unnumberedsubsubsec Analysis brackets
441
442 @cindex brackets
443 @cindex phrasing brackets
444 @cindex musicological analysis
445 @cindex note grouping bracket
446
447 Brackets are used in musical analysis to indicate structure in
448 musical pieces.  LilyPond supports a simple form of nested
449 horizontal brackets.  To use this, add the
450 @internalsref{Horizontal_bracket_engraver} to the
451 @internalsref{Staff} context.  A bracket is started with
452 @code{\startGroup} and closed with @code{\stopGroup}.
453
454 @lilypond[quote,ragged-right,verbatim]
455 \score {
456   \relative c'' {
457     c4\startGroup\startGroup
458     c4\stopGroup
459     c4\startGroup
460     c4\stopGroup\stopGroup
461   }
462   \layout {
463     \context {
464       \Staff \consists "Horizontal_bracket_engraver"
465 }}}
466 @end lilypond
467
468 @seealso
469
470 Internals Reference: @internalsref{HorizontalBracket}.
471
472