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