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