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