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