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