]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/staff.itely
Docs: NR 1.6 Staff: comments from -user
[lilypond.git] / Documentation / user / staff.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 @c \version "2.11.61"
10
11 @node Staff notation
12 @section Staff notation
13
14 @lilypondfile[quote]{staff-headword.ly}
15
16 This section explains how to influence the staff appearance, print
17 scores with more than one staff, and how to apply specific
18 performance marks to single staves.
19
20 @menu
21 * Displaying staves::
22 * Modifying single staves::
23 * Writing parts::
24 @end menu
25
26
27 @node Displaying staves
28 @subsection Displaying staves
29
30 This section describes the different methods of creating and
31 grouping staves.
32
33 @menu
34 * Instantiating new staves::
35 * Grouping staves::
36 * Nested staff groups::
37 @end menu
38
39
40 @node Instantiating new staves
41 @unnumberedsubsubsec Instantiating new staves
42
43 @cindex new staff
44 @cindex staff initiation
45 @cindex staff instantiation
46 @cindex staff, new
47 @cindex staff, single
48 @cindex drum staff
49 @cindex percussion staff
50 @cindex Gregorian transcription staff
51 @cindex rhythmic staff
52 @cindex tabstaff
53 @cindex tablature
54
55 @notation{Staves} (singular: @notation{staff}) are created with
56 the @code{\new} or @code{\context} commands.  For details, see
57 @ref{Creating contexts}.
58
59 The basic staff context is @code{Staff}:
60
61 @lilypond[verbatim,quote,relative=2]
62 \new Staff { c4 d e f }
63 @end lilypond
64
65 @code{DrumStaff} creates a five-line staff set up for a
66 typical drum set.  It uses different names for each instrument.
67 The instrument names are set using the @code{\drummode} command.
68 For details, see @ref{Percussion staves}.
69
70 @lilypond[verbatim,quote]
71 \new DrumStaff {
72   \drummode { cymc hh ss tomh }
73 }
74 @end lilypond
75
76 @c FIXME: remove when mentioned in NR 2.8
77 @code{GregorianTranscriptionStaff} creates a staff to notate
78 modern Gregorian chant.  It does not show bar lines.
79
80 @lilypond[verbatim,quote,relative=2]
81 \new GregorianTranscriptionStaff { c4 d e f e d }
82 @end lilypond
83
84 @code{RhythmicStaff} creates a single-line staff that only
85 displays the rhythmic values of the input.  Real durations are
86 preserved. For details, see @ref{Showing melody rhythms}.
87
88 @lilypond[verbatim,quote,relative=2]
89 \new RhythmicStaff { c4 d e f }
90 @end lilypond
91
92 @code{TabStaff} creates a tablature with six strings in standard
93 guitar tuning.  For details, see @ref{Default tablatures}.
94
95 @lilypond[verbatim,quote,relative=2]
96 \new TabStaff { c4 d e f }
97 @end lilypond
98
99 There are two staff contexts specific for the notation of ancient
100 music: @code{MensuralStaff} and @code{VaticanaStaff}.  They are
101 described in @ref{Pre-defined contexts}.
102
103 New single staff contexts may be defined.  For details, see
104 @ref{Defining new contexts}.
105
106
107 @seealso
108
109 Music Glossary:
110 @rglos{staff},
111 @rglos{staves}.
112
113 Notation Reference:
114 @ref{Creating contexts},
115 @ref{Percussion staves},
116 @ref{Showing melody rhythms},
117 @ref{Default tablatures},
118 @ref{Pre-defined contexts},
119 @ref{Staff symbol},
120 @ref{Gregorian chant contexts},
121 @ref{Mensural contexts},
122 @ref{Defining new contexts}.
123
124 Snippets:
125 @rlsr{Staff notation}.
126
127 Internals Reference:
128 @rinternals{Staff},
129 @rinternals{DrumStaff},
130 @rinternals{GregorianTranscriptionStaff},
131 @rinternals{RhythmicStaff},
132 @rinternals{TabStaff},
133 @rinternals{MensuralStaff},
134 @rinternals{VaticanaStaff},
135 @rinternals{StaffSymbol}.
136
137
138 @node Grouping staves
139 @unnumberedsubsubsec Grouping staves
140
141 @cindex start of system
142 @cindex staff, multiple
143 @cindex staves, multiple
144 @cindex system start delimiters
145 @cindex bracket, vertical
146 @cindex brace, vertical
147 @cindex choir staff
148 @cindex grand staff
149 @cindex piano staff
150 @cindex staff group
151 @cindex staff, choir
152 @cindex staff, piano
153 @cindex system
154
155 Various contexts exist to group single staves together in order to
156 form multi-stave systems.  Each grouping context sets the style of
157 the system start delimiter and the behavior of bar lines.
158
159 If no context is specified, the default properties will be used:
160 the group is started with a vertical line, and the bar lines are
161 not connected.
162
163 @lilypond[verbatim,quote,relative=2]
164 <<
165   \new Staff { c1 c }
166   \new Staff { c1 c }
167 >>
168 @end lilypond
169
170 In the @code{StaffGroup} context, the group is started with a
171 bracket and bar lines are drawn through all the staves.
172
173 @lilypond[verbatim,quote,relative=2]
174 \new StaffGroup <<
175   \new Staff { c1 c }
176   \new Staff { c1 c }
177 >>
178 @end lilypond
179
180 In a @code{ChoirStaff}, the group starts with a bracket, but bar
181 lines are not connected.
182
183 @lilypond[verbatim,quote,relative=2]
184 \new ChoirStaff <<
185   \new Staff { c1 c }
186   \new Staff { c1 c }
187 >>
188 @end lilypond
189
190 In a @code{GrandStaff}, the group begins with a brace, and bar
191 lines are connected between the staves.
192
193 @lilypond[verbatim,quote,relative=2]
194 \new GrandStaff <<
195   \new Staff { c1 c }
196   \new Staff { c1 c }
197 >>
198 @end lilypond
199
200 The @code{PianoStaff} is identical to a @code{GrandStaff}, except
201 that it supports printing the instrument name directly.  For
202 details, see @ref{Instrument names}.
203
204 @lilypond[verbatim,quote,relative=2]
205 \new PianoStaff <<
206   \set PianoStaff.instrumentName = "Piano"
207   \new Staff { c1 c }
208   \new Staff { c1 c }
209 >>
210 @end lilypond
211
212 Each staff group context sets the property
213 @code{systemStartDelimiter} to one of the following values:
214 @code{SystemStartBar}, @code{SystemStartBrace}, or
215 @code{SystemStartBracket}.  A fourth delimiter,
216 @code{SystemStartSquare}, is also available, but it must be
217 explicitly specified.
218
219 New staff group contexts may be defined.  For details, see
220 @ref{Defining new contexts}.
221
222
223 @snippets
224
225 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
226 {use-square-bracket-at-the-start-of-a-staff-group.ly}
227
228 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
229 {display-bracket-with-only-one-staff-in-a-system.ly}
230
231 @cindex mensurstriche layout
232 @cindex renaissance music
233 @cindex transcription of mensural music
234 @cindex mensural music, transcription of
235
236 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
237 {mensurstriche-layout-bar-lines-between-the-staves.ly}
238 @c FIXME: move to NR 2.8.x when sectioning is ready
239
240
241 @seealso
242
243 Music Glossary:
244 @rglos{brace},
245 @rglos{bracket},
246 @rglos{grand staff}.
247
248 Notation Reference:
249 @ref{Instrument names},
250 @ref{Defining new contexts}.
251
252 Snippets:
253 @rlsr{Staff notation}.
254
255 Internals Reference:
256 @rinternals{Staff},
257 @rinternals{StaffGroup},
258 @rinternals{ChoirStaff},
259 @rinternals{GrandStaff},
260 @rinternals{PianoStaff},
261 @rinternals{SystemStartBar},
262 @rinternals{SystemStartBrace},
263 @rinternals{SystemStartBracket},
264 @rinternals{SystemStartSquare}.
265
266
267 @node Nested staff groups
268 @unnumberedsubsubsec Nested staff groups
269
270 @cindex staff, nested
271 @cindex staves, nested
272 @cindex nesting of staves
273 @cindex system start delimiters, nested
274 @cindex nested staff brackets
275 @cindex brackets, nesting of
276 @cindex braces, nesting of
277 @cindex inner staff group
278 @cindex inner choir staff group
279
280 Two additional staff-group contexts are available that can be
281 nested within a @code{StaffGroup} or @code{ChoirStaff} context:
282 @code{InnerStaffGroup} and @code{InnerChoirStaff}.  These contexts
283 create a new bracket adjacent to the bracket of their parent staff
284 group.
285
286 An @code{InnerStaffGroup} is treated similarly to a
287 @code{StaffGroup}; bar lines are connected between each staff
288 within the context:
289
290 @lilypond[verbatim,quote,relative=2]
291 \new StaffGroup <<
292   \new Staff { c2 c | c2 c }
293   \new InnerStaffGroup <<
294     \new Staff { g2 g | g2 g }
295     \new Staff { e2 e | e2 e }
296   >>
297 >>
298 @end lilypond
299
300 Bar lines are @emph{not} connected between staves of an
301 @code{InnerChoirStaff}, just like a @code{ChoirStaff}:
302
303 @lilypond[verbatim,quote,relative=2]
304 \new ChoirStaff <<
305   \new Staff { c2 c | c2 c }
306   \new InnerChoirStaff <<
307     \new Staff { g2 g | g2 g }
308     \new Staff { e2 e | e2 e }
309   >>
310   \new Staff { c1 | c1 }
311 >>
312 @end lilypond
313
314 New nested staff group contexts can be defined.  For details, see
315 @ref{Defining new contexts}.
316
317
318 @snippets
319
320 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
321 {nesting-staves.ly}
322
323
324 @seealso
325
326 Notation Reference:
327 @ref{Grouping staves},
328 @ref{Instrument names},
329 @ref{Defining new contexts}.
330
331 Snippets:
332 @rlsr{Staff notation}.
333
334 Internals Reference:
335 @rinternals{InnerStaffGroup},
336 @rinternals{StaffGroup},
337 @rinternals{InnerChoirStaff},
338 @rinternals{ChoirStaff},
339 @rinternals{SystemStartBar},
340 @rinternals{SystemStartBrace},
341 @rinternals{SystemStartBracket},
342 @rinternals{SystemStartSquare}.
343
344
345 @node Modifying single staves
346 @subsection Modifying single staves
347
348 This section explains how to change specific attributes of one
349 staff: for example, modifying the number of staff lines or the
350 staff size.  Methods to start and stop staves and set ossia
351 sections are also described.
352
353 @menu
354 * Staff symbol::
355 * Ossia staves::
356 * Hiding staves::
357 @end menu
358
359
360 @node Staff symbol
361 @unnumberedsubsubsec Staff symbol
362
363 @cindex adjusting staff symbol
364 @cindex drawing staff symbol
365 @cindex staff symbol, setting of
366 @cindex stop staff lines
367 @cindex start staff lines
368 @cindex staff lines, amount of
369 @cindex staff lines, number of
370 @cindex staff line, thickness of
371 @cindex amount of staff lines
372 @cindex thickness of staff lines
373 @cindex ledger lines, setting
374 @cindex setting of ledger lines
375 @cindex spacing of ledger lines
376 @cindex number of staff lines
377
378 The lines of a staff belong to the @code{StaffSymbol} grob.
379 @code{StaffSymbol} properties can be modified to change the
380 appearance of a staff, but they must be modified before the staff
381 is created.
382
383 @c FIXME most of this section should be moved to NR 5.3 or moved to LSR -td
384
385 The number of staff lines may be changed.  The clef position and
386 the position of middle C may need to be modified to fit the new
387 staff.  For an explanation, refer to the snippet section in
388 @ref{Clef}.
389
390 @lilypond[verbatim,quote,relative=2]
391 \new Staff \with {
392   \override StaffSymbol #'line-count = #3
393 }
394 { d4 d d d }
395 @end lilypond
396
397 The vertical position of staff lines and the number of staff lines
398 can be defined at the same time.  As the following example shows,
399 note positions are not influenced by the staff line positions.
400
401 @warning{The @code{'line-positions} property overrides the
402 @code{'line-count} property.  The number of staff lines is
403 implicitly defined by the number of elements in the list of values
404 for @code{'line-positions}.}
405
406 @lilypond[verbatim,quote,relative=1]
407 \new Staff \with {
408   \override StaffSymbol #'line-positions = #'(7 3 0 -4 -6 -7)
409 }
410 { a4 e' f b | d1 }
411 @end lilypond
412
413 Staff line thickness can be modified.  The thickness of ledger
414 lines and stems are also affected, since they depend on staff line
415 thickness.
416
417 @lilypond[verbatim,quote,relative=1]
418 \new Staff \with {
419   \override StaffSymbol #'thickness = #3
420 }
421 { e4 d c b }
422 @end lilypond
423
424 Ledger line thickness can be set independently of staff line
425 thickness.
426
427 @lilypond[verbatim,quote,relative=1]
428 \new Staff \with {
429   \override StaffSymbol #'ledger-line-thickness = #'(1 . 0.2)
430 }
431 { e4 d c b }
432 @end lilypond
433
434 The distance between staff lines can be changed.  This setting
435 affects the spacing of ledger lines as well.
436
437 @lilypond[verbatim,quote,relative=1]
438 \new Staff \with {
439   \override StaffSymbol #'staff-space = #1.5
440 }
441 { a4 b c d }
442 @end lilypond
443
444 The width of a staff can be modified.  The units are staff
445 spaces.  The spacing of objects inside the staff is not affected by
446 this setting.
447
448 @lilypond[verbatim,quote,relative=1]
449 \new Staff \with {
450   \override StaffSymbol #'width = #23
451 }
452 { a4 e' f b | d1 }
453 @end lilypond
454
455 Further details about the properties of @code{StaffSymbol} can be
456 found in @rinternals{staff-symbol-interface}.
457
458 @funindex \startStaff
459 @funindex \stopStaff
460
461 Modifications to staff properties in the middle of a score can be
462 placed between @code{\stopStaff} and @code{\startStaff}:
463
464 @lilypond[verbatim,quote,relative=2]
465 c2 c
466 \stopStaff
467 \override Staff.StaffSymbol #'line-count = #2
468 \startStaff
469 b2 b
470 \stopStaff
471 \revert Staff.StaffSymbol #'line-count
472 \startStaff
473 a2 a
474 @end lilypond
475
476 @cindex stopping a staff
477
478 @noindent
479 In general, @code{\startStaff} and @code{\stopStaff} can be used
480 to stop or start a staff in the middle of a score.
481
482 @lilypond[verbatim,quote,relative=2]
483 c4 b a2
484 \stopStaff
485 b4 c d2
486 \startStaff
487 e4 d c2
488 @end lilypond
489
490
491 @predefined
492
493 @code{\startStaff},
494 @code{\stopStaff}.
495
496
497 @snippets
498
499 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
500 {making-some-staff-lines-thicker-than-the-others.ly}
501
502
503 @seealso
504
505 Music Glossary:
506 @rglos{line},
507 @rglos{ledger line},
508 @rglos{staff}.
509
510 Notation Reference:
511 @ref{Clef}.
512
513 Snippets:
514 @rlsr{Staff notation}.
515
516 Internals Reference:
517 @rinternals{StaffSymbol},
518 @rinternals{staff-symbol-interface}.
519
520
521 @knownissues
522
523 When setting vertical staff line positions manually, bar lines are
524 always centered on position 0, so the maximum distance between the
525 outermost bar lines in either direction must be equal.
526
527
528 @node Ossia staves
529 @unnumberedsubsubsec Ossia staves
530
531 @cindex staff, Frenched
532 @cindex ossia
533 @cindex Frenched staves
534 @cindex staff, resizing of
535 @cindex resizing of staves
536
537 @notation{Ossia} staves can be set by creating a new simultaneous
538 staff in the appropriate location:
539
540 @lilypond[verbatim,quote]
541 \new Staff \relative c'' {
542   c4 b d c
543   <<
544     { c4 b d c }
545     \new Staff { e4 d f e }
546   >>
547   c4 b c2
548 }
549 @end lilypond
550
551 @noindent
552 However, the above example is usually not the desired result.  To
553 create ossia staves that are above the original staff, have no
554 time signature or clef, and have a smaller font size, tweaks must
555 be used.  The Learning Manual describes a specific technique to
556 achieve this goal, beginning with
557 @rlearning{Nesting music expressions}.
558
559 The following example uses the @code{alignAboveContext} property
560 to align the ossia staff.  This method is most appropriate when
561 only a few ossia staves are needed.
562
563 @lilypond[verbatim,quote]
564 \new Staff = main \relative c'' {
565   c4 b d c
566   <<
567     { c4 b d c }
568
569     \new Staff \with {
570       \remove "Time_signature_engraver"
571       alignAboveContext = #"main"
572       fontSize = #-3
573       \override StaffSymbol #'staff-space = #(magstep -3)
574       \override StaffSymbol #'thickness = #(magstep -3)
575       firstClef = ##f
576     }
577     { e4 d f e }
578   >>
579   c4 b c2
580 }
581 @end lilypond
582
583 If many isolated ossia staves are needed, creating an empty
584 @code{Staff} context with a specific @emph{context id} may be more
585 appropriate; the ossia staves may then be created by
586 @emph{calling} this context and using @code{\startStaff} and
587 @code{\stopStaff} at the desired locations.  The benefits of this
588 method are more apparent if the piece is longer than the following
589 example.
590
591 @lilypond[verbatim,quote,ragged-right]
592 <<
593   \new Staff = ossia \with {
594     \remove "Time_signature_engraver"
595     \override Clef #'transparent = ##t
596     fontSize = #-3
597     \override StaffSymbol #'staff-space = #(magstep -3)
598     \override StaffSymbol #'thickness = #(magstep -3)
599   }
600   { \stopStaff s1*6 }
601
602   \new Staff \relative c' {
603     c4 b c2
604     <<
605       { e4 f e2 }
606       \context Staff = ossia {
607         \startStaff e4 g8 f e2 \stopStaff
608       }
609     >>
610     g4 a g2 \break
611     c4 b c2
612     <<
613       { g4 a g2 }
614       \context Staff = ossia {
615         \startStaff g4 e8 f g2 \stopStaff
616       }
617     >>
618     e4 d c2
619   }
620 >>
621 @end lilypond
622
623 Using the @code{\RemoveEmptyStaffContext} command to create ossia
624 staves may be used as an alternative.  This method is most
625 convenient when ossia staves occur immediately following a line
626 break.  In this case, spacer rests do not need to be used at all;
627 only @code{\startStaff} and @code{\stopStaff} are necessary.  For
628 more information about @code{\RemoveEmptyStaffContext}, see
629 @ref{Hiding staves}.
630
631 @lilypond[verbatim,quote,ragged-right]
632 <<
633   \new Staff = ossia \with {
634     \remove "Time_signature_engraver"
635     \override Clef #'transparent = ##t
636     fontSize = #-3
637     \override StaffSymbol #'staff-space = #(magstep -3)
638     \override StaffSymbol #'thickness = #(magstep -3)
639   }
640   \new Staff \relative c' {
641     c4 b c2
642     e4 f e2
643     g4 a g2 \break
644     <<
645       { c4 b c2 }
646       \context Staff = ossia {
647         c4 e8 d c2 \stopStaff
648       }
649     >>
650     g4 a g2
651     e4 d c2
652   }
653 >>
654
655 \layout {
656   \context {
657     \RemoveEmptyStaffContext
658     \override VerticalAxisGroup #'remove-first = ##t
659   }
660 }
661 @end lilypond
662
663
664 @snippets
665
666 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
667 {vertically-aligning-ossias-and-lyrics.ly}
668
669
670 @seealso
671
672 Music Glossary:
673 @rglos{ossia},
674 @rglos{staff},
675 @rglos{Frenched staff}.
676
677 Learning Manual:
678 @rlearning{Nesting music expressions},
679 @rlearning{Size of objects},
680 @rlearning{Length and thickness of objects}.
681
682 Notation Reference:
683 @ref{Hiding staves}.
684
685 Snippets:
686 @rlsr{Staff notation}.
687
688 Internals Reference:
689 @rinternals{StaffSymbol}.
690
691
692 @node Hiding staves
693 @unnumberedsubsubsec Hiding staves
694
695 @cindex Frenched score
696 @cindex Frenched staff
697 @cindex staff, hiding
698 @cindex staff, empty
699 @cindex hiding of staves
700 @cindex empty staves
701
702 Staff lines can be hidden by removing the
703 @code{Staff_symbol_engraver} from the @code{Staff} context.  As an
704 alternative, @code{\stopStaff} may be used.
705
706 @lilypond[verbatim,quote]
707 \new Staff \with {
708   \remove "Staff_symbol_engraver"
709 }
710 \relative c''' { a8 f e16 d c b a2 }
711 @end lilypond
712
713 @funindex \RemoveEmptyStaffContext
714
715 Empty staves can be hidden by setting the
716 @code{\RemoveEmptyStaffContext} command in the @code{\layout}
717 block.  In orchestral scores, this style is known as @q{Frenched
718 Score}.  By default, this command hides and removes all empty
719 staves in a score except for those in the first system.
720
721 @warning{An empty staff may only include multi-measure rests,
722 skips, spacer rests, or a combination of these elements.}
723
724 @lilypond[verbatim,quote,ragged-right]
725 \layout {
726   \context {
727     \RemoveEmptyStaffContext
728   }
729 }
730
731 \relative c' <<
732   \new Staff {
733     e4 f g a \break
734     b1 \break
735     a4 b c2
736   }
737   \new Staff {
738     c,4 d e f \break
739     R1 \break
740     f4 g c,2
741   }
742 >>
743 @end lilypond
744
745 @cindex ossia
746
747 @noindent
748 @code{\RemoveEmptyStaffContext} can also be used to create ossia
749 sections for a staff.  For details, see @ref{Ossia staves}.
750
751 @cindex hiding ancient staves
752 @cindex hiding rhythmic staves
753 @funindex \AncientRemoveEmptyStaffContext
754 @funindex \RemoveEmptyRhythmicStaffContext
755
756 The @code{\AncientRemoveEmptyStaffContext} command may be used to
757 hide empty staves in ancient music contexts.  Similarly,
758 @code{\RemoveEmptyRhythmicStaffContext} may be used to hide empty
759 @code{RhythmicStaff} contexts.
760
761
762 @predefined
763
764 @code{\RemoveEmptyStaffContext},
765 @code{\AncientRemoveEmptyStaffContext},
766 @code{\RemoveEmptyRhythmicStaffContext}.
767
768
769 @snippets
770
771 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
772 {removing-the-first-empty-line.ly}
773
774
775 @seealso
776
777 Music Glossary:
778 @rglos{Frenched staff}.
779
780 Notation Reference:
781 @ref{Staff symbol},
782 @ref{Ossia staves}.
783
784 Snippets:
785 @rlsr{Staff notation}.
786
787 Internals Reference:
788 @rinternals{ChordNames},
789 @rinternals{FiguredBass},
790 @rinternals{Lyrics},
791 @rinternals{Staff},
792 @rinternals{VerticalAxisGroup},
793 @rinternals{Staff_symbol_engraver}.
794
795
796 @knownissues
797
798 Removing @code{Staff_symbol_engraver} also hides bar lines.  If
799 bar line visibility is forced, formatting errors may occur.  In
800 this case, use the following overrides instead of removing the
801 engraver:
802
803 @example
804 \override StaffSymbol #'stencil = ##f
805 \override NoteHead #'no-ledgers = ##t
806 @end example
807
808
809 @node Writing parts
810 @subsection Writing parts
811
812 This section explains how to insert tempo indications and
813 instrument names into a score.  Methods to quote other voices and
814 format cue notes are also described.
815
816 @menu
817 * Metronome marks::
818 * Instrument names::
819 * Quoting other voices::
820 * Formatting cue notes::
821 @end menu
822
823
824 @node Metronome marks
825 @unnumberedsubsubsec Metronome marks
826
827 @cindex tempo
828 @cindex beats per minute
829 @cindex metronome marking
830 @cindex metronome marking with text
831 @funindex \tempo
832
833 A basic metronome mark is simple to write:
834
835 @lilypond[verbatim,quote,relative=1]
836 \tempo 4 = 120
837 c2 d
838 e4. d8 c2
839 @end lilypond
840
841 Tempo indications with text can be used instead:
842
843 @lilypond[verbatim,quote,relative=2]
844 \tempo "Allegretto"
845 c4 e d c
846 b4. a16 b c4 r4
847 @end lilypond
848
849 Combining a metronome mark and text will automatically place the
850 metronome mark within parentheses:
851
852 @lilypond[verbatim,quote,relative=2]
853 \tempo "Allegro" 4 = 160
854 g4 c d e
855 d4 b g2
856 @end lilypond
857
858 In general, the text can be any markup object:
859
860 @lilypond[verbatim,quote,relative=2]
861 \tempo \markup { \italic Faster } 4 = 132
862 a8-. r8 b-. r gis-. r a-. r
863 @end lilypond
864
865 A parenthesized metronome mark with no textual indication may be
866 written by including an empty string in the input:
867
868 @lilypond[verbatim,quote,relative=2]
869 \tempo "" 8 = 96
870 d4 g e c
871 @end lilypond
872
873
874 @snippets
875
876 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
877 {printing-metronome-and-rehearsal-marks-below-the-staff.ly}
878
879 @c perhaps also an example of how to move it horizontally?
880
881 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
882 {changing-the-tempo-without-a-metronome-mark.ly}
883
884 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
885 {creating-metronome-marks-in-markup-mode.ly}
886
887 For more details, see @ref{Formatting text}.
888
889
890 @seealso
891
892 Music Glossary:
893 @rglos{metronome},
894 @rglos{metronomic indication},
895 @rglos{tempo indication},
896 @rglos{metronome mark}.
897
898 Notation Reference:
899 @ref{Formatting text},
900 @ref{MIDI output}.
901
902 Snippets:
903 @rlsr{Staff notation}.
904
905 Internals Reference:
906 @rinternals{MetronomeMark}.
907
908
909 @node Instrument names
910 @unnumberedsubsubsec Instrument names
911
912 @cindex instrument names
913 @cindex instrument names, short
914
915 Instrument names can be printed on the left side of staves in the
916 @code{Staff} and @code{PianoStaff} contexts.  The value of
917 @code{instrumentName} is used for the first staff, and the value
918 of @code{shortInstrumentName} is used for all succeeding staves.
919
920 @lilypond[verbatim,quote,ragged-right,relative=1]
921 \set Staff.instrumentName = "Violin "
922 \set Staff.shortInstrumentName = "Vln "
923 c4.. g'16 c4.. g'16
924 \break
925 c1
926 @end lilypond
927
928 Markup mode can be used to create more complicated instrument
929 names:
930
931 @lilypond[verbatim,quote,relative=2]
932 \set Staff.instrumentName = \markup {
933   \column { "Clarinetti"
934             \line { "in B" \smaller \flat } } }
935 c4 c,16 d e f g2
936 @end lilypond
937
938 @cindex instrument names, centering
939
940 When two or more staff contexts are grouped together, the
941 instrument names and short instrument names are centered by
942 default.  To center multi-line instrument names,
943 @code{\center-column} must be used:
944
945 @lilypond[verbatim,quote,indent=1.5\cm,relative=2]
946 <<
947   \new Staff {
948     \set Staff.instrumentName = "Flute"
949     f2 g4 f
950   }
951   \new Staff {
952     \set Staff.instrumentName = \markup \center-column {
953       Clarinet
954       \line { "in B" \smaller \flat }
955     }
956     c4 b c2
957   }
958 >>
959 @end lilypond
960
961 @cindex indent
962 @cindex short-indent
963
964 However, if the instrument names are longer, the instrument names
965 in a staff group may not be centered unless the @code{indent} and
966 @code{short-indent} settings are increased.  For details about
967 these settings, see @ref{Horizontal dimensions}.
968
969 @lilypond[verbatim,quote,ragged-right]
970 \layout {
971   indent = 3.0\cm
972   short-indent = 1.5\cm
973 }
974
975 \relative c'' <<
976   \new Staff {
977     \set Staff.instrumentName = "Alto Flute in G"
978     \set Staff.shortInstrumentName = "Fl."
979     f2 g4 f \break
980     g4 f g2
981   }
982   \new Staff {
983     \set Staff.instrumentName = "Clarinet"
984     \set Staff.shortInstrumentName = "Clar."
985     c,4 b c2 \break
986     c2 b4 c
987   }
988 >>
989 @end lilypond
990
991 To add instrument names to other contexts (such as
992 @code{GrandStaff}, @code{ChoirStaff}, or @code{StaffGroup}),
993 @code{Instrument_name_engraver} must be added to that context.
994 For details, see @ref{Modifying context plug-ins}.
995
996 @cindex instrument names, changing
997
998 Instrument names may be changed in the middle of a piece:
999
1000 @lilypond[verbatim,quote,ragged-right,relative=1]
1001 \set Staff.instrumentName = "First"
1002 \set Staff.shortInstrumentName = "one"
1003 c1 c c c \break
1004 c1 c c c \break
1005 \set Staff.instrumentName = "Second"
1006 \set Staff.shortInstrumentName = "two"
1007 c1 c c c \break
1008 c1 c c c \break
1009 @end lilypond
1010
1011 @cindex instrument switch
1012 @cindex switching instruments
1013
1014 If an instrument @emph{switch} is needed,
1015 @code{\addInstrumentDefinition} may be used in combination with
1016 @code{\instrumentSwitch} to create a detailed list of the
1017 necessary changes for the switch.  The
1018 @code{\addInstrumentDefinition} command has two arguments: an
1019 identifying string, and an association list of context properties
1020 and values to be used for the instrument.  It must be placed in
1021 the toplevel scope.  @code{\instrumentSwitch} is used in the music
1022 expression to declare the instrument switch:
1023
1024 @lilypond[verbatim,quote,ragged-right]
1025 \addInstrumentDefinition #"contrabassoon"
1026   #`((instrumentTransposition . ,(ly:make-pitch -1 0 0))
1027      (shortInstrumentName . "Cbsn.")
1028      (clefGlyph . "clefs.F")
1029      (middleCPosition . 6)
1030      (clefPosition . 2)
1031      (instrumentCueName . ,(make-bold-markup "cbsn."))
1032      (midiInstrument . "bassoon"))
1033
1034 \new Staff \with {
1035   instrumentName = "Bassoon"
1036 }
1037 \relative c' {
1038   \clef tenor
1039   \compressFullBarRests
1040   c2 g'
1041   R1*16
1042   \instrumentSwitch "contrabassoon"
1043   c,,2 g \break
1044   c,1 ~ | c1
1045 }
1046 @end lilypond
1047
1048
1049 @seealso
1050
1051 Notation Reference:
1052 @ref{Horizontal dimensions},
1053 @ref{Modifying context plug-ins}.
1054
1055 Snippets:
1056 @rlsr{Staff notation}.
1057
1058 Internals Reference:
1059 @rinternals{InstrumentName},
1060 @rinternals{PianoStaff},
1061 @rinternals{Staff}.
1062
1063
1064 @node Quoting other voices
1065 @unnumberedsubsubsec Quoting other voices
1066
1067 @cindex cues
1068 @cindex quoting other voices
1069 @cindex fragments
1070 @cindex cue notes
1071
1072 It is very common for one voice to double the some of the music from                     
1073 another voice.  For example, the first and second violins may play the                    
1074 same notes during a passage of music.  In LilyPond this is accomplished                   
1075 by letting one voice @emph{quote} the other voice without having to
1076 re-enter it.
1077                                                                        
1078 Before a part can be quoted, the @code{\addQuote} command must be used                   
1079 to initialize the quoted fragment.  This command must be used in the                      
1080 toplevel scope.  The first argument is an identifying string, and the                     
1081 second is a music expression: 
1082
1083 @example
1084 flute = \relative c'' @{
1085   a4 gis g gis
1086 @}
1087 \addQuote "flute" @{ \flute @}
1088 @end example
1089
1090 The @code{\quoteDuring} command is used to indicate the point where the
1091 quotation begins.  It is followed by two arguments: the name of the
1092 quoted voice, as defined with @code{\addQuote}, and a music expression
1093 that indicates the duration of the quote, usually spacer rests or
1094 multi-measure rests.  The corresponding music from the quoted voice is
1095 inserted into the music expression:
1096
1097 @lilypond[verbatim,quote]
1098 flute = \relative c'' {
1099   a4 gis g gis
1100 }
1101 \addQuote "flute" { \flute }
1102
1103 \relative c' {
1104   c4 cis \quoteDuring #"flute" { s2 }
1105 }
1106 @end lilypond
1107
1108 If the music expression used for @code{\quoteDuring} contains
1109 anything but a spacer rest or multi-measure rest, a polyphonic
1110 situation is created, which is often not desirable:
1111
1112 @lilypond[verbatim,quote]
1113 flute = \relative c'' {
1114   a4 gis g gis
1115 }
1116 \addQuote "flute" { \flute }
1117
1118 \relative c' {
1119   c4 cis \quoteDuring #"flute" { c4 b }
1120 }
1121 @end lilypond
1122
1123 Quotations recognize instrument transposition settings for both
1124 the source and target instruments if the @code{\transposition}
1125 command is used.  For details about @code{\transposition}, see
1126 @ref{Instrument transpositions}.
1127
1128 @lilypond[verbatim,quote]
1129 clarinet = \relative c'' {
1130   \transposition bes
1131   a4 gis g gis
1132 }
1133 \addQuote "clarinet" { \clarinet }
1134
1135 \relative c' {
1136   c4 cis \quoteDuring #"clarinet" { s2 }
1137 }
1138 @end lilypond
1139
1140 It is possible to tag quotations with unique names in order to
1141 process them in different ways.  For details about this procedure,
1142 see @ref{Using tags}.
1143
1144
1145 @snippets
1146
1147 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1148 {quoting-another-voice-with-transposition.ly}
1149
1150 @cindex note-event
1151 @cindex articulation-event
1152 @cindex dynamic-event
1153 @cindex rest-event
1154 @funindex quotedEventTypes
1155
1156 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1157 {quoting-another-voice.ly}
1158
1159
1160 @seealso
1161
1162 Notation Reference:
1163 @ref{Instrument transpositions},
1164 @ref{Using tags}.
1165
1166 Snippets:
1167 @rlsr{Staff notation}.
1168
1169 Internals Reference:
1170 @rinternals{QuoteMusic},
1171 @rinternals{Voice}.
1172
1173
1174 @knownissues
1175
1176 Only the contents of the first @code{Voice} occurring in an
1177 @code{\addQuote} command will be considered for quotation, so
1178 @var{music} cannot contain @code{\new} and @code{\context Voice}
1179 statements that would switch to a different Voice.
1180
1181 Quoting grace notes is broken and can even cause LilyPond to
1182 crash.
1183
1184 Quoting nested triplets may result in poor notation.
1185
1186 In earlier versions of LilyPond (pre 2.11), @code{addQuote} was
1187 written entirely in lower-case letters: @code{\addquote}.
1188
1189
1190 @node Formatting cue notes
1191 @unnumberedsubsubsec Formatting cue notes
1192
1193 @cindex cues
1194 @cindex cue notes
1195 @cindex cue notes, formatting
1196 @cindex fragments
1197 @cindex quoting other voices
1198 @cindex cues, formatting
1199
1200 The previous section explains how to create quotations.  The
1201 @code{\cueDuring} command is a more specialized form of
1202 @code{\quoteDuring}, being particularly useful for inserting cue
1203 notes into a part.  The syntax is as follows:
1204
1205 @example
1206 \cueDuring #@var{partname} #@var{voice} @var{music}
1207 @end example
1208
1209 This command copies the corresponding measures from @var{partname}
1210 into a @code{CueVoice} context.  The @code{CueVoice} is created
1211 implicitly, and occurs simultaneously with @var{music}, which
1212 creates a polyphonic situation.  The @var{voice} argument
1213 determines whether the cue notes should be notated as a first or
1214 second voice; @code{UP} corresponds to the first voice, and
1215 @code{DOWN} corresponds to the second.
1216
1217 @lilypond[verbatim,quote]
1218 oboe = \relative c'' {
1219   r2 r8 d16 f e g f a
1220   g8 g16 g g2.
1221 }
1222 \addQuote "oboe" { \oboe }
1223
1224 \new Voice \relative c'' {
1225   \cueDuring #"oboe" #UP { R1 }
1226   g2 c,
1227 }
1228 @end lilypond
1229
1230 @noindent
1231 In the above example, the @code{Voice} context had to be
1232 explicitly declared, or else the entire music expression would
1233 belong to the @code{CueVoice} context.
1234
1235 The name of the cued instrument can be printed by setting the
1236 @code{instrumentCueName} property in the @code{CueVoice} context.
1237
1238 @lilypond[verbatim,quote]
1239 oboe = \relative c''' {
1240   g4 r8 e16 f e4 d
1241 }
1242 \addQuote "oboe" { \oboe }
1243
1244 \new Staff \relative c'' <<
1245   \new CueVoice \with {
1246     instrumentCueName = "ob."
1247   }
1248   \new Voice {
1249     \cueDuring #"oboe" #UP { R1 }
1250     g4. b8 d2
1251   }
1252 >>
1253 @end lilypond
1254
1255 In addition to printing the name of the cued instrument, when cue
1256 notes end, the name of the original instrument should be printed,
1257 and any other changes introduced by the cued part should be
1258 undone.  This can be accomplished by using
1259 @code{\addInstrumentDefinition} and @code{\instrumentSwitch}.  For
1260 an example and explanation, see @ref{Instrument names}.
1261
1262 The @code{\killCues} command removes cue notes from a music
1263 expression.  This can be useful if cue notes need to be removed
1264 from a part but may be restored at a later time.
1265
1266 @lilypond[verbatim,quote]
1267 flute = \relative c''' {
1268   r2 cis2 r2 dis2
1269 }
1270 \addQuote "flute" { \flute }
1271
1272 \new Voice \relative c'' {
1273   \killCues {
1274     \cueDuring #"flute" #UP { R1 }
1275     g4. b8 d2
1276   }
1277 }
1278 @end lilypond
1279
1280 The @code{\transposedCueDuring} command is useful for adding
1281 instrumental cues from a completely different register.  The
1282 syntax is similar to @code{\cueDuring}, but it requires one extra
1283 argument to specify the transposition of the cued instrument.  For
1284 more information about transposition, see
1285 @ref{Instrument transpositions}.
1286
1287 @lilypond[verbatim,quote]
1288 piccolo = \relative c''' {
1289   \clef "treble^8"
1290   R1
1291   c8 c c e g2
1292   a4 g g2
1293 }
1294 \addQuote "piccolo" { \piccolo }
1295
1296 cbassoon = \relative c, {
1297   \clef "bass_8"
1298   c4 r g r
1299   \transposedCueDuring #"piccolo" #UP c,, { R1 }
1300   c4 r g r
1301 }
1302
1303 <<
1304   \new Staff = "piccolo" \piccolo
1305   \new Staff = "cbassoon" \cbassoon
1306 >>
1307 @end lilypond
1308
1309 It is possible to tag cued parts with unique names in order to
1310 process them in different ways.  For details about this procedure,
1311 see @ref{Using tags}.
1312
1313
1314 @seealso
1315
1316 Notation Reference:
1317 @ref{Instrument transpositions},
1318 @ref{Instrument names},
1319 @ref{Using tags}.
1320
1321 Snippets:
1322 @rlsr{Staff notation}.
1323
1324 Internals Reference:
1325 @rinternals{CueVoice},
1326 @rinternals{Voice}.
1327
1328
1329 @knownissues
1330
1331 Collisions can occur with rests, when using @code{\cueDuring},
1332 between @code{Voice} and @code{CueVoice} contexts.