]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/educational.itely
Clarify colors, issue 490.
[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 Educational use
10 @section Educational use
11
12 @menu
13 * Note heads::                  
14 * Inside the staff::            
15 * Outside the staff::           
16 @end menu
17
18
19 @node Note heads
20 @subsection Note heads
21
22 @menu
23 * Easy notation note heads::    
24 * Shape note heads::            
25 * Improvisation::               
26 * Special noteheads::           
27 @end menu
28
29 @node Easy notation note heads
30 @unnumberedsubsubsec Easy notation note heads
31
32 @cindex note heads, practice
33 @cindex note heads, easy notation
34 @cindex easy notation
35 @cindex Hal Leonard
36
37 The @q{easy play} note head includes a note name inside the head.
38 It is used in music for beginners
39
40 @lilypond[quote,ragged-right,verbatim,fragment,staffsize=26]
41   \setEasyHeads
42   c'2 e'4 f' | g'1
43 @end lilypond
44
45 The command @code{\setEasyHeads} overrides settings for the
46 @internalsref{NoteHead} object.  To make the letters readable, it
47 has to be printed in a large font size.  To print with a larger
48 font, see @ref{Setting the staff size}.
49
50 @refcommands
51
52 @funindex \setEasyHeads
53 @code{\setEasyHeads}
54
55
56 @node Shape note heads
57 @unnumberedsubsubsec Shape note heads
58
59 @cindex note heads, shape
60
61 In shape note head notation, the shape of the note head
62 corresponds to the harmonic function of a note in the scale.  This
63 notation was popular in the 19th century American song books.
64
65 Shape note heads can be produced by setting @code{\aikenHeads} or
66 @code{\sacredHarpHeads}, depending on the style desired.
67
68 @lilypond[verbatim,relative=1,fragment]
69   \aikenHeads
70   c8 d4 e8 a2 g1
71   \sacredHarpHeads
72   c8 d4. e8 a2 g1
73 @end lilypond
74
75 Shapes are determined on the step in the scale, where the base of
76 the scale is determined by  the @code{\key} command
77
78 @funindex \key
79 @funindex shapeNoteStyles
80 @funindex \aikenHeads
81 @funindex \sacredHarpHeads
82
83 Shape note heads are implemented through the
84 @code{shapeNoteStyles} property.  Its value is a vector of
85 symbols.  The k-th element indicates the style to use for the k-th
86 step of the scale.  Arbitrary combinations are possible, e.g.
87
88 @lilypond[verbatim,relative=1,fragment]
89 \set shapeNoteStyles =
90   ##(cross triangle fa #f mensural xcircle diamond)
91 c8 d4. e8 a2 g1
92 @end lilypond
93
94
95 @node Improvisation
96 @unnumberedsubsubsec Improvisation
97
98 Improvisation is sometimes denoted with slashed note heads.  Such
99 note heads can be created by adding a
100 @internalsref{Pitch_squash_engraver} to the @internalsref{Voice}
101 context.  Then, the following command
102
103 @example
104 \set squashedPosition = #0
105 \override NoteHead #'style = #'slash
106 @end example
107
108 @noindent
109 switches on the slashes.
110
111 There are shortcuts @code{\improvisationOn} (and an accompanying
112 @code{\improvisationOff}) for this command sequence.  They are
113 used in the following example
114
115 @lilypond[verbatim,ragged-right,quote]
116 \new Voice \with {
117   \consists Pitch_squash_engraver
118 } \transpose c c' {
119   e8 e g a a16(bes)(a8) g \improvisationOn
120   e8
121   ~e2~e8 f4 fis8
122   ~fis2 \improvisationOff a16(bes) a8 g e
123 }
124 @end lilypond
125
126
127 @node Special noteheads
128 @unnumberedsubsubsec Special noteheads
129
130 @cindex note heads, special
131
132 Different noteheads are used by various instruments for various
133 meanings -- crosses are used for @q{parlato} with vocalists,
134 stopped notes on guitar; diamonds are used for harmonics on string
135 instruments, etc.  There is a shorthand (@code{\harmonic}) for
136 diamond shapes; the other notehead styles are produced by tweaking
137 the property
138
139 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
140 c4 d
141 \override NoteHead #'style = #'cross
142 e f
143 \revert NoteHead #'style
144 e d <c f\harmonic> <d a'\harmonic>
145 @end lilypond
146
147 @noindent
148 To see all notehead styles, please see @ref{Note head styles}.
149
150
151 @seealso
152
153 Program reference: @internalsref{NoteHead}.
154
155
156
157 @node Inside the staff
158 @subsection Inside the staff
159
160
161 @menu
162 * Selecting notation font size::  
163 * Fingering instructions::      
164 * Hidden notes::                
165 * Coloring objects::            
166 * Parentheses::                 
167 * Ambitus::                     
168 * Stems::                       
169 @end menu
170
171 @node Selecting notation font size
172 @unnumberedsubsubsec Selecting notation font size
173
174 The easiest method of setting the font size of any context is by
175 setting the @code{fontSize} property.
176
177 @lilypond[quote,fragment,relative=1,verbatim]
178 c8
179 \set fontSize = #-4
180 c f
181 \set fontSize = #3
182 g
183 @end lilypond
184
185 @noindent
186 It does not change the size of variable symbols, such as beams or
187 slurs.
188
189 Internally, the @code{fontSize} context property will cause the
190 @code{font-size} property to be set in all layout objects.  The
191 value of @code{font-size} is a number indicating the size relative
192 to the standard size for the current staff height.  Each step up
193 is an increase of approximately 12% of the font size.  Six steps
194 is exactly a factor two.  The Scheme function @code{magstep}
195 converts a @code{font-size} number to a scaling factor.  The
196 @code{font-size} property can also be set directly, so that only
197 certain layout objects are affected.
198
199 @lilypond[quote,fragment,relative=1,verbatim]
200 c8
201 \override NoteHead #'font-size = #-4
202 c f
203 \override NoteHead #'font-size = #3
204 g
205 @end lilypond
206
207 Font size changes are achieved by scaling the design size that is
208 closest to the desired size.  The standard font size (for
209 @code{font-size} equals 0), depends on the standard staff height.
210 For a 20pt staff, a 10pt font is selected.
211
212 The @code{font-size} property can only be set on layout objects
213 that use fonts.  These are the ones supporting the
214 @internalsref{font-interface} layout interface.
215
216 @refcommands
217
218 The following commands set @code{fontSize} for the current voice:
219
220 @funindex \tiny
221 @code{\tiny},
222 @funindex \small
223 @code{\small},
224 @funindex \normalsize
225 @code{\normalsize}.
226
227
228 @node Fingering instructions
229 @unnumberedsubsubsec Fingering instructions
230
231 @cindex fingering
232 @cindex finger change
233
234 Fingering instructions can be entered using
235
236 @example
237 @var{note}-@var{digit}
238 @end example
239
240 For finger changes, use markup texts
241
242 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
243 c4-1 c-2 c-3 c-4
244 c^\markup { \finger "2 - 3" }
245 @end lilypond
246
247 You can use the thumb-script to indicate that a note should be
248 played with the thumb (e.g., in cello music)
249
250 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
251 <a_\thumb a'-3>8 <b_\thumb b'-3>
252 @end lilypond
253
254 Fingerings for chords can also be added to individual notes of the
255 chord by adding them after the pitches
256
257 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
258 < c-1 e-2 g-3 b-5 >4
259 @end lilypond
260
261
262 @commonprop
263
264 You may exercise greater control over fingering chords by setting
265 @code{fingeringOrientations}
266
267 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
268 \set fingeringOrientations = #'(left down)
269 <c-1 es-2 g-4 bes-5 > 4
270 \set fingeringOrientations = #'(up right down)
271 <c-1 es-2 g-4 bes-5 > 4
272 @end lilypond
273
274 Using this feature, it is also possible to put fingering
275 instructions very close to note heads in monophonic music,
276
277 @lilypond[verbatim,ragged-right,quote,fragment]
278 \set fingeringOrientations = #'(right)
279 <es'-2>4
280 @end lilypond
281
282
283 @seealso
284
285 Program reference: @internalsref{Fingering}.
286
287 Examples: @lsr{expressive,fingering-chords.ly}
288
289
290
291 @node Hidden notes
292 @unnumberedsubsubsec Hidden notes
293
294 @cindex Hidden notes
295 @cindex Invisible notes
296 @cindex Transparent notes
297
298 @funindex \hideNotes
299 @funindex \unHideNotes
300
301 Hidden (or invisible or transparent) notes can be useful in
302 preparing theory or composition exercises.
303
304 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
305 c4 d4
306 \hideNotes
307 e4 f4
308 \unHideNotes
309 g4 a
310 @end lilypond
311
312
313 @node Coloring objects
314 @unnumberedsubsubsec Coloring objects
315
316 Individual objects may be assigned colors.  You may use the color
317 names listed in the @ref{List of colors}.
318
319 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
320 \override NoteHead #'color = #red
321 c4 c
322 \override NoteHead #'color = #(x11-color 'LimeGreen)
323 d
324 \override Stem #'color = #blue
325 e
326 @end lilypond
327
328 The full range of colors defined for X11 can be accessed by using
329 the Scheme function x11-color.  The function takes one argument
330 that can be a symbol
331
332 @example
333 \override Beam #'color = #(x11-color 'MediumTurquoise)
334 @end example
335
336 or a string
337
338 @example
339 \override Beam #'color = #(x11-color "MediumTurquoise")
340 @end example
341
342 The first form is quicker to write and is more efficient.
343 However, using the second form it is possible to access X11 colors
344 by the multi-word form of its name
345
346 @example
347 \override Beam #'color = #(x11-color "medium turquoise")
348 @end example
349
350 If x11-color cannot make sense of the parameter then the color
351 returned defaults to black.  It should be obvious from the final
352 score that something is wrong.
353
354 This example illustrates the use of x11-color.  Notice that the
355 stem color remains black after being set to (x11-color 'Boggle),
356 which is deliberate nonsense.
357
358 @lilypond[quote,ragged-right,verbatim]
359 {
360   \override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
361   \set Staff.instrumentName = \markup {
362     \with-color #(x11-color 'navy) "Clarinet"
363   }
364   \time 2/4
365   gis''8 a''
366   \override Beam #'color = #(x11-color "medium turquoise")
367   gis'' a''
368   \override NoteHead #'color = #(x11-color "LimeGreen")
369   gis'' a''
370   \override Stem #'color = #(x11-color 'Boggle)
371   gis'' a''
372 }
373 @end lilypond
374
375
376 TODO
377 you can get exact RGB colors by specifying
378
379 % black
380 \override Stem #'color = #(rgb-color 0 0 0)
381 % white
382 \override Stem #'color = #(rgb-color 1 1 1)
383 % dark blue
384 \override Stem #'color = #(rgb-color 0 0 0.5) 
385
386
387 @seealso
388
389 Appendix: @ref{List of colors}.
390
391
392 @refbugs
393 Not all x11 colors are distinguishable in a web browser.  For web
394 use normal colors are recommended.
395
396 An x11 color is not necessarily exactly the same shade as a
397 similarly named normal color.
398
399 Notes in a chord cannot be colored with @code{\override}; use
400 @code{\tweak} instead.  See @ref{Objects connected to the input},
401 for details.
402
403
404 @node Parentheses
405 @unnumberedsubsubsec Parentheses
406
407 @cindex ghost notes
408 @cindex notes, ghost
409 @cindex notes, parenthesized
410
411 Objects may be parenthesized by prefixing @code{\parenthesize} to
412 the music event,
413
414 @lilypond[relative=2,fragment,verbatim,ragged-right]
415 <
416   c
417   \parenthesize d
418   g
419 >4-\parenthesize -.
420 @end lilypond
421
422 This only functions inside chords, even for single notes
423
424 @example
425 < \parenthesize NOTE>
426 @end example
427
428
429 @node Ambitus
430 @unnumberedsubsubsec Ambitus
431 @cindex ambitus
432
433 The term @emph{ambitus} denotes a range of pitches for a given
434 voice in a part of music.  It may also denote the pitch range that
435 a musical instrument is capable of playing.  Ambits are printed on
436 vocal parts, so performers can easily determine it meets their
437 capabilities.
438
439 Ambits are denoted at the beginning of a piece near the initial
440 clef.  The range is graphically specified by two note heads that
441 represent the minimum and maximum pitch.  To print such ambits,
442 add the @internalsref{Ambitus_engraver} to the
443 @internalsref{Voice} context, for example,
444
445 @example
446 \layout @{
447   \context @{
448     \Voice
449     \consists Ambitus_engraver
450   @}
451 @}
452 @end example
453
454 This results in the following output
455
456 @lilypond[quote,ragged-right]
457 \layout {
458   \context {
459     \Staff
460     \consists Ambitus_engraver
461   }
462 }
463
464 \relative \new Staff {
465   as'' c e2 cis,2
466 }
467 @end lilypond
468
469 If you have multiple voices in a single staff and you want a
470 single ambitus per staff rather than per each voice, add the
471 @internalsref{Ambitus_engraver} to the @internalsref{Staff}
472 context rather than to the @internalsref{Voice} context.  Here is
473 an example,
474
475 @lilypond[verbatim,ragged-right,quote]
476 \new Staff \with {
477   \consists "Ambitus_engraver"
478 }
479 <<
480   \new Voice \with {
481     \remove "Ambitus_engraver"
482   } \relative c'' {
483     \override Ambitus #'X-offset = #-1.0
484     \voiceOne
485     c4 a d e f2
486   }
487   \new Voice \with {
488     \remove "Ambitus_engraver"
489   } \relative c' {
490     \voiceTwo
491     es4 f g as b2
492   }
493 >>
494 @end lilypond
495
496 @noindent
497 This example uses one advanced feature,
498
499 @example
500 \override Ambitus #'X-offset = #-1.0
501 @end example
502
503 @noindent
504 This code moves the ambitus to the left.  The same effect could
505 have been achieved with @code{extra-offset}, but then the
506 formatting system would not reserve space for the moved object.
507
508 @seealso
509
510 Program reference: @internalsref{Ambitus},
511 @internalsref{AmbitusLine}, @internalsref{AmbitusNoteHead},
512 @internalsref{AmbitusAccidental}.
513
514 Examples:
515 @lsr{vocal,ambitus@/.ly}.
516
517 @refbugs
518
519 There is no collision handling in the case of multiple per-voice
520 ambitus.
521
522
523 @node Stems
524 @unnumberedsubsubsec Stems
525
526 Whenever a note is found, a @internalsref{Stem} object is created
527 automatically.  For whole notes and rests, they are also created
528 but made invisible.
529
530 @refcommands
531
532 @funindex \stemUp
533 @code{\stemUp},
534 @funindex \stemDown
535 @code{\stemDown},
536 @funindex \stemNeutral
537 @code{\stemNeutral}.
538
539
540 @commonprop
541
542 To change the direction of stems in the middle of the staff, use
543
544 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
545 a4 b c b
546 \override Stem #'neutral-direction = #up
547 a4 b c b
548 \override Stem #'neutral-direction = #down
549 a4 b c b
550 @end lilypond
551
552
553 @node Outside the staff
554 @subsection Outside the staff
555
556
557 @menu
558 * Balloon help::                
559 * Grid lines::                  
560 * Blank music sheet::           
561 @end menu
562
563 @node Balloon help
564 @unnumberedsubsubsec Balloon help
565
566 Elements of notation can be marked and named with the help of a
567 square balloon.  The primary purpose of this feature is to explain
568 notation.
569
570 The following example demonstrates its use.
571
572 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
573 \new Voice \with { \consists "Balloon_engraver" }
574 {
575   \balloonGrobText #'Stem #'(3 . 4) \markup { "I'm a Stem" }
576   <c-\balloonText #'(-2 . -2) \markup { Hello }  >8
577 }
578 @end lilypond
579
580 @noindent
581 There are two music functions, @code{balloonText} and
582 @code{balloonGrobText}.  The latter takes the name of the grob to
583 adorn, while the former may be used as an articulation on a note.
584 The other arguments  are the offset and the text of the label.
585
586 @cindex balloon
587 @cindex notation, explaining
588
589 @seealso
590
591 Program reference: @internalsref{text-balloon-interface}.
592
593
594 @node Grid lines
595 @unnumberedsubsubsec Grid lines
596
597 Vertical lines can be drawn between staves synchronized with the
598 notes.
599
600 @lilypond[ragged-right,quote,verbatim]
601 \layout {
602   \context {
603     \Staff
604     \consists "Grid_point_engraver" %% sets of grid
605     gridInterval = #(ly:make-moment 1 4)
606   }
607 }
608
609 \new Score \with {
610   \consists "Grid_line_span_engraver"
611   %% centers grid lines  horizontally below noteheads
612   \override NoteColumn #'X-offset = #-0.5
613 }
614
615 \new ChoirStaff <<
616   \new Staff {
617     \stemUp
618     \relative {
619       c'4. d8 e8 f g4
620     }
621   }
622   \new Staff {
623     %% centers grid lines  vertically
624     \override Score.GridLine #'extra-offset = #'( 0.0 . 1.0 )
625     \stemDown
626     \clef bass
627     \relative c {
628       c4  g'  f  e
629     }
630   }
631 >>
632 @end lilypond
633
634 Examples: @lsrdir{education}
635
636
637 @node Blank music sheet
638 @unnumberedsubsubsec Blank music sheet
639
640 @cindex Sheet music, empty
641 @cindex Staves, blank sheet
642
643 A blank music sheet can be produced also by using invisible notes,
644 and removing @code{Bar_number_engraver}.
645
646
647 @lilypond[quote,verbatim]
648 \layout{ indent = #0 }
649 emptymusic = {
650   \repeat unfold 2 % Change this for more lines.
651   { s1\break }
652   \bar "|."
653 }
654 \new Score \with {
655   \override TimeSignature #'transparent = ##t
656 % un-comment this line if desired
657 %  \override Clef #'transparent = ##t
658   defaultBarType = #""
659   \remove Bar_number_engraver
660 } <<
661
662 % modify these to get the staves you want
663   \new Staff \emptymusic
664   \new TabStaff \emptymusic
665 >>
666 @end lilypond
667
668
669