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