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