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