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