]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/staff.itely
f26c2c58039ad5e129057c5eb0dce1846901dac8
[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.57"
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 shows the different possibilities of creating and
31 grouping staves, which are marked at the beginning of each line
32 with either a bracket or a brace.
33
34 @menu
35 * Instantiating new staves::
36 * Grouping staves::
37 * Deeper nested staff groups::
38 @end menu
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 }
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 Staves can be started or stopped at any point in the score.  The
104 commands @code{\startStaff} and @code{\stopStaff} are used for
105 this purpose.  For details, see @ref{Staff symbol}.
106
107
108 @seealso
109
110 Music Glossary:
111 @rglos{staff},
112 @rglos{staves}.
113
114 Notation Reference:
115 @ref{Creating contexts},
116 @ref{Percussion staves},
117 @ref{Default tablatures},
118 @ref{Gregorian chant contexts},
119 @ref{Mensural contexts},
120 @ref{Staff symbol},
121 @ref{Pre-defined contexts},
122 @ref{Showing melody rhythms}.
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 almost identical to a @code{GrandStaff},
201 except that it supports printing the instrument name directly.
202 For 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
220 @snippets
221
222 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
223 {use-square-bracket-at-the-start-of-a-staff-group.ly}
224
225 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
226 {display-bracket-with-only-one-staff-in-a-system.ly}
227
228 @cindex mensurstriche layout
229 @cindex renaissance music
230 @cindex transcription of mensural music
231 @cindex mensural music, transcription of
232
233 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
234 {mensurstriche-layout-bar-lines-between-the-staves.ly}
235 @c FIXME: move to NR 2.8.x when sectioning is ready
236
237
238 @seealso
239
240 Music Glossary:
241 @rglos{brace},
242 @rglos{bracket},
243 @rglos{grand staff}.
244
245 Notation Reference:
246 @ref{Instrument names}.
247
248 Snippets:
249 @rlsr{Staff notation}.
250
251 Internals Reference:
252 @rinternals{Staff},
253 @rinternals{ChoirStaff},
254 @rinternals{GrandStaff},
255 @rinternals{PianoStaff},
256 @rinternals{StaffGroup},
257 @rinternals{SystemStartBar},
258 @rinternals{SystemStartBrace},
259 @rinternals{SystemStartBracket},
260 @rinternals{SystemStartSquare}.
261
262
263 @node Deeper nested staff groups
264 @unnumberedsubsubsec Deeper nested staff groups
265
266 @cindex staff, nested
267 @cindex staves, nested
268 @cindex nesting of staves
269 @cindex system start delimiters, nested
270 @cindex nested staff brackets
271 @cindex brackets, nesting of
272 @cindex braces, nesting of
273 @cindex inner staff group
274 @cindex inner choir staff group
275
276 Two additional staff-group contexts are available that can be
277 nested within a @code{StaffGroup} or @code{ChoirStaff} context:
278 @code{InnerStaffGroup} and @code{InnerChoirStaff}.  These contexts
279 create an additional bracket next to the original bracket of their
280 parent staff group.
281
282 An @code{InnerStaffGroup} is treated similarly to a
283 @code{StaffGroup}; bar lines are connected between each stave
284 within the context:
285
286 @lilypond[verbatim,quote,relative=2]
287 \new StaffGroup <<
288   \new Staff { c2 c }
289   \new InnerStaffGroup <<
290     \new Staff { g2 g }
291     \new Staff { e2 e }
292   >>
293 >>
294 @end lilypond
295
296 Bar lines are @emph{not} connected between staves of an
297 @code{InnerChoirStaff}, just like a @code{ChoirStaff}:
298
299 @lilypond[verbatim,quote,relative=2]
300 \new ChoirStaff <<
301   \new Staff { c2 c }
302   \new InnerChoirStaff <<
303     \new Staff { g2 g }
304     \new Staff { e2 e }
305   >>
306   \new Staff { c1 }
307 >>
308 @end lilypond
309
310
311 @snippets
312
313 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
314 {nesting-staves.ly}
315
316
317 @seealso
318
319 Notation Reference:
320 @ref{Grouping staves},
321 @ref{Instrument names}.
322
323 Snippets:
324 @rlsr{Staff notation}.
325
326 Internals Reference:
327 @rinternals{InnerStaffGroup},
328 @rinternals{StaffGroup},
329 @rinternals{InnerChoirStaff},
330 @rinternals{ChoirStaff},
331 @rinternals{SystemStartBar},
332 @rinternals{SystemStartBrace},
333 @rinternals{SystemStartBracket}.
334
335
336 @node Modifying single staves
337 @subsection Modifying single staves
338
339 This section explains how to change specific attributes of one
340 staff: for example, modifying the number of staff lines or the
341 staff size.  Methods to start and stop staves and set ossia
342 sections are also described.
343
344 @menu
345 * Staff symbol::
346 * Ossia staves::
347 * Hiding staves::
348 @end menu
349
350
351 @node Staff symbol
352 @unnumberedsubsubsec Staff symbol
353
354 @cindex adjusting staff symbol
355 @cindex drawing staff symbol
356 @cindex staff symbol, setting of
357 @cindex stop staff lines
358 @cindex start staff lines
359 @cindex staff lines, amount of
360 @cindex staff lines, number of
361 @cindex staff line, thickness of
362 @cindex amount of staff lines
363 @cindex thickness of staff lines
364 @cindex ledger lines, setting
365 @cindex setting of ledger lines
366 @cindex spacing of ledger lines
367 @cindex number of staff lines
368
369 The grob @code{StaffSymbol} is responsible for drawing the lines
370 of a staff.  Its properties can be altered in order to change the
371 appearance of a staff, but they must be changed before the staff
372 is created.  A staff may be started or stopped at any point in the
373 score.
374
375 The number of staff lines may be changed.  The clef position and
376 the position of middle C may need to be modified to fit the new
377 staff.  For an explanation, refer to the snippet section in
378 @ref{Clef}.
379
380 @lilypond[verbatim,quote,relative=2]
381 \new Staff {
382   \override Staff.StaffSymbol #'line-count = #3
383   d4 d d d
384 }
385 @end lilypond
386
387 The vertical position of staff lines and the number of staff lines
388 can be defined at the same time.  As the example shows, the
389 positions of the notes are not influenced by the position of the
390 staff lines.  Details for modifying this property are found in
391 @rinternals{staff-symbol-interface}.
392
393 @warning{The @code{'line-positions} property overrides the
394 @code{'line-count} property.  The number of staff lines is
395 implicitly defined by the number of elements in the list of values
396 for @code{'line-positions}}
397
398 @lilypond[verbatim,quote,relative=1]
399 \new Staff \with {
400   \override StaffSymbol #'line-positions = #'(7 3 0 -4 -6 -7)
401 }
402 { a4 e' f b | d1 }
403 @end lilypond
404
405 The staff line thickness can be modified.  The thickness of ledger
406 lines and stems are also affected, since they depend on staff line
407 thickness.
408
409 @lilypond[verbatim,quote,relative=1]
410 \new Staff \with {
411   \override StaffSymbol #'thickness = #3
412 }
413 { e4 d c b }
414 @end lilypond
415
416 The thickness of ledger lines can be set independently of staff
417 line thickness.  A description of this property is also found in
418 @rinternals{staff-symbol-interface}.
419
420 @lilypond[verbatim,quote,relative=1]
421 \new Staff \with {
422   \override StaffSymbol #'ledger-line-thickness = #'(1 . 0.2)
423 }
424 { e4 d c b }
425 @end lilypond
426
427 The distance between staff lines can be changed.  The setting has
428 influence on ledger lines as well.
429
430 @lilypond[verbatim,quote,relative=1]
431 \new Staff \with {
432   \override StaffSymbol #'staff-space = #1.5
433 }
434 { a4 b c d }
435 @end lilypond
436
437 The width of a staff can be adjusted.  The unit is one staff
438 space.  The spacing of objects inside the staff is not influenced
439 by this setting.
440
441 @lilypond[verbatim,quote,relative=1]
442 \new Staff \with {
443   \override StaffSymbol #'width = #23
444 }
445 { a4 e' f b | d1 }
446 @end lilypond
447
448 Modifications to staff properties in the middle of a score can be
449 placed between @code{\stopStaff} and @code{\startStaff}:
450
451 @lilypond[verbatim,quote,relative=2]
452 c2 c
453 \stopStaff
454 \override Staff.StaffSymbol #'line-count = #2
455 \startStaff
456 b2 b
457 \stopStaff
458 \revert Staff.StaffSymbol #'line-count
459 \startStaff
460 a2 a
461 @end lilypond
462
463
464 @predefined
465
466 @funindex \startStaff
467 @code{\startStaff},
468 @funindex \stopStaff
469 @code{\stopStaff}.
470
471
472 @snippets
473
474 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
475 {making-some-staff-lines-thicker-than-the-others.ly}
476
477
478 @seealso
479
480 Music Glossary:
481 @rglos{line},
482 @rglos{ledger line},
483 @rglos{staff}.
484
485 Notation Reference:
486 @ref{Displaying pitches}.
487
488 Snippets:
489 @rlsr{Staff notation}.
490
491 Internals Reference:
492 @rinternals{StaffSymbol},
493 @rinternals{staff-symbol-interface}.
494
495
496 @knownissues
497
498 When setting staff lines manually, bar lines are always drawn
499 centered on the position 0, so the maximum distance of the bar
500 lines in either direction must be equal.
501
502
503 @node Ossia staves
504 @unnumberedsubsubsec Ossia staves
505
506 @cindex staff, Frenched
507 @cindex ossia
508 @cindex Frenched staves
509 @cindex staff, resizing of
510 @cindex resizing of staves
511
512 @notation{Ossia} staves can be set by creating a new simultaneous
513 staff in the appropriate location:
514
515 @lilypond[verbatim,quote]
516 \new Staff \relative c'' {
517   c4 b d c
518   <<
519     { c4 b d c }
520     \new Staff { e4 d f e }
521   >>
522   c4 b c2
523 }
524 @end lilypond
525
526 However, the above example is usually not the desired result.  To
527 create ossia staves that are above the original staff, have no
528 time signature or clef, and have a smaller font size, tweaks must
529 be used.  The Learning Manual describes a specific technique to
530 achieve this goal, beginning with
531 @rlearning{Nesting music expressions}.
532
533 The following example uses the @code{alignAboveContext} property
534 to align the ossia staff.  This method is most appropriate when
535 only a few ossia staves are needed.
536
537 @lilypond[verbatim,quote]
538 \new Staff = main \relative c'' {
539   c4 b d c
540   <<
541     { c4 b d c }
542
543     \new Staff \with {
544       \remove "Time_signature_engraver"
545       alignAboveContext = #"main"
546       fontSize = #-3
547       \override StaffSymbol #'staff-space = #(magstep -3)
548       \override StaffSymbol #'thickness = #(magstep -3)
549       firstClef = ##f
550     }
551     { e4 d f e }
552   >>
553   c4 b c2
554 }
555 @end lilypond
556
557 If many isolated ossia staves are needed, creating an empty
558 @code{Staff} context with a specific @emph{context id} may be more
559 appropriate; the ossia staves may then be created by
560 @emph{calling} this context and using @code{\startStaff} and
561 @code{\stopStaff} at the desired locations.  The benefits of this
562 method are more apparent if the piece is longer than the following
563 example.
564
565 @lilypond[verbatim,quote,ragged-right]
566 <<
567   \new Staff = ossia \with {
568     \remove "Time_signature_engraver"
569     \remove "Clef_engraver"
570     fontSize = #-3
571     \override StaffSymbol #'staff-space = #(magstep -3)
572     \override StaffSymbol #'thickness = #(magstep -3)
573   }
574   { \stopStaff s1*6 }
575
576   \new Staff \relative c' {
577     c4 b c2
578     <<
579       { e4 f e2 }
580       \context Staff = ossia {
581         \startStaff e4 g8 f e2 \stopStaff
582       }
583     >>
584     g4 a g2 \break
585     c4 b c2
586     <<
587       { g4 a g2 }
588       \context Staff = ossia {
589         \startStaff g4 e8 f g2 \stopStaff
590       }
591     >>
592     e4 d c2
593   }
594 >>
595 @end lilypond
596
597 @c The following is the legacy "ossia.ly" example
598 @c
599 @c I don't think this method is very efficient.
600 @c I'm commenting it out for now.  -pm
601
602 @ignore
603
604 @ lilypond[verbatim,quote]
605 <<
606   \new Staff \with
607   {
608     %No time signature in the ossia staff
609     \remove "Time_signature_engraver"
610     fontSize = #-3
611     \override StaffSymbol #'staff-space = #(magstep -3)
612     \override StaffSymbol #'thickness = #(magstep -3)
613     firstClef = ##f
614   }
615   \relative c'' {
616     \stopStaff
617     \skip 2
618
619     \startStaff
620     \clef treble
621     bes8[^"ossia" g bes g]
622     \stopStaff
623
624     s2
625
626     \startStaff
627     f8 d g4
628   }
629   \new Staff \relative c'' {
630     \time 2/4
631     c4 c g' g a a g2
632   }
633 >>
634 @ end lilypond
635
636 @end ignore
637
638 Using the @code{\RemoveEmptyStaffContext} command to create ossia
639 staves may be used as an alternative.  This method is most
640 convenient when ossia staves occur immediately following a line
641 break.  In this case, spacer rests do not need to be used at all;
642 only @code{\startStaff} and @code{\stopStaff} are necessary.  For
643 more information about @code{\RemoveEmptyStaffContext}, see
644 @ref{Hiding staves}.
645
646 @lilypond[verbatim,quote,ragged-right]
647 <<
648   \new Staff = ossia \with {
649     \remove "Time_signature_engraver"
650     \remove "Clef_engraver"
651     fontSize = #-3
652     \override StaffSymbol #'staff-space = #(magstep -3)
653     \override StaffSymbol #'thickness = #(magstep -3)
654   }
655   \new Staff \relative c' {
656     c4 b c2
657     e4 f e2
658     g4 a g2 \break
659     <<
660       { c4 b c2 }
661       \context Staff = ossia {
662         c4 e8 d c2 \stopStaff
663       }
664     >>
665     g4 a g2
666     e4 d c2
667   }
668 >>
669
670 \layout {
671   \context {
672     \RemoveEmptyStaffContext
673     \override VerticalAxisGroup #'remove-first = ##t
674   }
675 }
676 @end lilypond
677
678
679 @snippets
680
681 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
682 {vertically-aligning-ossias-and-lyrics.ly}
683
684
685 @seealso
686
687 Music Glossary:
688 @rglos{ossia},
689 @rglos{staff},
690 @rglos{Frenched staff}.
691
692 Learning Manual:
693 @rlearning{Nesting music expressions},
694 @rlearning{Size of objects},
695 @rlearning{Length and thickness of objects}.
696
697 Notation Reference:
698 @ref{Setting the staff size}.
699
700 Snippets:
701 @rlsr{Staff notation}.
702
703 Internals Reference:
704 @rinternals{StaffSymbol}.
705
706
707 @node Hiding staves
708 @unnumberedsubsubsec Hiding staves
709
710 @cindex Frenched scores
711 @cindex staff, hiding
712 @cindex staff, empty
713 @cindex hiding of staves
714 @cindex empty staves
715 @cindex Frenched staves
716
717 In orchestral scores, staff lines that only have rests are usually
718 removed in order to save some space.  This style is called
719 @q{French Score}.  For the @code{Lyrics}, @code{ChordNames}, and
720 @code{FiguredBass} contexts, this is switched on by default.
721
722 For other staff contexts, this behavior is set with the
723 @code{\RemoveEmptyStaffContext} command.  It is set in the
724 @code{\layout} block.  As a result, empty staves or staves
725 containing multi-measure rests are removed after a line break.
726
727 @lilypond[verbatim,quote,ragged-right]
728 \layout {
729   \context {
730     \RemoveEmptyStaffContext
731   }
732 }
733 \relative c'' {
734   <<
735     \new Staff { e4 f g a \break c1 }
736     \new Staff { c4 d e f \break R1 }
737   >>
738 }
739 @end lilypond
740
741 To remove other types of contexts, use
742 @code{\AncientRemoveEmptyStaffContext} or
743 @code{\RemoveEmptyRhythmicStaffContext}.
744
745 @cindex ossia
746
747 Another application of @code{\RemoveEmptyStaffContext} is to make
748 ossia sections, i.e., alternative melodies on a separate piece of
749 staff, with help of a Frenched staff.  For details, see
750 @ref{Ossia staves}.
751
752 Staff lines can be made invisible by removing the
753 @code{Staff_symbol_engraver} from the @code{Staff} context:
754
755 @lilypond[verbatim,quote]
756 \new Staff \with {
757   \remove "Staff_symbol_engraver"
758 }
759 \relative c'' { c8 c c16 c c c c2 }
760 @end lilypond
761
762
763 @snippets
764
765 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
766 {removing-the-first-empty-line.ly}
767
768
769 @predefined
770
771 @funindex \RemoveEmptyStaffContext
772 @code{\RemoveEmptyStaffContext},
773 @funindex \AncientRemoveEmptyStaffContext
774 @code{\AncientRemoveEmptyStaffContext},
775 @funindex \RemoveEmptyRhythmicStaffContext
776 @code{\RemoveEmptyRhythmicStaffContext}.
777
778
779 @seealso
780
781 Notation Reference:
782 @ref{Staff symbol},
783 @ref{Ossia staves}.
784
785 Snippets:
786 @rlsr{Staff notation}.
787
788 Internals Reference:
789 @rinternals{ChordNames},
790 @rinternals{FiguredBass},
791 @rinternals{Lyrics},
792 @rinternals{Staff},
793 @rinternals{VerticalAxisGroup}.
794
795
796 @node Writing parts
797 @subsection Writing parts
798
799 This section explains how to insert tempo indications and
800 instrument names into a score.  Methods to quote other voices and
801 format cue notes are also described.
802
803 @menu
804 * Metronome marks::
805 * Instrument names::
806 * Quoting other voices::
807 * Formatting cue notes::
808 @end menu
809
810
811 @node Metronome marks
812 @unnumberedsubsubsec Metronome marks
813
814 @cindex tempo
815 @cindex beats per minute
816 @cindex metronome marking
817 @cindex metronome marking with text
818 @funindex \tempo
819
820 Basic metronome markings can be entered as follows:
821
822 @lilypond[verbatim,quote,relative=2]
823 \tempo 2 = 120
824 c1
825 @end lilypond
826
827 Textual tempo indications can be used instead:
828
829 @lilypond[verbatim,quote,relative=2]
830 \tempo "Allegretto"
831 d2 c
832 @end lilypond
833
834 The combination of a metronome marking and textual description
835 will automatically place the metronome marking within parentheses:
836
837 @lilypond[verbatim,quote,relative=2]
838 \tempo "Allegro" 4 = 160
839 g4 c d e
840 @end lilypond
841
842 To write a metronome marking in parentheses without the text,
843 include an empty string in the input:
844
845 @lilypond[verbatim,quote,relative=2]
846 \tempo "" 8 = 96
847 d4 g e c
848 @end lilypond
849
850
851 @snippets
852
853 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
854 {printing-metronome-and-rehearsal-marks-below-the-staff.ly}
855
856 @c perhaps also an example of how to move it horizontally?
857
858 @c TODO add snippet to LSR -pm
859 To change the tempo in the MIDI output without printing anything,
860 make the metronome marking invisible
861
862 @example
863 \once \override Score.MetronomeMark #'transparent = ##t
864 @end example
865
866 @c TODO add snippet to LSR -pm
867 To print other metronome markings, use these markup commands
868
869 @lilypond[verbatim,quote,relative=1]
870 c4^\markup {
871   (
872   \smaller \general-align #Y #DOWN \note #"16." #1
873   =
874   \smaller \general-align #Y #DOWN \note #"8" #1
875   ) }
876 @end lilypond
877
878 For more details, see @ref{Formatting text}.
879
880
881 @seealso
882
883 Music Glossary:
884 @rglos{metronome},
885 @rglos{metronomic indication},
886 @rglos{tempo indication},
887 @rglos{metronome mark}.
888
889 Notation Reference:
890 @ref{Formatting text},
891 @ref{MIDI output}.
892
893 Snippets:
894 @rlsr{Staff notation}.
895
896 Internals Reference:
897 @rinternals{MetronomeMark}.
898
899
900 @node Instrument names
901 @unnumberedsubsubsec Instrument names
902
903 @cindex instrument names
904 @cindex instrument names, short
905
906 Instrument names can be printed on the left side of staves for the
907 @code{Staff} and @code{PianoStaff} contexts.  The value of
908 @code{instrumentName} is used for the first staff, and the value
909 of @code{shortInstrumentName} is used for all succeeding staves.
910
911 @lilypond[verbatim,quote,ragged-right,relative=1]
912 \set Staff.instrumentName = "Violin "
913 \set Staff.shortInstrumentName = "Vln "
914 c1
915 \break
916 c''1
917 @end lilypond
918
919 Markup mode can be used to create more complicated instrument
920 names:
921
922 @lilypond[verbatim,quote,relative=2]
923 \set Staff.instrumentName = \markup {
924   \column { "Clarinetti"
925             \line { "in B" \smaller \flat } } }
926 c1
927 @end lilypond
928
929 @cindex instrument names, centering
930
931 When two or more staff contexts are grouped together, the
932 instrument names and short instrument names are centered by
933 default.  To center multi-line instrument names,
934 @code{\center-column} must be used:
935
936 @lilypond[verbatim,quote,relative=2]
937 <<
938   \new Staff {
939     \set Staff.instrumentName = \markup \center-column {
940       Clarinetti
941       \line { "in B" \smaller \flat }
942     }
943     c1
944   }
945   \new Staff {
946     \set Staff.instrumentName = "Vibraphone"
947     c1
948   }
949 >>
950 @end lilypond
951
952 @cindex indent
953 @cindex short-indent
954
955 The @code{indent} and @code{short-indent} settings specify the
956 level of indentation for the first system and all succeeding
957 systems, respectively.  They can be modified in the @code{\layout}
958 block.  For longer instrument names or short instrument names, it
959 may be useful to increase the @code{indent} and
960 @code{short-indent} settings:
961
962 @lilypond[verbatim,quote]
963 \relative c' <<
964   \new Staff \with {
965     instrumentName = "Oboe"
966   }
967   { c2 d }
968   \new Staff \with {
969     instrumentName = "Glockenspiel"
970   }
971   { c'2 d }
972 >>
973
974 \layout {
975   indent = 2.5\cm
976 }
977 @end lilypond
978
979 To add instrument names to other contexts (such as
980 @code{GrandStaff}, @code{ChoirStaff}, or @code{StaffGroup}),
981 @code{Instrument_name_engraver} must be added to that context.
982 For details, see @ref{Modifying context plug-ins}.
983
984 @cindex instrument names, changing
985
986 Instrument names may be changed in the middle of a piece:
987
988 @lilypond[verbatim,quote,ragged-right,relative=1]
989 \set Staff.instrumentName = "First"
990 \set Staff.shortInstrumentName = "one"
991 c1 c c c \break
992 c1 c c c \break
993 \set Staff.instrumentName = "Second"
994 \set Staff.shortInstrumentName = "two"
995 c1 c c c \break
996 c1 c c c \break
997 @end lilypond
998
999
1000 @snippets
1001
1002 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1003 {aligning-and-centering-instrument-names.ly}
1004
1005
1006 @seealso
1007
1008 Notation Reference:
1009 @ref{Modifying context plug-ins}.
1010
1011 Snippets:
1012 @rlsr{Staff notation}.
1013
1014 Internals Reference:
1015 @rinternals{InstrumentName},
1016 @rinternals{PianoStaff},
1017 @rinternals{Staff}.
1018
1019
1020 @node Quoting other voices
1021 @unnumberedsubsubsec Quoting other voices
1022
1023 @cindex cues
1024 @cindex quoting other voices
1025 @cindex fragments
1026 @cindex cue notes
1027
1028 Quotations allow fragments of other parts to be inserted directly
1029 into a music expression.  Before a part can be quoted, the
1030 @code{\addQuote} command must be used to initialize the quoted
1031 fragment.  This command must be used in the toplevel scope.  The
1032 first argument is an identifying string, and the second is a music
1033 expression:
1034
1035 @example
1036 flute = \relative c' @{
1037   f4 fis g gis
1038 @}
1039 \addQuote "flute" @{ \flute @}
1040 @end example
1041
1042 The @code{\quoteDuring} command may then be used to indicate when
1043 the quotation should take place.  The corresponding measures from
1044 the quotation are inserted into the music expression.  The syntax
1045 is similar to @code{\addQuote}:
1046
1047 @lilypond[verbatim,quote]
1048 flute = \relative c' {
1049   f4 fis g gis
1050 }
1051 \addQuote "flute" { \flute }
1052
1053 \relative c' {
1054   c4 cis \quoteDuring #"flute" { s2 }
1055 }
1056 @end lilypond
1057
1058 If the music expression used for @code{\quoteDuring} contains
1059 anything but a spacer rest or multi-measure rest, a polyphonic
1060 situation is created, which is often not desirable:
1061
1062 @lilypond[verbatim,quote]
1063 flute = \relative c' {
1064   f4 fis g gis
1065 }
1066 \addQuote "flute" { \flute }
1067
1068 \relative c' {
1069   c4 cis \quoteDuring #"flute" { c4 b }
1070 }
1071 @end lilypond
1072
1073 Quotations recognize instrument transposition settings for both
1074 the source and target instruments if they are specified using the
1075 @code{\transposition} command:
1076
1077 @lilypond[verbatim,quote]
1078 clarinet = \relative c' {
1079   \transposition bes
1080   f4 fis g gis
1081 }
1082 \addQuote "clarinet" { \clarinet }
1083
1084 \relative c' {
1085   c4 cis \quoteDuring #"clarinet" { s2 }
1086 }
1087 @end lilypond
1088
1089 @c add to snippets, possibly.  It might already be there.  -pm
1090 @c
1091 @c The type of events that are present in the quoted music can be
1092 @c trimmed with the @code{quotedEventTypes} property.  The default
1093 @c value is @code{(note-event rest-event)}, which means that only
1094 @c notes and rests of the quoted voice end up in the
1095 @c @code{\quoteDuring}.  Setting
1096 @c
1097 @c @example
1098 @c \set Staff.quotedEventTypes =
1099 @c        #'(note-event articulation-event dynamic-event)
1100 @c @end example
1101 @c
1102 @c @noindent
1103 @c will quote notes (but no rests), together with scripts and
1104 @c dynamics.
1105
1106
1107 @snippets
1108
1109 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1110 {quoting-another-voice-with-transposition.ly}
1111
1112 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1113 {quoting-another-voice.ly}
1114
1115
1116 @seealso
1117
1118 Notation Reference:
1119 @ref{Instrument transpositions}.
1120
1121 Snippets:
1122 @rlsr{Staff notation}.
1123
1124 Internals Reference:
1125 @rinternals{QuoteMusic},
1126 @rinternals{Voice}.
1127
1128
1129 @knownissues
1130
1131 Only the contents of the first @code{Voice} occurring in an
1132 @code{\addQuote} command will be considered for quotation, so
1133 @var{music} cannot contain @code{\new} and @code{\context Voice}
1134 statements that would switch to a different Voice.
1135
1136 Quoting grace notes is broken and can even cause LilyPond to
1137 crash.
1138
1139 Quoting nested triplets may result in poor notation.
1140
1141 In earlier versions of LilyPond (pre 2.11), @code{addQuote} was
1142 written entirely in lower-case letters: @code{\addquote}.
1143
1144
1145 @node Formatting cue notes
1146 @unnumberedsubsubsec Formatting cue notes
1147
1148 @cindex cues
1149 @cindex cue notes
1150 @cindex cue notes, formatting
1151 @cindex fragments
1152 @cindex quoting other voices
1153 @cindex cues, formatting
1154
1155 The previous section explains how to quote other voices.  The
1156 @code{\cueDuring} command is a more specialized form of
1157 @code{\quoteDuring}, being particularly useful for inserting cue
1158 notes into a part.  The syntax is as follows:
1159
1160 @example
1161   \cueDuring #@var{partname} #@var{voice} @var{music}
1162 @end example
1163
1164 This command copies the corresponding measures from @var{partname}
1165 into a @code{CueVoice} context.  The @code{CueVoice} is created
1166 implicitly, and occurs simultaneously with @var{music}, which
1167 creates a polyphonic situation.  The @var{voice} argument
1168 determines whether the cue notes should be notated as a first or
1169 second voice; @code{DOWN} corresponds to the first voice, and
1170 @code{UP} corresponds to the second.
1171
1172 @lilypond[verbatim,quote]
1173 oboe = \relative c'' {
1174   r2 r8 d16 f e g f a
1175   g8 g16 g g2.
1176 }
1177 \addQuote "oboe" { \oboe }
1178
1179 \new Voice \relative c'' {
1180   \cueDuring #"oboe" #UP { R1 }
1181   g2 c,
1182 }
1183 @end lilypond
1184
1185 In the above example, the @code{Voice} context had to be
1186 explicitly declared, or else the entire music expression would
1187 belong to the @code{CueVoice} context.
1188
1189 @c TODO document \killCues
1190 @c TODO document instrumentCueName context property
1191
1192 When typesetting cue notes, some guidelines should be followed:
1193
1194 @itemize
1195 @item
1196 The instrument playing the cue should be clearly marked on the
1197 score.
1198
1199 @item
1200 When the cue notes end, the name of the original instrument should
1201 be indicated.
1202
1203 @item
1204 Any other changes introduced by the cued part should also be
1205 undone.  For example, if the cued instrument plays in a different
1206 clef, the original clef should be stated once again.
1207
1208 @end itemize
1209
1210 The @code{\transposedCueDuring} command is useful to add cues for
1211 instruments in a completely different register.  Having piccolo
1212 cues within a contrabassoon part is a good example.
1213
1214 @lilypond[verbatim,quote]
1215 piccolo = \relative c''' {
1216   \clef "treble^8"
1217   R1
1218   c8 c c e g2
1219   a4 g g2
1220 }
1221 \addQuote "piccolo" { \piccolo }
1222
1223 cbassoon = \relative c, {
1224   \clef "bass_8"
1225   c4 r g r
1226   \transposedCueDuring #"piccolo" #UP c,, { R1 }
1227   c4 r g r
1228 }
1229
1230 <<
1231   \new Staff = "piccolo" \piccolo
1232   \new Staff = "cbassoon" \cbassoon
1233 >>
1234 @end lilypond
1235
1236
1237 @seealso
1238
1239 Snippets:
1240 @rlsr{Staff notation}.
1241
1242 Internals Reference:
1243 @rinternals{Voice}.
1244
1245
1246 @knownissues
1247
1248 Collisions are not checked between @code{Voice} and
1249 @code{CueVoice} contexts.