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