]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/staff.itely
Doc: Update for staff.itely
[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 shows the different possibilities 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 Staves can be started or stopped at any point in the score.  The
105 commands @code{\startStaff} and @code{\stopStaff} are used for
106 this purpose.  For details, see @ref{Staff symbol}.
107
108
109 @seealso
110
111 Music Glossary:
112 @rglos{staff},
113 @rglos{staves}.
114
115 Notation Reference:
116 @ref{Creating contexts},
117 @ref{Percussion staves},
118 @ref{Showing melody rhythms},
119 @ref{Default tablatures},
120 @ref{Pre-defined contexts},
121 @ref{Staff symbol},
122 @ref{Gregorian chant contexts},
123 @ref{Mensural 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
221 @snippets
222
223 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
224 {use-square-bracket-at-the-start-of-a-staff-group.ly}
225
226 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
227 {display-bracket-with-only-one-staff-in-a-system.ly}
228
229 @cindex mensurstriche layout
230 @cindex renaissance music
231 @cindex transcription of mensural music
232 @cindex mensural music, transcription of
233
234 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
235 {mensurstriche-layout-bar-lines-between-the-staves.ly}
236 @c FIXME: move to NR 2.8.x when sectioning is ready
237
238
239 @seealso
240
241 Music Glossary:
242 @rglos{brace},
243 @rglos{bracket},
244 @rglos{grand staff}.
245
246 Notation Reference:
247 @ref{Instrument names}.
248
249 Snippets:
250 @rlsr{Staff notation}.
251
252 Internals Reference:
253 @rinternals{Staff},
254 @rinternals{StaffGroup},
255 @rinternals{ChoirStaff},
256 @rinternals{GrandStaff},
257 @rinternals{PianoStaff},
258 @rinternals{SystemStartBar},
259 @rinternals{SystemStartBrace},
260 @rinternals{SystemStartBracket},
261 @rinternals{SystemStartSquare}.
262
263
264 @node Deeper nested staff groups
265 @unnumberedsubsubsec Deeper nested staff groups
266
267 @cindex staff, nested
268 @cindex staves, nested
269 @cindex nesting of staves
270 @cindex system start delimiters, nested
271 @cindex nested staff brackets
272 @cindex brackets, nesting of
273 @cindex braces, nesting of
274 @cindex inner staff group
275 @cindex inner choir staff group
276
277 Two additional staff-group contexts are available that can be
278 nested within a @code{StaffGroup} or @code{ChoirStaff} context:
279 @code{InnerStaffGroup} and @code{InnerChoirStaff}.  These contexts
280 create a bracket next to the original bracket of their parent
281 staff group.
282
283 An @code{InnerStaffGroup} is treated similarly to a
284 @code{StaffGroup}; bar lines are connected between each stave
285 within the context:
286
287 @lilypond[verbatim,quote,relative=2]
288 \new StaffGroup <<
289   \new Staff { c2 c | c2 c }
290   \new InnerStaffGroup <<
291     \new Staff { g2 g | g2 g }
292     \new Staff { e2 e | e2 e }
293   >>
294 >>
295 @end lilypond
296
297 Bar lines are @emph{not} connected between staves of an
298 @code{InnerChoirStaff}, just like a @code{ChoirStaff}:
299
300 @lilypond[verbatim,quote,relative=2]
301 \new ChoirStaff <<
302   \new Staff { c2 c | c2 c }
303   \new InnerChoirStaff <<
304     \new Staff { g2 g | g2 g }
305     \new Staff { e2 e | e2 e }
306   >>
307   \new Staff { c1 | c1 }
308 >>
309 @end lilypond
310
311
312 @snippets
313
314 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
315 {nesting-staves.ly}
316
317
318 @seealso
319
320 Notation Reference:
321 @ref{Grouping staves},
322 @ref{Instrument names}.
323
324 Snippets:
325 @rlsr{Staff notation}.
326
327 Internals Reference:
328 @rinternals{InnerStaffGroup},
329 @rinternals{StaffGroup},
330 @rinternals{InnerChoirStaff},
331 @rinternals{ChoirStaff},
332 @rinternals{SystemStartBar},
333 @rinternals{SystemStartBrace},
334 @rinternals{SystemStartBracket},
335 @rinternals{SystemStartSquare}.
336
337
338 @node Modifying single staves
339 @subsection Modifying single staves
340
341 This section explains how to change specific attributes of one
342 staff: for example, modifying the number of staff lines or the
343 staff size.  Methods to start and stop staves and set ossia
344 sections are also described.
345
346 @menu
347 * Staff symbol::
348 * Ossia staves::
349 * Hiding staves::
350 @end menu
351
352
353 @node Staff symbol
354 @unnumberedsubsubsec Staff symbol
355
356 @cindex adjusting staff symbol
357 @cindex drawing staff symbol
358 @cindex staff symbol, setting of
359 @cindex stop staff lines
360 @cindex start staff lines
361 @cindex staff lines, amount of
362 @cindex staff lines, number of
363 @cindex staff line, thickness of
364 @cindex amount of staff lines
365 @cindex thickness of staff lines
366 @cindex ledger lines, setting
367 @cindex setting of ledger lines
368 @cindex spacing of ledger lines
369 @cindex number of staff lines
370
371 The lines of a staff belong to the @code{StaffSymbol} grob.
372 @code{StaffSymbol} properties can be modified to change the
373 appearance of a staff, but they must be modified before the staff
374 is created.
375
376 The number of staff lines may be changed.  The clef position and
377 the position of middle C may need to be modified to fit the new
378 staff.  For an explanation, refer to the snippet section in
379 @ref{Clef}.
380
381 @lilypond[verbatim,quote,relative=2]
382 \new Staff {
383   \override Staff.StaffSymbol #'line-count = #3
384   d4 d d d
385 }
386 @end lilypond
387
388 The vertical position of staff lines and the number of staff lines
389 can be defined at the same time.  As the following example shows,
390 note positions are not influenced by the position of the staff
391 lines.
392
393 @warning{The @code{'line-positions} property overrides the
394 @code{'line-count} property.  The number of staff lines is
395 implicitly defined by the number of elements in the list of values
396 for @code{'line-positions}}
397
398 @lilypond[verbatim,quote,relative=1]
399 \new Staff \with {
400   \override StaffSymbol #'line-positions = #'(7 3 0 -4 -6 -7)
401 }
402 { a4 e' f b | d1 }
403 @end lilypond
404
405 Staff line thickness can be modified.  The thickness of ledger
406 lines and stems are also affected, since they depend on staff line
407 thickness.
408
409 @lilypond[verbatim,quote,relative=1]
410 \new Staff \with {
411   \override StaffSymbol #'thickness = #3
412 }
413 { e4 d c b }
414 @end lilypond
415
416 The thickness of ledger lines can be set independently of staff
417 line thickness.
418
419 @lilypond[verbatim,quote,relative=1]
420 \new Staff \with {
421   \override StaffSymbol #'ledger-line-thickness = #'(1 . 0.2)
422 }
423 { e4 d c b }
424 @end lilypond
425
426 The distance between staff lines can be changed.  The setting has
427 influence on ledger lines as well.
428
429 @lilypond[verbatim,quote,relative=1]
430 \new Staff \with {
431   \override StaffSymbol #'staff-space = #1.5
432 }
433 { a4 b c d }
434 @end lilypond
435
436 The width of a staff can be adjusted.  The unit is one staff
437 space.  The spacing of objects inside the staff is not influenced
438 by this setting.
439
440 @lilypond[verbatim,quote,relative=1]
441 \new Staff \with {
442   \override StaffSymbol #'width = #23
443 }
444 { a4 e' f b | d1 }
445 @end lilypond
446
447 Further details about the properties of @code{StaffSymbol} listed
448 above can be found here: @rinternals{staff-symbol-interface}.
449
450 Modifications to staff properties in the middle of a score can be
451 placed between @code{\stopStaff} and @code{\startStaff}:
452
453 @lilypond[verbatim,quote,relative=2]
454 c2 c
455 \stopStaff
456 \override Staff.StaffSymbol #'line-count = #2
457 \startStaff
458 b2 b
459 \stopStaff
460 \revert Staff.StaffSymbol #'line-count
461 \startStaff
462 a2 a
463 @end lilypond
464
465
466 @predefined
467
468 @funindex \startStaff
469 @code{\startStaff},
470 @funindex \stopStaff
471 @code{\stopStaff}.
472
473
474 @snippets
475
476 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
477 {making-some-staff-lines-thicker-than-the-others.ly}
478
479
480 @seealso
481
482 Music Glossary:
483 @rglos{line},
484 @rglos{ledger line},
485 @rglos{staff}.
486
487 Notation Reference:
488 @ref{Displaying pitches}.
489
490 Snippets:
491 @rlsr{Staff notation}.
492
493 Internals Reference:
494 @rinternals{StaffSymbol},
495 @rinternals{staff-symbol-interface}.
496
497
498 @knownissues
499
500 When setting staff lines manually, bar lines are always drawn
501 centered on the position 0, so the maximum distance of the bar
502 lines in either direction must be equal.
503
504
505 @node Ossia staves
506 @unnumberedsubsubsec Ossia staves
507
508 @cindex staff, Frenched
509 @cindex ossia
510 @cindex Frenched staves
511 @cindex staff, resizing of
512 @cindex resizing of staves
513
514 @notation{Ossia} staves can be set by creating a new simultaneous
515 staff in the appropriate location:
516
517 @lilypond[verbatim,quote]
518 \new Staff \relative c'' {
519   c4 b d c
520   <<
521     { c4 b d c }
522     \new Staff { e4 d f e }
523   >>
524   c4 b c2
525 }
526 @end lilypond
527
528 However, the above example is usually not the desired result.  To
529 create ossia staves that are above the original staff, have no
530 time signature or clef, and have a smaller font size, tweaks must
531 be used.  The Learning Manual describes a specific technique to
532 achieve this goal, beginning with
533 @rlearning{Nesting music expressions}.
534
535 The following example uses the @code{alignAboveContext} property
536 to align the ossia staff.  This method is most appropriate when
537 only a few ossia staves are needed.
538
539 @lilypond[verbatim,quote]
540 \new Staff = main \relative c'' {
541   c4 b d c
542   <<
543     { c4 b d c }
544
545     \new Staff \with {
546       \remove "Time_signature_engraver"
547       alignAboveContext = #"main"
548       fontSize = #-3
549       \override StaffSymbol #'staff-space = #(magstep -3)
550       \override StaffSymbol #'thickness = #(magstep -3)
551       firstClef = ##f
552     }
553     { e4 d f e }
554   >>
555   c4 b c2
556 }
557 @end lilypond
558
559 If many isolated ossia staves are needed, creating an empty
560 @code{Staff} context with a specific @emph{context id} may be more
561 appropriate; the ossia staves may then be created by
562 @emph{calling} this context and using @code{\startStaff} and
563 @code{\stopStaff} at the desired locations.  The benefits of this
564 method are more apparent if the piece is longer than the following
565 example.
566
567 @lilypond[verbatim,quote,ragged-right]
568 <<
569   \new Staff = ossia \with {
570     \remove "Time_signature_engraver"
571     \remove "Clef_engraver"
572     fontSize = #-3
573     \override StaffSymbol #'staff-space = #(magstep -3)
574     \override StaffSymbol #'thickness = #(magstep -3)
575   }
576   { \stopStaff s1*6 }
577
578   \new Staff \relative c' {
579     c4 b c2
580     <<
581       { e4 f e2 }
582       \context Staff = ossia {
583         \startStaff e4 g8 f e2 \stopStaff
584       }
585     >>
586     g4 a g2 \break
587     c4 b c2
588     <<
589       { g4 a g2 }
590       \context Staff = ossia {
591         \startStaff g4 e8 f g2 \stopStaff
592       }
593     >>
594     e4 d c2
595   }
596 >>
597 @end lilypond
598
599 @c The following is the legacy "ossia.ly" example
600 @c
601 @c I don't think this method is very efficient.
602 @c I'm commenting it out for now.  -pm
603
604 @ignore
605
606 @ lilypond[verbatim,quote]
607 <<
608   \new Staff \with
609   {
610     %No time signature in the ossia staff
611     \remove "Time_signature_engraver"
612     fontSize = #-3
613     \override StaffSymbol #'staff-space = #(magstep -3)
614     \override StaffSymbol #'thickness = #(magstep -3)
615     firstClef = ##f
616   }
617   \relative c'' {
618     \stopStaff
619     \skip 2
620
621     \startStaff
622     \clef treble
623     bes8[^"ossia" g bes g]
624     \stopStaff
625
626     s2
627
628     \startStaff
629     f8 d g4
630   }
631   \new Staff \relative c'' {
632     \time 2/4
633     c4 c g' g a a g2
634   }
635 >>
636 @ end lilypond
637
638 @end ignore
639
640 Using the @code{\RemoveEmptyStaffContext} command to create ossia
641 staves may be used as an alternative.  This method is most
642 convenient when ossia staves occur immediately following a line
643 break.  In this case, spacer rests do not need to be used at all;
644 only @code{\startStaff} and @code{\stopStaff} are necessary.  For
645 more information about @code{\RemoveEmptyStaffContext}, see
646 @ref{Hiding staves}.
647
648 @lilypond[verbatim,quote,ragged-right]
649 <<
650   \new Staff = ossia \with {
651     \remove "Time_signature_engraver"
652     \remove "Clef_engraver"
653     fontSize = #-3
654     \override StaffSymbol #'staff-space = #(magstep -3)
655     \override StaffSymbol #'thickness = #(magstep -3)
656   }
657   \new Staff \relative c' {
658     c4 b c2
659     e4 f e2
660     g4 a g2 \break
661     <<
662       { c4 b c2 }
663       \context Staff = ossia {
664         c4 e8 d c2 \stopStaff
665       }
666     >>
667     g4 a g2
668     e4 d c2
669   }
670 >>
671
672 \layout {
673   \context {
674     \RemoveEmptyStaffContext
675     \override VerticalAxisGroup #'remove-first = ##t
676   }
677 }
678 @end lilypond
679
680
681 @snippets
682
683 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
684 {vertically-aligning-ossias-and-lyrics.ly}
685
686
687 @seealso
688
689 Music Glossary:
690 @rglos{ossia},
691 @rglos{staff},
692 @rglos{Frenched staff}.
693
694 Learning Manual:
695 @rlearning{Nesting music expressions},
696 @rlearning{Size of objects},
697 @rlearning{Length and thickness of objects}.
698
699 Notation Reference:
700 @ref{Setting the staff size}.
701
702 Snippets:
703 @rlsr{Staff notation}.
704
705 Internals Reference:
706 @rinternals{StaffSymbol}.
707
708
709 @node Hiding staves
710 @unnumberedsubsubsec Hiding staves
711
712 @cindex Frenched scores
713 @cindex staff, hiding
714 @cindex staff, empty
715 @cindex hiding of staves
716 @cindex empty staves
717 @cindex Frenched staves
718
719 In orchestral scores, staff lines that only have rests are usually
720 removed in order to save some space.  This style is called
721 @q{French Score}.  For the @code{Lyrics}, @code{ChordNames}, and
722 @code{FiguredBass} contexts, this is switched on by default.
723
724 For other staff contexts, this behavior is set with the
725 @code{\RemoveEmptyStaffContext} command.  It is set in the
726 @code{\layout} block.  As a result, empty staves or staves
727 containing multi-measure rests are removed after a line break.
728
729 @lilypond[verbatim,quote,ragged-right]
730 \layout {
731   \context {
732     \RemoveEmptyStaffContext
733   }
734 }
735 \relative c'' {
736   <<
737     \new Staff { e4 f g a \break c1 }
738     \new Staff { c4 d e f \break R1 }
739   >>
740 }
741 @end lilypond
742
743 To remove other types of contexts, use
744 @code{\AncientRemoveEmptyStaffContext} or
745 @code{\RemoveEmptyRhythmicStaffContext}.
746
747 @cindex ossia
748
749 Another application of @code{\RemoveEmptyStaffContext} is to make
750 ossia sections, i.e., alternative melodies on a separate piece of
751 staff, with help of a Frenched staff.  For details, see
752 @ref{Ossia staves}.
753
754 Staff lines can be made invisible by removing the
755 @code{Staff_symbol_engraver} from the @code{Staff} context:
756
757 @lilypond[verbatim,quote]
758 \new Staff \with {
759   \remove "Staff_symbol_engraver"
760 }
761 \relative c'' { c8 c c16 c c c c2 }
762 @end lilypond
763
764
765 @snippets
766
767 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
768 {removing-the-first-empty-line.ly}
769
770
771 @predefined
772
773 @funindex \RemoveEmptyStaffContext
774 @code{\RemoveEmptyStaffContext},
775 @funindex \AncientRemoveEmptyStaffContext
776 @code{\AncientRemoveEmptyStaffContext},
777 @funindex \RemoveEmptyRhythmicStaffContext
778 @code{\RemoveEmptyRhythmicStaffContext}.
779
780
781 @seealso
782
783 Notation Reference:
784 @ref{Staff symbol},
785 @ref{Ossia staves}.
786
787 Snippets:
788 @rlsr{Staff notation}.
789
790 Internals Reference:
791 @rinternals{ChordNames},
792 @rinternals{FiguredBass},
793 @rinternals{Lyrics},
794 @rinternals{Staff},
795 @rinternals{VerticalAxisGroup}.
796
797
798 @node Writing parts
799 @subsection Writing parts
800
801 This section explains how to insert tempo indications and
802 instrument names into a score.  Methods to quote other voices and
803 format cue notes are also described.
804
805 @menu
806 * Metronome marks::
807 * Instrument names::
808 * Quoting other voices::
809 * Formatting cue notes::
810 @end menu
811
812
813 @node Metronome marks
814 @unnumberedsubsubsec Metronome marks
815
816 @cindex tempo
817 @cindex beats per minute
818 @cindex metronome marking
819 @cindex metronome marking with text
820 @funindex \tempo
821
822 A basic metronome mark is simple to write:
823
824 @lilypond[verbatim,quote,relative=1]
825 \tempo 4 = 120
826 c2 d
827 e4. d8 c2
828 @end lilypond
829
830 Tempo indications with text can be used instead:
831
832 @lilypond[verbatim,quote,relative=2]
833 \tempo "Allegretto"
834 c4 e d c
835 b4. a16 b c4 r4
836 @end lilypond
837
838 Combining a metronome mark and text will automatically place the
839 metronome mark within parentheses:
840
841 @lilypond[verbatim,quote,relative=2]
842 \tempo "Allegro" 4 = 160
843 g4 c d e
844 d4 b g2
845 @end lilypond
846
847 In general, the text can be any markup object:
848
849 @lilypond[verbatim,quote,relative=2]
850 \tempo \markup { \italic Faster } 4 = 132
851 a8-. r8 b-. r gis-. r a-. r
852 @end lilypond
853
854 A parenthesized metronome mark with no textual indication may be
855 written by including an empty string in the input:
856
857 @lilypond[verbatim,quote,relative=2]
858 \tempo "" 8 = 96
859 d4 g e c
860 @end lilypond
861
862
863 @snippets
864
865 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
866 {printing-metronome-and-rehearsal-marks-below-the-staff.ly}
867
868 @c perhaps also an example of how to move it horizontally?
869
870 @c TODO add snippet to LSR -pm
871 To change the tempo in the MIDI output without printing anything,
872 make the metronome marking invisible
873
874 @example
875 \once \override Score.MetronomeMark #'transparent = ##t
876 @end example
877
878 @c TODO add snippet to LSR -pm
879 To print other metronome markings, use these markup commands
880
881 @lilypond[verbatim,quote,relative=1]
882 c4^\markup {
883   (
884   \smaller \general-align #Y #DOWN \note #"16." #1
885   =
886   \smaller \general-align #Y #DOWN \note #"8" #1
887   ) }
888 @end lilypond
889
890 For more details, see @ref{Formatting text}.
891
892
893 @seealso
894
895 Music Glossary:
896 @rglos{metronome},
897 @rglos{metronomic indication},
898 @rglos{tempo indication},
899 @rglos{metronome mark}.
900
901 Notation Reference:
902 @ref{Formatting text},
903 @ref{MIDI output}.
904
905 Snippets:
906 @rlsr{Staff notation}.
907
908 Internals Reference:
909 @rinternals{MetronomeMark}.
910
911
912 @node Instrument names
913 @unnumberedsubsubsec Instrument names
914
915 @cindex instrument names
916 @cindex instrument names, short
917
918 Instrument names can be printed on the left side of staves for the
919 @code{Staff} and @code{PianoStaff} contexts.  The value of
920 @code{instrumentName} is used for the first staff, and the value
921 of @code{shortInstrumentName} is used for all succeeding staves.
922
923 @lilypond[verbatim,quote,ragged-right,relative=1]
924 \set Staff.instrumentName = "Violin "
925 \set Staff.shortInstrumentName = "Vln "
926 c1
927 \break
928 c''1
929 @end lilypond
930
931 Markup mode can be used to create more complicated instrument
932 names:
933
934 @lilypond[verbatim,quote,relative=2]
935 \set Staff.instrumentName = \markup {
936   \column { "Clarinetti"
937             \line { "in B" \smaller \flat } } }
938 c1
939 @end lilypond
940
941 @cindex instrument names, centering
942
943 When two or more staff contexts are grouped together, the
944 instrument names and short instrument names are centered by
945 default.  To center multi-line instrument names,
946 @code{\center-column} must be used:
947
948 @lilypond[verbatim,quote,relative=2]
949 <<
950   \new Staff {
951     \set Staff.instrumentName = \markup \center-column {
952       Clarinetti
953       \line { "in B" \smaller \flat }
954     }
955     c1
956   }
957   \new Staff {
958     \set Staff.instrumentName = "Vibraphone"
959     c1
960   }
961 >>
962 @end lilypond
963
964 @cindex indent
965 @cindex short-indent
966
967 The @code{indent} and @code{short-indent} settings specify the
968 level of indentation for the first system and all succeeding
969 systems, respectively.  They can be modified in the @code{\layout}
970 block.  For instrument names or short instrument names that are
971 longer, it may be useful to increase the @code{indent} and
972 @code{short-indent} settings:
973
974 @lilypond[verbatim,quote]
975 \relative c' <<
976   \new Staff \with {
977     instrumentName = "Oboe"
978   }
979   { c2 d }
980   \new Staff \with {
981     instrumentName = "Glockenspiel"
982   }
983   { c'2 d }
984 >>
985
986 \layout {
987   indent = 2.5\cm
988 }
989 @end lilypond
990
991 To add instrument names to other contexts (such as
992 @code{GrandStaff}, @code{ChoirStaff}, or @code{StaffGroup}),
993 @code{Instrument_name_engraver} must be added to that context.
994 For details, see @ref{Modifying context plug-ins}.
995
996 @cindex instrument names, changing
997
998 Instrument names may be changed in the middle of a piece:
999
1000 @lilypond[verbatim,quote,ragged-right,relative=1]
1001 \set Staff.instrumentName = "First"
1002 \set Staff.shortInstrumentName = "one"
1003 c1 c c c \break
1004 c1 c c c \break
1005 \set Staff.instrumentName = "Second"
1006 \set Staff.shortInstrumentName = "two"
1007 c1 c c c \break
1008 c1 c c c \break
1009 @end lilypond
1010
1011
1012 @snippets
1013
1014 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1015 {aligning-and-centering-instrument-names.ly}
1016
1017
1018 @seealso
1019
1020 Notation Reference:
1021 @ref{Modifying context plug-ins}.
1022
1023 Snippets:
1024 @rlsr{Staff notation}.
1025
1026 Internals Reference:
1027 @rinternals{InstrumentName},
1028 @rinternals{PianoStaff},
1029 @rinternals{Staff}.
1030
1031
1032 @node Quoting other voices
1033 @unnumberedsubsubsec Quoting other voices
1034
1035 @cindex cues
1036 @cindex quoting other voices
1037 @cindex fragments
1038 @cindex cue notes
1039
1040 Quotations allow fragments of other parts to be inserted directly
1041 into a music expression.  Before a part can be quoted, the
1042 @code{\addQuote} command must be used to initialize the quoted
1043 fragment.  This command must be used in the toplevel scope.  The
1044 first argument is an identifying string, and the second is a music
1045 expression:
1046
1047 @example
1048 flute = \relative c' @{
1049   f4 fis g gis
1050 @}
1051 \addQuote "flute" @{ \flute @}
1052 @end example
1053
1054 The @code{\quoteDuring} command may then be used to indicate when
1055 the quotation should take place.  The corresponding measures from
1056 the quotation are inserted into the music expression.  The syntax
1057 is similar to @code{\addQuote}:
1058
1059 @lilypond[verbatim,quote]
1060 flute = \relative c' {
1061   f4 fis g gis
1062 }
1063 \addQuote "flute" { \flute }
1064
1065 \relative c' {
1066   c4 cis \quoteDuring #"flute" { s2 }
1067 }
1068 @end lilypond
1069
1070 If the music expression used for @code{\quoteDuring} contains
1071 anything but a spacer rest or multi-measure rest, a polyphonic
1072 situation is created, which is often not desirable:
1073
1074 @lilypond[verbatim,quote]
1075 flute = \relative c' {
1076   f4 fis g gis
1077 }
1078 \addQuote "flute" { \flute }
1079
1080 \relative c' {
1081   c4 cis \quoteDuring #"flute" { c4 b }
1082 }
1083 @end lilypond
1084
1085 Quotations recognize instrument transposition settings for both
1086 the source and target instruments if they are specified using the
1087 @code{\transposition} command:
1088
1089 @lilypond[verbatim,quote]
1090 clarinet = \relative c' {
1091   \transposition bes
1092   f4 fis g gis
1093 }
1094 \addQuote "clarinet" { \clarinet }
1095
1096 \relative c' {
1097   c4 cis \quoteDuring #"clarinet" { s2 }
1098 }
1099 @end lilypond
1100
1101 @c add to snippets, possibly.  It might already be there.  -pm
1102 @c
1103 @c The type of events that are present in the quoted music can be
1104 @c trimmed with the @code{quotedEventTypes} property.  The default
1105 @c value is @code{(note-event rest-event)}, which means that only
1106 @c notes and rests of the quoted voice end up in the
1107 @c @code{\quoteDuring}.  Setting
1108 @c
1109 @c @example
1110 @c \set Staff.quotedEventTypes =
1111 @c        #'(note-event articulation-event dynamic-event)
1112 @c @end example
1113 @c
1114 @c @noindent
1115 @c will quote notes (but no rests), together with scripts and
1116 @c dynamics.
1117
1118
1119 @snippets
1120
1121 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1122 {quoting-another-voice-with-transposition.ly}
1123
1124 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1125 {quoting-another-voice.ly}
1126
1127
1128 @seealso
1129
1130 Notation Reference:
1131 @ref{Instrument transpositions}.
1132
1133 Snippets:
1134 @rlsr{Staff notation}.
1135
1136 Internals Reference:
1137 @rinternals{QuoteMusic},
1138 @rinternals{Voice}.
1139
1140
1141 @knownissues
1142
1143 Only the contents of the first @code{Voice} occurring in an
1144 @code{\addQuote} command will be considered for quotation, so
1145 @var{music} cannot contain @code{\new} and @code{\context Voice}
1146 statements that would switch to a different Voice.
1147
1148 Quoting grace notes is broken and can even cause LilyPond to
1149 crash.
1150
1151 Quoting nested triplets may result in poor notation.
1152
1153 In earlier versions of LilyPond (pre 2.11), @code{addQuote} was
1154 written entirely in lower-case letters: @code{\addquote}.
1155
1156
1157 @node Formatting cue notes
1158 @unnumberedsubsubsec Formatting cue notes
1159
1160 @cindex cues
1161 @cindex cue notes
1162 @cindex cue notes, formatting
1163 @cindex fragments
1164 @cindex quoting other voices
1165 @cindex cues, formatting
1166
1167 The previous section explains how to quote other voices.  The
1168 @code{\cueDuring} command is a more specialized form of
1169 @code{\quoteDuring}, being particularly useful for inserting cue
1170 notes into a part.  The syntax is as follows:
1171
1172 @example
1173   \cueDuring #@var{partname} #@var{voice} @var{music}
1174 @end example
1175
1176 This command copies the corresponding measures from @var{partname}
1177 into a @code{CueVoice} context.  The @code{CueVoice} is created
1178 implicitly, and occurs simultaneously with @var{music}, which
1179 creates a polyphonic situation.  The @var{voice} argument
1180 determines whether the cue notes should be notated as a first or
1181 second voice; @code{DOWN} corresponds to the first voice, and
1182 @code{UP} corresponds to the second.
1183
1184 @lilypond[verbatim,quote]
1185 oboe = \relative c'' {
1186   r2 r8 d16 f e g f a
1187   g8 g16 g g2.
1188 }
1189 \addQuote "oboe" { \oboe }
1190
1191 \new Voice \relative c'' {
1192   \cueDuring #"oboe" #UP { R1 }
1193   g2 c,
1194 }
1195 @end lilypond
1196
1197 In the above example, the @code{Voice} context had to be
1198 explicitly declared, or else the entire music expression would
1199 belong to the @code{CueVoice} context.
1200
1201 The name of the cued instrument can be printed by setting the
1202 @code{instrumentCueName} property.
1203
1204 @lilypond[verbatim,quote]
1205 oboe = \relative c''' {
1206   g4 r8 e16 f e4 d
1207 }
1208 \addQuote oboe { \oboe }
1209
1210 \new Staff \relative c'' <<
1211   \new CueVoice \with {
1212     instrumentCueName = "ob."
1213   }
1214   \new Voice {
1215     \cueDuring #"oboe" #UP { R1 }
1216     g4. b8 d2
1217   }
1218 >>
1219 @end lilypond
1220
1221 The @code{\killCues} command is used to remove the cue notes from
1222 a music expression.
1223
1224 @lilypond[verbatim,quote]
1225 flute = \relative c''' {
1226   r2 cis2 r2 dis2
1227 }
1228 \addQuote flute { \flute }
1229
1230 \new Voice \relative c'' {
1231   \killCues {
1232     \cueDuring #"flute" #UP { R1 }
1233     g4. b8 d2
1234   }
1235 }
1236 @end lilypond
1237
1238 When typesetting cue notes, some guidelines should be followed:
1239
1240 @itemize
1241 @item
1242 The instrument playing the cue should be clearly marked on the
1243 score.
1244
1245 @item
1246 When the cue notes end, the name of the original instrument should
1247 be indicated.
1248
1249 @item
1250 Any other changes introduced by the cued part should also be
1251 undone.  For example, if the cued instrument plays in a different
1252 clef, the original clef should be stated once again.
1253
1254 @end itemize
1255
1256 @c FIXME explain syntax of \transposedCueDuring
1257
1258 The @code{\transposedCueDuring} command is useful to add cues for
1259 instruments in a completely different register.  Having piccolo
1260 cues within a contrabassoon part is a good example.
1261
1262 @lilypond[verbatim,quote]
1263 piccolo = \relative c''' {
1264   \clef "treble^8"
1265   R1
1266   c8 c c e g2
1267   a4 g g2
1268 }
1269 \addQuote "piccolo" { \piccolo }
1270
1271 cbassoon = \relative c, {
1272   \clef "bass_8"
1273   c4 r g r
1274   \transposedCueDuring #"piccolo" #UP c,, { R1 }
1275   c4 r g r
1276 }
1277
1278 <<
1279   \new Staff = "piccolo" \piccolo
1280   \new Staff = "cbassoon" \cbassoon
1281 >>
1282 @end lilypond
1283
1284
1285 @seealso
1286
1287 Snippets:
1288 @rlsr{Staff notation}.
1289
1290 Internals Reference:
1291 @rinternals{CueVoice},
1292 @rinternals{Voice}.
1293
1294
1295 @knownissues
1296
1297 Collisions are not checked between @code{Voice} and
1298 @code{CueVoice} contexts.