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