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