]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/staff.itely
684ab35825981ec5a5f8e2fd96fd02bc0e83ca82
[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.38"
10
11 @node Staff notation
12 @section Staff notation
13
14 @lilypondfile[quote]{staff-headword.ly}
15
16
17 This section explains how to influence the staff appearance, 
18 print scores with more than one staff, and 
19 how to apply specific performance marks to single staves.
20
21 @menu
22 * Displaying staves::           
23 * Modifying single staves::     
24 * Writing parts::               
25 @end menu
26
27
28 @node Displaying staves
29 @subsection Displaying staves
30
31 This section shows the different possibilities to create and group
32 staves into groups, which can be marked in the beginning of each
33 line with either a bracket or a brace.
34
35 @menu
36 * Instantiating new staves::
37 * Grouping staves:: 
38 * Deeper nested staff groups::  
39 @end menu
40
41 @node Instantiating new staves
42 @subsubsection 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 The lines of a staff (pl. staves) are produced by the @code{staff symbol} 
57 layout object.  Staves are created with the @code{\new} or
58 @code{\context} commands.  For an explanation on these commands,
59 see @ref{Creating contexts}.
60
61 There are different predefined staff contexts available in LilyPond:
62
63 @itemize
64 @item
65 The default is @code{Staff}:
66 @lilypond[verbatim,ragged-right,quote]
67 \relative c'' {
68   \new Staff { c d e f }
69 }
70 @end lilypond
71
72 @item
73 @code{DrumStaff} creates a five line staff set up for a typical drum set.
74 It uses different names for each instrument.  The instrument names have to
75 be set using the @code{drummode}.  See @ref{Percussion staves}.
76 @lilypond[verbatim,ragged-right,quote]
77 \new DrumStaff { 
78   \drummode { cymc hh ss tomh }
79 }
80 @end lilypond
81
82 @item
83 @code{GregorianTranscriptionStaff} sets up a staff to notate modern
84 Gregorian chant.  It does not show bar lines.
85 @lilypond[verbatim,ragged-right,quote]
86 \relative c'' {
87   \new GregorianTranscriptionStaff { c d e f }
88 }
89 @end lilypond
90
91 @item
92 @code{RhythmicStaff} can be used to show the rhythm of some music.  The
93 notes are printed on one line regardless of their pitch, but the duration
94 is preserved.  See @ref{Showing melody rhythms}.
95 @lilypond[verbatim,ragged-right,quote]
96 \relative c'' {
97   \new RhythmicStaff { c d e f }
98 }
99 @end lilypond
100
101 @item
102 @code{TabStaff} creates by default a tablature with six strings in 
103 standard guitar tuning.  See @ref{Tablatures basic}.
104 @lilypond[verbatim,ragged-right,quote]
105 \relative c'' {
106   \new TabStaff { c d e f }
107 }
108 @end lilypond
109
110 @end itemize
111
112 @noindent
113 Besides these staves there are two staff contexts specific for the notation
114 of ancient music: @code{MensuralStaff} and @code{VaticanaStaff}.  They are
115 described in @ref{Pre-defined contexts}.
116
117 Once a staff is instantiated it can be started or stopped at every point
118 in the score.  This is done with the commands @code{\startStaff} and 
119 @code{\stopStaff}.  How to use it is explained in @ref{Staff symbol}.
120
121
122 @seealso
123
124 Music Glossary: @rglos{staff}, @rglos{staves}.
125
126 Notation Reference: @ref{Percussion staves}, 
127 @ref{Tablatures basic}, @ref{Gregorian Chant contexts}, and
128 @ref{Mensural contexts}.
129
130 Snippets: @lsrdir{Staff,Staff-notation}.
131
132 Internals Reference: @internalsref{Staff}, @internalsref{DrumStaff},
133 @internalsref{GregorianTranscriptionStaff}, @internalsref{RhythmicStaff},
134 @internalsref{TabStaff}, @internalsref{MensuralStaff},
135 @internalsref{VaticanaStaff}.
136
137
138
139 @node Grouping staves
140 @subsubsection 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 grand staff
149 @cindex piano staff
150 @cindex staff group
151 @cindex staff, choir
152 @cindex choir staff
153 @cindex system
154
155 LilyPond provides different types of contexts to group single staves 
156 together.  These contexts influence in the first place the appearance
157 of the system start delimiter, but they have also influence on the
158 behavior of the bar lines.
159
160 Each staff group context sets the property
161 @code{systemStartDelimiter} to one of the values
162 @code{SystemStartBar}, @code{SystemStartBrace},
163 and @code{SystemStartBracket}.  A fourth delimiter,
164 @code{systemStartSquare}, is also available, but must be
165 instantiated manually.  The usage of this last delimiter is shown further
166 down in the snippet section.
167
168
169 @itemize
170 @item
171 If no context is specified, the default properties for the score
172 will be used: the group is started with a vertical line, and the
173 bar lines are not connected.  The name of the beginning bar line 
174 grob is @code{SystemStartBar}.  
175
176 @lilypond[verbatim,ragged-right,quote]
177 \relative c'' <<
178   \new Staff { c1 c }
179   \new Staff { c c }
180 >>
181 @end lilypond
182
183 @item
184 In a @code{StaffGroup}, the bar lines will be drawn through
185 all the staves, and the group is started with a bracket.
186
187 @lilypond[verbatim,ragged-right,quote]
188 \new StaffGroup {
189   \relative c'' <<
190     \new Staff { c1 c }
191     \new Staff { c c }
192   >>
193 }
194 @end lilypond
195
196 @item
197 In a @code{ChoirStaff}, the group is 
198 started with a bracket, but bar lines are not connected. 
199
200 @lilypond[verbatim,ragged-right,quote]
201 \new ChoirStaff {
202   \relative c'' <<
203     \new Staff { c1 c }
204     \new Staff { c c }
205   >>
206 }
207 @end lilypond
208
209 @item
210 In a @code{GrandStaff}, the group is started with a brace
211 at the left, and bar lines are connected between the staves. 
212
213 @lilypond[verbatim,ragged-right,quote]
214 \new GrandStaff {
215   \relative c'' <<
216     \new Staff { c1 c }
217     \new Staff { c c }
218   >>
219 }
220 @end lilypond
221
222 @item
223 The @code{PianoStaff} behaves almost as the @code{GrandStaff} but is
224 optimized for setting piano music. In particular it supports the printing
225 of an instrument name directly, see @ref{Instrument names}.
226
227 @lilypond[verbatim,ragged-right,quote]
228 \new PianoStaff {
229   \relative c'' <<
230     \new Staff { c1 c }
231     \new Staff { c c }
232   >>
233 }
234 @end lilypond
235
236 @end itemize
237
238 According to classic engraver rules an orchestral score consists of
239 staves connected only with a single line at the beginning of the system. 
240 In LilyPond this is produced grouping the @code{Staff} contexts with
241 @code{<< ... >>}.
242
243 Each instrument family is grouped inside of a @code{StaffGroup} with a 
244 starting bracket.  A group of same instruments or an instrument using
245 more than one staff is grouped with braces in a @code{GrandStaff}.
246
247 As the context names tell, @code{PianoStaff} is used for notating
248 piano music and @code{ChoirStaff} for all kind of vocal ensemble music.
249
250
251 @snippets
252
253 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
254 {use-square-bracket-at-the-start-of-a-staff-group.ly}
255
256 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
257 {display-bracket-with-only-one-staff-in-a-system.ly}
258
259 @cindex mensurstriche layout
260 @cindex renaissance music
261 @cindex transcription of mensural music
262 @cindex mensural music, transcription of
263
264 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
265 {mensurstriche-layout-bar-lines-between-the-staves.ly}
266
267
268 @seealso
269
270 Music Glossary: @rglos{brace}, 
271 @rglos{bracket}, @rglos{grand staff}.
272
273 Snippets: @lsrdir{Staff,Staff-notation}
274
275 Internals Reference: @internalsref{ChoirStaff},
276 @internalsref{GrandStaff}, @internalsref{StaffGroup},
277 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace},
278 @internalsref{SystemStartBracket}, and @internalsref{systemStartSquare}.
279
280
281 @node Deeper nested staff groups
282 @subsubsection Deeper nested staff groups
283
284 There are also two inner staff contexts named @code{InnerStaffGroup}
285 and @code{InnerChoirStaffGroup} besides the grouping contexts mentioned
286 in @ref{Grouping staves}.  They behave in the same way as their simple
287 counterparts, except that they are contained in another staff grouping
288 context, thus producing one more bracket on top of the existing one. 
289 Note that @code{GrandStaff} and @code{PianoStaff} do not have any inner
290 grouping contexts.  They can both be inside any other staff context, 
291 including inner staff groups, though.
292
293 Here is an example of an orchestral score using groupings and nesting
294 of these groupings.  Note that the instrument names are omitted from the
295 source code, see @ref{Instrument names} how to set them.
296
297 @cindex staff, nested
298 @cindex staves, nested
299 @cindex nesting of staves
300 @cindex system start delimiters, nested
301 @cindex nested staff brackets
302 @cindex brackets, nesting of
303 @cindex braces, nesting of
304 @cindex inner staff group
305 @cindex inner choir staff group
306
307
308 @example
309 \score @{ <<
310   \new StaffGroup %woodwinds
311   <<
312   \new Staff @{ c'1 d' @} %flute
313   \new InnerStaffGroup <<
314     \new Staff @{ c' d' @} %sax 
315     \new Staff @{ c' d' @} %oboe
316     \new Staff @{ c' d' @} %English horn
317     >>
318   \new Staff @{ \clef bass c d @} %bassoon
319   >>
320   \new StaffGroup %the brass group
321   <<
322     \new Staff @{ c' d' @} %trumpet
323     \new Staff @{ \clef bass c d @} %trombone
324     \new GrandStaff %the horns need a GrandStaff (same instrument)
325     <<
326       \new Staff @{ c' d' @}
327       \new Staff @{ \clef bass c d @}
328     >>
329   >>
330   \new ChoirStaff %for setting vocal music
331   <<
332    \new Staff @{ c' d' @}
333     \new InnerChoirStaff <<
334      \new Staff @{ c' d' @}
335      \new Staff @{ c' d' @}
336     >>
337    \new Staff @{ c' d' @}
338   >>
339   \new PianoStaff %for the piano
340   <<
341     \new Staff @{ c' d' @}
342     \new Staff @{\clef bass c d @}
343   >>
344 >> @}
345 @end example
346
347 @c no verbatim so instrument names are only in the music
348 @lilypond[ragged-right,quote]
349 \score { <<
350   \new StaffGroup %woodwinds
351   <<
352   \new Staff {\set Staff.instrumentName = "fl" c'1 d' } %flute
353   \new InnerStaffGroup <<
354     \new Staff { \set Staff.instrumentName = "sax" c' d' } %sax 1
355     \new Staff { \set Staff.instrumentName = "ob" c' d' } %sax 2
356     \new Staff { \set Staff.instrumentName = "ca" c' d' }
357     >>
358   \new Staff {\set Staff.instrumentName = "bs" \clef bass c d } %bassoon
359   >>
360   \new StaffGroup %the brass group
361   <<
362     \new Staff {\set Staff.instrumentName = "tr" c' d' } %trumpet
363     \new Staff {\set Staff.instrumentName = "tb" \clef bass c d } %trombone
364     \new GrandStaff %the horns need a GrandStaff (same instrument)
365     <<
366       \new Staff {\set Staff.instrumentName = "cor1" c' d' }
367       \new Staff {\set Staff.instrumentName = "cor2" \clef bass c d }
368     >>
369   >>
370   \new ChoirStaff %for setting vocal music
371   <<
372    \new Staff {\set Staff.instrumentName = "S" c' d' }
373     \new InnerChoirStaff <<
374      \new Staff {\set Staff.instrumentName = "A1" c' d' }
375      \new Staff {\set Staff.instrumentName = "A2" c' d' }
376     >>
377    \new Staff {\set Staff.instrumentName = "T" c' d' }
378   >>
379   \new PianoStaff %for the piano
380   <<
381     \new Staff { c' d' }
382     \new Staff {\clef bass c d }
383   >>
384 >> }
385 @end lilypond
386
387
388 @snippets
389
390 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
391 {nesting-staves.ly}
392
393
394 @seealso
395
396 Internals Reference: @internalsref{SystemStartBar}, 
397 @internalsref{SystemStartBrace}, @internalsref{SystemStartBracket},
398 @internalsref{systemStartDelimiterHierarchy}.
399
400
401
402 @node Modifying single staves
403 @subsection Modifying single staves
404
405 This section explains how to change specific attributes of one 
406 staff like the staff lines, starting and stopping of staves, sizing
407 of staves, and setting ossia sections.
408
409 @menu
410 * Staff symbol::   
411 * Ossia staves::             
412 * Hiding staves::    
413 @end menu
414
415 @node Staff symbol
416 @subsubsection Staff symbol
417
418 @cindex adjusting staff symbol
419 @cindex drawing staff symbol
420 @cindex staff symbol, setting of
421 @cindex stop staff lines
422 @cindex start staff lines
423 @cindex staff lines, amount of
424 @cindex staff line, thickness of
425 @cindex amount of staff lines
426 @cindex thickness of staff lines
427 @cindex ledger lines, setting
428 @cindex setting of ledger lines
429 @cindex spacing of ledger lines
430
431 The layout object which draws the lines of a staff is called
432 @code{staff symbol}.  The staff symbol may be tuned in number,
433 thickness and distance of lines, using properties.  It may also
434 be started and stopped at every point in the score.
435
436 @itemize
437 @item
438 Changing the number of staff lines is done by overriding 
439 @code{line-count}.  You may need to adjust the clef position
440 and the position of the middle C to fit to the new staff.  For
441 an explanation, see the snippet section in @ref{Displaying pitches}.
442
443 @lilypond[verbatim,ragged-right,quote]
444 \new Staff {
445   \override Staff.StaffSymbol  #'line-count = #3
446   d d d d
447 }
448 @end lilypond
449
450 @item
451 The placement and amount of the staff lines can also set totally 
452 manually by defining their positions explicitly.  The middle
453 of the staff has the value of 0, each half staff space up and down
454 adds an integer.  The default values are 4 2 0 -2 -4.  Bar lines
455 are drawn according to the calculated width of the system, but
456 they are always centered.  As the
457 example shows, the positions of the notes are not influenced
458 by the position of the staff lines.
459
460 @lilypond[verbatim,ragged-right,quote]
461 \new Staff \with {
462   \override StaffSymbol #' line-positions = #' ( 7 3 0 -4 -6 -7 )
463   }{
464   a e' f' b' d''
465 }
466 @end lilypond
467
468 @item
469 The staff line thickness can be set by overriding the @code{thickness}
470 property.  Note that it gets applied also to ledger lines and stems, 
471 since they depend on the staff line thickness.  The argument of 
472 @code{thickness} is a factor of @code{line-thickness} which defaults
473 to the normal staff line thickness.
474
475 @lilypond[verbatim,ragged-right,quote]
476 \new Staff \with {
477   \override StaffSymbol #'thickness = #3
478   }{
479   d d d d
480 }
481 @end lilypond
482
483 @item
484 The thickness of the ledger lines can also be set independent of the
485 settings for staff lines.  The setting is calculated from a pair of
486 values which will be added for the final thickness.  The first value 
487 is the staff line thickness multiplied by a factor, the second is
488 the staff space multiplied by a factor.  In the example the ledger
489 lines get their thickness from one staff line thickness plus 1/5 
490 staff space, so they are heavier than a normal staff line.
491
492 @lilypond[verbatim,ragged-right,quote]
493 \new Staff \with {
494   \override StaffSymbol #'  ledger-line-thickness = #' ( 1 . 0.2 ) }
495   {
496   d d d d
497 }
498 @end lilypond
499
500 @item
501 The distance of the stafflines can be changed with the 
502 @code{staff-space} property. Its argument is the amount
503 of staff spaces that should be inserted between the lines.
504 The default value is 1. Setting the distance has
505 influence on the staff lines as well as on ledger lines.
506
507 @lilypond[verbatim,ragged-right,quote]
508 \new Staff \with {
509   \override StaffSymbol #' staff-space  = #1.5
510   }{
511   a b c' d'
512 }
513 @end lilypond
514
515 @item
516 The length of the staff line can also be adjusted
517 manually.  The unit is one staff space.  Spacing 
518 of the objects inside the staff does not get influenced 
519 by this setting.
520
521 @lilypond[verbatim,ragged-right,quote]
522 \new Staff \with {
523   \override StaffSymbol #' width = #23
524   }{
525   a e' f' b' d''
526 }
527 @end lilypond
528
529 @end itemize
530
531 These properties can only be set before instantiating the staff symbol.
532 But it is possible to start and stop staves in the middle of a score,
533 so each new setting will be applied to the newly instantiated staff.
534
535 @lilypond[verbatim,relative=2,fragment]
536 b4 b
537 %Set here the overrides for the staff 
538 \override Staff.StaffSymbol #'line-count = 2
539 \stopStaff \startStaff
540 b b
541 %Revert to the default
542 \revert Staff.StaffSymbol #'line-count
543 \stopStaff \startStaff
544 b b
545 @end lilypond
546  
547 @predefined
548
549 @code{\stopStaff}, @code{\startStaff}
550
551 @snippets
552
553 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
554 {making-some-staff-lines-thicker-than-the-others.ly}
555
556 @seealso
557
558 Glossary: @rglos{line}, @rglos{ledger line}, @rglos{staff}.
559
560 Internals Reference: @internalsref{StaffSymbol}.
561
562 @knownissues
563
564 When setting staff lines manually, bar lines are
565 always drawn centered on the position 0, so the
566 maximum distance of the bar lines in either direction 
567 must be equal.
568
569
570 @node Ossia staves
571 @subsubsection Ossia staves
572
573 @cindex staves, Frenched
574 @cindex ossia
575 @cindex Frenched staves
576
577 Tweaking the staff object allows to resize the staff:
578
579 @lilypond[verbatim,ragged-right,quote]
580   \new Staff \with {
581     fontSize = #-3
582     \override StaffSymbol #'staff-space = #(magstep -3)
583     \override StaffSymbol #'thickness = # (magstep -3)
584   }
585   {
586     \clef bass
587     c8 c c c  c c c c
588   }
589 @end lilypond
590
591 @noindent
592 This involves shrinking the staff spaces, the staff lines and
593 the font size. See @ref{Setting the staff size}.
594
595 In combination with Frenched staves, this may be used to typeset
596 @emph{ossia} sections.  An example is shown here
597
598 @lilypond[verbatim,relative=2,quote]
599 <<
600   \new Staff \with
601   {
602     \remove "Time_signature_engraver"
603     fontSize = #-2
604     \override StaffSymbol #'staff-space = #(magstep -2)
605     firstClef = ##f
606   }
607   \relative c'' {
608     \stopStaff
609     \skip 2
610
611     \startStaff
612     \clef treble
613     bes8[^"ossia" g bes g]
614     \stopStaff
615
616     s2
617
618     \startStaff
619     f8 d g4 
620   }
621   \new Staff  \relative
622   {
623     \time 2/4
624     c4 c g' g a a g2
625   }
626
627 >>
628 @end lilypond
629
630 @cindex staff lines, setting number of
631 @cindex staff lines, setting thickness of
632 @cindex thickness of staff lines, setting
633 @cindex number of staff lines, setting
634
635 @snippets
636
637 @c  lilypondfile{Making-some-staff-lines-thicker-than-the-others.ly}
638 @c snippet 277
639
640 @seealso
641
642 Music Glossary: @rglos{ossia}, @rglos{staff}, @rglos{Frenched staff}.
643
644 Snippets: @lsrdir{Staff,Staff-notation}
645
646 Internals Reference: @internalsref{StaffSymbol},
647 @internalsref{DrumStaff}.
648
649
650 @node Hiding staves
651 @subsubsection Hiding staves
652
653 @cindex Frenched scores
654 @cindex staves, hiding
655 @cindex staves, empty 
656
657 In orchestral scores, staff lines that only have rests are usually
658 removed; this saves some space.  This style is called @q{French
659 Score}.  For @code{Lyrics}, @code{ChordNames} and
660 @code{FiguredBass}, this is switched on by default.  When
661 the lines of these contexts turn out empty after the line-breaking
662 process, they are removed.
663
664 For normal staves, a specialized @code{Staff} context is
665 available, which does the same: staves containing nothing (or only
666 multi-measure rests) are removed.  The context definition is
667 stored in @code{\RemoveEmptyStaffContext} variable.  Observe how
668 the second staff in this example disappears in the second line
669
670 @lilypond[quote,ragged-right,verbatim]
671 \layout {
672   \context { \RemoveEmptyStaffContext }
673 }
674
675 {
676   \relative c' <<
677     \new Staff { e4 f g a \break c1 }
678     \new Staff { c4 d e f \break R1 }
679   >>
680 }
681 @end lilypond
682
683 The first system shows all staves in full.  If empty staves should
684 be removed from the first system too, set @code{remove-first} to
685 true in @code{VerticalAxisGroup}.
686
687 @example
688 \override Score.VerticalAxisGroup #'remove-first = ##t
689 @end example
690
691 To remove other types of contexts, use
692 @code{\AncientRemoveEmptyStaffContext} or
693 @code{\RemoveEmptyRhythmicStaffContext}.
694
695 @cindex ossia
696
697 Another application of the @code{\RemoveEmptyStaffContext} is to
698 make ossia sections, i.e., alternative melodies on a separate
699 piece of staff, with help of a Frenched staff.  See @ref{Staff
700 symbol}. 
701
702 You can make the staff lines invisible by removing the
703 @code{Staff_symbol_engraver} from the @code{Staff} context.
704
705
706 @lilypond[quote,ragged-right,verbatim]
707 \score {
708   \context Staff \relative c'' { c8 c c16 c c c }
709   \layout{
710     \context {
711       \Staff
712       \remove Staff_symbol_engraver
713     }
714   }
715 }
716 @end lilypond
717
718 @seealso
719
720 Notation Reference: @ref{Staff symbol}.
721
722 Snippets: @lsrdir{Staff,Staff-notation}
723
724 Internals Reference: @internalsref{ChordNames},
725 @internalsref{FiguredBass}, @internalsref{Lyrics},
726 @internalsref{Staff}, @internalsref{VerticalAxisGroup}.
727
728 @node Writing parts
729 @subsection Writing parts
730
731 @menu
732 * Metronome marks::             
733 * Instrument names::            
734 * Quoting other voices::        
735 * Formatting cue notes::        
736 @end menu
737
738 @node Metronome marks
739 @subsubsection Metronome marks
740
741 @cindex Tempo
742 @cindex beats per minute
743 @cindex metronome marking
744
745 Metronome settings can be entered as follows
746
747 @example
748 \tempo @var{duration} = @var{per-minute}
749 @end example
750
751 In the MIDI output, they are interpreted as a tempo change.  In
752 the layout output, a metronome marking is printed
753
754 @funindex \tempo
755
756 @lilypond[quote,ragged-right,verbatim,fragment]
757 \tempo 8.=120 c''1
758 @end lilypond
759
760
761 @snippets
762
763 To change the tempo in the MIDI output without printing anything,
764 make the metronome marking invisible @example \once \override
765 Score.MetronomeMark #'transparent = ##t @end example
766
767 To print other metronome markings, use these markup commands
768 @lilypond[quote,ragged-right,verbatim,relative,fragment]
769 c4^\markup {
770   (
771   \smaller \general-align #Y #DOWN \note #"16." #1
772   =
773   \smaller \general-align #Y #DOWN \note #"8" #1
774   ) }
775 @end lilypond
776
777 @noindent
778 For more details, see @ref{Formatting text}.
779
780
781 @seealso
782
783 Music Glossary: @rglos{metronome}, @rglos{metronomic indication},
784 @rglos{tempo indication}, @rglos{metronome mark}.
785
786 Notation Reference: @ref{Formatting text}.
787
788 Snippets: @lsrdir{Staff,Staff-notation}.
789
790 Internals Reference: @internalsref{MetronomeMark}, @ref{MIDI
791 output}.
792
793
794 @knownissues
795
796 Collisions are not checked.  If you have notes above the top line
797 of the staff (or notes with articulations, slurs, text, etc), then
798 the metronome marking may be printed on top of musical symbols.
799 If this occurs, increase the padding of the metronome mark to
800 place it further away from the staff.
801
802 @example
803 \override Score.MetronomeMark #'padding = #2.5
804 @end example
805
806 @c perhaps also an example of how to move it horizontally?
807
808
809 @node Instrument names
810 @subsubsection Instrument names
811
812 @cindex instrument names
813 @cindex instrument names, short
814
815 In an orchestral score, instrument names are printed at the left
816 side of the staves.
817
818 This can be achieved by setting @code{Staff}.@code{instrumentName} and
819 @code{Staff}.@code{shortInstrumentName}, or
820 @code{PianoStaff}.@code{instrumentName} and
821 @code{PianoStaff}.@code{shortInstrumentName}.  This will print text
822 before the start of the staff.  For the first staff,
823 @code{instrumentName} is used.  If set, @code{shortInstrumentName} is
824 used for the following staves.
825
826 @lilypond[quote,verbatim,ragged-right,relative=1,fragment]
827 \set Staff.instrumentName = "Ploink "
828 \set Staff.shortInstrumentName = "Plk "
829 c1
830 \break
831 c''
832 @end lilypond
833
834 You can also use markup texts to construct more complicated
835 instrument names, for example
836
837 @lilypond[quote,fragment,verbatim,ragged-right]
838 \set Staff.instrumentName = \markup {
839   \column { "Clarinetti"
840             \line { "in B" \smaller \flat } } }
841 c''1
842 @end lilypond
843
844 @cindex instrument names, centering
845
846 As instrument names are centered by default, multi line names
847 are better entered using @code{\center-align}:
848
849 @lilypond[quote,verbatim,ragged-right]
850 { <<
851 \new Staff {
852   \set Staff.instrumentName = \markup \center-align {
853     Clarinetti
854     \line { "in B" \smaller \flat }
855   }
856   c''1
857 }
858 \new Staff {
859   \set Staff.instrumentName = "Vibraphone"
860   c''1
861 }
862 >>
863 }
864 @end lilypond
865
866 For longer instrument names, it may be useful to increase the
867 @code{indent} setting in the @code{\layout} block.
868
869 Short instrument names, printed before the systems following the first
870 one, are also centered by default, in a space which width is given by
871 the @code{short-indent} variable of the @code{\layout} block.
872
873 To add instrument names to other contexts (such as
874 @code{GrandStaff}, @code{ChoirStaff}, or @code{StaffGroup}), the
875 engraver must be added to that context.
876
877 @example
878 \layout@{
879   \context @{\GrandStaff \consists "Instrument_name_engraver"@}
880 @}
881 @end example
882
883 @noindent
884 More information about adding and removing engravers can be found
885 in @ref{Modifying context plug-ins}.
886
887 @cindex instrument names, changing
888
889 Instrument names may be changed in the middle of a piece,
890
891 @lilypond[quote,fragment,verbatim,ragged-right]
892 \set Staff.instrumentName = "First"
893 \set Staff.shortInstrumentName = "one"
894 c1 c c c \break
895 c1 c c c \break
896 \set Staff.instrumentName = "Second"
897 \set Staff.shortInstrumentName = "two"
898 c1 c c c \break
899 c1 c c c \break
900 @end lilypond
901
902
903 @seealso
904
905 Notation Reference: @ref{Modifying context plug-ins}.
906
907 Snippets: @lsrdir{Staff,Staff-notation}
908
909 Internals Reference: @internalsref{InstrumentName},
910 @internalsref{PianoStaff}, @internalsref{Staff}.
911
912
913 @node Quoting other voices
914 @subsubsection Quoting other voices
915
916 @cindex cues
917 @cindex quoting other voices
918 @cindex fragments
919 @cindex cue notes
920
921 With quotations, fragments of other parts can be inserted into a
922 part directly.  Before a part can be quoted, it must be marked
923 especially as quotable.  This is done with the @code{\addQuote}
924 command.
925
926 @example
927 \addQuote @var{name} @var{music}
928 @end example
929
930
931 @noindent
932 Here, @var{name} is an identifying string.  The @var{music} is any
933 kind of music.  Here is an example of @code{\addQuote}
934
935 @example
936 \addQuote clarinet \relative c' @{
937   f4 fis g gis
938 @}
939 @end example
940
941 This command must be entered at toplevel, i.e., outside any music
942 blocks.  Typically, one would use an already defined music event
943 as the @var{music}:
944
945 @example
946 clarinet = \relative c' @{
947   f4 fis g gis
948 @}
949 \addQuote clarinet @{ \clarinet @}
950 @end example
951
952
953 After calling @code{\addQuote}, the quotation may then be done
954 with @code{\quoteDuring} or @code{\cueDuring},
955
956 @example
957 \quoteDuring #@var{name} @var{music}
958 @end example
959
960 During a part, a piece of music can be quoted with the
961 @code{\quoteDuring} command.
962
963 @example
964 \quoteDuring #"clarinet" @{ s2. @}
965 @end example
966
967 This would cite three quarter notes (the duration of @code{s2.})
968 of the previously added @code{clarinet} voice.
969
970 More precisely, it takes the current time-step of the part being
971 printed, and extracts the notes at the corresponding point of the
972 @code{\addQuote}d voice.  Therefore, the argument to
973 @code{\addQuote} should be the entire part of the voice to be
974 quoted, including any rests at the beginning.
975
976 It is possible to use another music expression instead of
977 @code{s}, thus creating a polyphonic section, but this may not
978 always give the desired result.
979
980 Quotations take into account the transposition of both source and
981 target instruments, if they are specified using the
982 @code{\transposition} command.
983
984 @lilypond[quote,ragged-right,verbatim]
985 \addQuote clarinet \relative c' {
986   \transposition bes
987   f4 fis g gis
988 }
989
990 {
991   e'8 f'8 \quoteDuring #"clarinet" { s2 }
992 }
993 @end lilypond
994
995 The type of events that are present in the quoted music can be
996 trimmed with the @code{quotedEventTypes} property.  The default
997 value is @code{(note-event rest-event)}, which means that only
998 notes and rests of the quoted voice end up in the
999 @code{\quoteDuring}.  Setting
1000
1001 @example
1002 \set Staff.quotedEventTypes =
1003        #'(note-event articulation-event dynamic-event)
1004 @end example
1005
1006 @noindent
1007 will quote notes (but no rests), together with scripts and
1008 dynamics.
1009
1010 @knownissues
1011
1012 Only the contents of the first @code{Voice} occurring in an
1013 @code{\addQuote} command will be considered for quotation, so
1014 @var{music} can not contain @code{\new} and @code{\context Voice}
1015 statements that would switch to a different Voice.
1016
1017 Quoting grace notes is broken and can even cause LilyPond to
1018 crash.
1019
1020 Quoting nested triplets may result in poor notation.
1021
1022 In earlier versions of LilyPond (pre 2.11), @code{addQuote} was
1023 written entirely in lower-case letters: @code{\addquote}.
1024
1025 @seealso
1026
1027 Notation Reference: @ref{Instrument transpositions}.
1028
1029 Snippets: @lsrdir{Staff,Staff-notation}
1030
1031 Internals Reference: @internalsref{QuoteMusic}, @internalsref{Voice}.
1032
1033
1034 @node Formatting cue notes
1035 @subsubsection Formatting cue notes
1036
1037 @cindex cues
1038 @cindex cue notes
1039 @cindex cue notes, formatting
1040 @cindex fragments
1041 @cindex quoting other voices 
1042 @cindex cues, formatting
1043
1044 The previous section deals with inserting notes from another
1045 voice.  There is a more advanced music function called
1046 @code{\cueDuring}, which makes formatting cue notes easier.
1047
1048 The syntax is
1049
1050 @example
1051   \cueDuring #@var{name} #@var{updown} @var{music}
1052 @end example
1053
1054 This will insert notes from the part @var{name} into a
1055 @code{Voice} called @code{cue}.  This happens
1056 simultaneously with @var{music}, which usually is a rest.  When
1057 the cue notes start, the staff in effect becomes polyphonic for a
1058 moment.  The argument @var{updown} determines whether the cue
1059 notes should be notated as a first or second voice.
1060
1061
1062 @lilypond[verbatim,ragged-right]
1063 smaller = {
1064   \set fontSize = #-2
1065   \override Stem #'length-fraction = #0.8
1066   \override Beam #'thickness = #0.384
1067   \override Beam #'length-fraction = #0.8
1068 }
1069
1070 \addQuote clarinet \relative {
1071   R1*20
1072   r2 r8 c' f f
1073 }
1074
1075 \new Staff \relative  <<
1076
1077   % setup a context for cue notes.
1078   \new Voice = "cue" { \smaller \skip 1*21 }
1079
1080   \set Score.skipBars = ##t
1081
1082   \new Voice {
1083     R1*20
1084     \cueDuring #"clarinet" #UP {
1085       R1
1086     }
1087     g4 g2.
1088   }
1089 >>
1090 @end lilypond
1091
1092
1093 Here are a couple of hints for successful cue notes:
1094
1095 @itemize
1096 @item
1097 Cue notes have smaller font sizes.
1098
1099 @item
1100 The cued part is marked with the instrument playing the cue.
1101
1102 @item
1103 When the original part takes over again, this should be marked
1104 with the name of the original instrument.
1105
1106 @item
1107 Any other changes introduced by the cued part should also be
1108 undone.  For example, if the cued instrument plays in a different
1109 clef, the original clef should be stated once again.
1110
1111 @end itemize
1112
1113 The macro @code{\transposedCueDuring} is useful to add cues to
1114 instruments which use a completely different octave range (for
1115 example, having a cue of a piccolo flute within a contra bassoon
1116 part).
1117
1118 @lilypond[verbatim,ragged-right,quote]
1119 picc = \relative c''' {
1120   \clef "treble^8"
1121   R1 |
1122   c8 c c e g2 |
1123   a4 g g2 |
1124 }
1125 \addQuote "picc" { \picc }
1126
1127 cbsn = \relative c, {
1128   \clef "bass_8"
1129   c4 r g r
1130   \transposedCueDuring #"picc" #UP c,, { R1 } |
1131   c4 r g r |
1132 }
1133
1134 <<
1135   \context Staff = "picc" \picc
1136   \context Staff = "cbsn" \cbsn
1137 >>
1138 @end lilypond
1139
1140 @seealso
1141
1142 Snippets: @lsrdir{Staff,Staff-notation}.
1143
1144 Internals Reference: @internalsref{Voice}.
1145
1146