]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/staff.itely
Update from Ralph.
[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 @node Staff notation
10 @section Staff notation
11
12 @lilypondfile[quote,ragged-right,line-width=16\cm,staffsize=16]
13 {staff-headword.ly}
14
15 Notes, dynamic signs, rests, etc., are grouped with a set of horizontal
16 lines, called a staff (plural @q{staves}).  In LilyPond, these
17 lines are drawn using a separate layout object called @code{staff
18 symbol}.
19
20 Two or more staves can be grouped vertically in a @code{GrandStaff}, a
21 @code{StaffGroup}, or a @code{ChoirStaff}.
22
23
24 @menu
25 * Displaying staves::           
26 * Writing parts::               
27 @end menu
28
29
30 @node Displaying staves
31 @subsection Displaying staves
32
33 @menu
34 * System start delimiters::     
35 * Staff symbol::                
36 * Hiding staves::               
37 @end menu
38
39 @node System start delimiters
40 @unnumberedsubsubsec System start delimiters
41
42 @cindex start of system
43 @cindex staff, multiple
44 @cindex bracket, vertical
45 @cindex brace, vertical
46 @cindex grand staff
47 @cindex staff group
48 @cindex staff, choir
49 @cindex system
50
51 Many scores consist of more than one staff.  These staves can be
52 grouped in several different ways:
53
54 @itemize
55 @item
56 In a @code{GrandStaff}, the group is started with a brace
57 at the left, and bar lines are connected between the staves. 
58
59 @lilypond[verbatim,ragged-right,quote]
60 \new GrandStaff
61 \relative <<
62   \new Staff { c1 c }
63   \new Staff { c c }
64 >>
65 @end lilypond
66
67 @item
68 In a @code{StaffGroup}, the bar lines will be drawn through
69 all the staves, but the group is started with a bracket.
70
71 @lilypond[verbatim,ragged-right,quote]
72 \new StaffGroup
73 \relative <<
74   \new Staff { c1 c }
75   \new Staff { c c }
76 >>
77 @end lilypond
78
79 @item
80 In a @code{ChoirStaff}, the group is started with a
81 bracket, but bar lines are not connected. 
82
83 @lilypond[verbatim,ragged-right,quote]
84 \new ChoirStaff
85 \relative <<
86   \new Staff { c1 c }
87   \new Staff { c c }
88 >>
89 @end lilypond
90
91 @item
92 If no context is specified, the default properties for the score
93 will be used: the group is started with a vertical line, and the
94 bar lines are not connected.  
95
96 @lilypond[verbatim,ragged-right,quote]
97 \relative <<
98   \new Staff { c1 c }
99   \new Staff { c c }
100 >>
101 @end lilypond
102 @end itemize
103
104 @cindex Mensurstriche layout
105 @cindex Renaissance music
106
107 In addition to these four staff group types, other groupings can
108 be produced by changing various properties. E.g., the
109 @q{Mensurstriche} layout common in Renaissance music, with
110 bar lines running between but not through the staves, can be
111 produced from a @code{StaffGroup} or @code{GrandStaff} context if
112 the bar lines are made transparent in the @code{Staff} itself, with
113 the command @code{\override Staff.BarLine #'transparent = ##t}
114
115 @cindex staff, nested
116
117 Staff groups can be nested, using the context
118 @code{InnerStaffGroup} or @code{InnerChoirStaff}; see
119 @lsr{staff,staff-brackets.ly}
120 @c snippet 137
121
122 @commonprop
123
124 More complex nesting can be accomplished using the property
125 @code{systemStartDelimiterHierarchy}: 
126
127 @lilypond[quote,ragged-right,verbatim]
128 \new StaffGroup
129 \relative <<
130   \set StaffGroup.systemStartDelimiterHierarchy
131     = #'(SystemStartSquare (SystemStartBracket a
132                              (SystemStartSquare b)) d)
133   \new Staff { c1 }
134   \new Staff { c1 }
135   \new Staff { c1 }
136   \new Staff { c1 }
137   \new Staff { c1 }
138 >>
139 @end lilypond
140
141 Each staff group context sets the property
142 @code{systemStartDelimiter} to one of the values
143 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace},
144 and @internalsref{SystemStartBracket}.  A fourth delimiter,
145 @code{systemStartSquare}, is also available, but must be
146 instantiated manually
147
148 @c FIXME: Graham will deal with this.  -gp
149 @c snippet 201
150 To display a bracket even if there is only one staff, see
151 @lsr{staff,display-bracket-with-only-one-staff-in-a
152 system.ly}
153
154 @seealso
155
156 Music Glossary: @rglos{brace}, @rglos{staff}, @rglos{staves}
157 @c FIXME add @rglos{bracket}
158
159 Snippets: @lsrdir{staff}
160
161 Internals Reference: @internalsref{ChoirStaff},
162 @internalsref{GrandStaff}, @internalsref{StaffGroup},
163 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace},
164 @internalsref{SystemStartBracket},
165 @internalsref{systemStartDelimiterHierarchy}.
166
167
168 @node Staff symbol
169 @unnumberedsubsubsec Staff symbol
170
171 @cindex adjusting staff symbol
172
173 The layout object which draws the lines of a staff is called
174 @code{staff symbol}.  The staff symbol may be tuned in the number,
175 thickness and distance of lines, using properties.  This is
176 demonstrated in the example files
177 @lsr{staff,changing-the-number-of-lines-in-a-staff.ly} and
178 @lsr{staff,changing-the-staff-size.ly}.
179
180 In addition, staves may be started and stopped at will.  This is
181 done with @code{\startStaff} and @code{\stopStaff}.
182
183 @lilypond[verbatim,relative=2,fragment]
184 b4 b
185 \override Staff.StaffSymbol #'line-count = 2
186 \stopStaff \startStaff
187 b b
188 \revert Staff.StaffSymbol #'line-count
189 \stopStaff \startStaff
190 b b
191 @end lilypond
192
193 @cindex staves, Frenched
194 @cindex ossia
195 @cindex Frenched staves
196
197 In combination with Frenched staves, this may be used to typeset
198 @emph{ossia} sections.  An example is shown here
199
200 @lilypond[verbatim,relative=2,quote]
201 <<
202   \new Staff \with
203   {
204     \remove "Time_signature_engraver"
205     fontSize = #-2
206     \override StaffSymbol #'staff-space = #(magstep -2)
207     firstClef = ##f
208   }
209   \relative c'' {
210     \stopStaff
211     \skip 2
212
213     \startStaff
214     \clef treble
215     bes8[^"ossia" g bes g]
216     \stopStaff
217
218     s2
219
220     \startStaff
221     f8 d g4 
222   }
223   \new Staff  \relative
224   {
225     \time 2/4
226     c4 c g' g a a g2
227   }
228
229 >>
230 @end lilypond
231
232 @cindex staff lines, setting number of
233 @cindex staff lines, setting thickness of
234 @cindex thickness of staff lines, setting
235 @cindex number of staff lines, setting
236
237 @seealso
238
239 Music Glossary: @rglos{ossia}, @rglos{staff}, @rglos{Frenched staff}.
240
241 Snippets: @lsrdir{staff}
242
243 Internals Reference: @internalsref{StaffSymbol},
244 @internalsref{DrumStaff}.
245
246
247 @node Hiding staves
248 @unnumberedsubsubsec Hiding staves
249
250 @cindex Frenched scores
251 @cindex staves, hiding 
252
253 In orchestral scores, staff lines that only have rests are usually
254 removed; this saves some space.  This style is called @q{French
255 Score}.  For @internalsref{Lyrics}, @internalsref{ChordNames} and
256 @internalsref{FiguredBass}, this is switched on by default.  When
257 the lines of these contexts turn out empty after the line-breaking
258 process, they are removed.
259
260 For normal staves, a specialized @internalsref{Staff} context is
261 available, which does the same: staves containing nothing (or only
262 multi-measure rests) are removed.  The context definition is
263 stored in @code{\RemoveEmptyStaffContext} variable.  Observe how
264 the second staff in this example disappears in the second line
265
266 @lilypond[quote,ragged-right,verbatim]
267 \layout {
268   \context { \RemoveEmptyStaffContext }
269 }
270
271 {
272   \relative c' <<
273     \new Staff { e4 f g a \break c1 }
274     \new Staff { c4 d e f \break R1 }
275   >>
276 }
277 @end lilypond
278
279 The first system shows all staves in full.  If empty staves should
280 be removed from the first system too, set @code{remove-first} to
281 true in @internalsref{VerticalAxisGroup}.
282
283 @example
284 \override Score.VerticalAxisGroup #'remove-first = ##t
285 @end example
286
287 To remove other types of contexts, use
288 @code{\AncientRemoveEmptyStaffContext} or
289 @code{\RemoveEmptyRhythmicStaffContext}.
290
291 Another application of the @code{\RemoveEmptyStaffContext} is to
292 make ossia sections, i.e., alternative melodies on a separate
293 piece of staff, with help of a Frenched staff.  See @ref{Staff
294 symbol}. 
295
296 You can make the staff lines invisible by removing the
297 @code{Staff_symbol_engraver} from the @code{Staff} context.
298
299
300 @lilypond[quote,ragged-right,verbatim]
301 \score {
302   \context Staff \relative c'' { c8 c c16 c c c }
303   \layout{
304     \context {
305       \Staff
306       \remove Staff_symbol_engraver
307     }
308   }
309 }
310 @end lilypond
311
312 @seealso
313
314 Snippets: @lsrdir{staff}
315
316 @node Writing parts
317 @subsection Writing parts
318
319 @menu
320 * Metronome marks::             
321 * Instrument names::            
322 * Quoting other voices::        
323 * Formatting cue notes::        
324 @end menu
325
326 @node Metronome marks
327 @unnumberedsubsubsec Metronome marks
328
329 @cindex Tempo
330 @cindex beats per minute
331 @cindex metronome marking
332
333 Metronome settings can be entered as follows
334
335 @example
336 \tempo @var{duration} = @var{per-minute}
337 @end example
338
339 In the MIDI output, they are interpreted as a tempo change.  In
340 the layout output, a metronome marking is printed
341
342 @funindex \tempo
343
344 @lilypond[quote,ragged-right,verbatim,fragment]
345 \tempo 8.=120 c''1
346 @end lilypond
347
348
349 @commonprop
350
351 To change the tempo in the MIDI output without printing anything,
352 make the metronome marking invisible @example \once \override
353 Score.MetronomeMark #'transparent = ##t @end example
354
355 To print other metronome markings, use these markup commands
356 @lilypond[quote,ragged-right,verbatim,relative,fragment]
357 c4^\markup {
358   (
359   \smaller \general-align #Y #DOWN \note #"16." #1
360   =
361   \smaller \general-align #Y #DOWN \note #"8" #1
362   ) }
363 @end lilypond
364
365 @noindent
366 For more details, see @ref{Text markup}.
367
368
369 @seealso
370
371 Internals Reference: @internalsref{MetronomeMark}, @ref{MIDI
372 output}.
373
374
375 @refbugs
376
377 Collisions are not checked.  If you have notes above the top line
378 of the staff (or notes with articulations, slurs, text, etc), then
379 the metronome marking may be printed on top of musical symbols.
380 If this occurs, increase the padding of the metronome mark to
381 place it further away from the staff.
382
383 @example
384 \override Score.MetronomeMark #'padding = #2.5
385 @end example
386
387 @c perhaps also an example of how to move it horizontally?
388
389 @seealso
390
391 Snippets: @lsrdir{staff}
392
393 @node Instrument names
394 @unnumberedsubsubsec Instrument names
395
396 In an orchestral score, instrument names are printed at the left
397 side of the staves.
398
399 This can be achieved by setting
400 @internalsref{Staff}.@code{instrumentName} and
401 @internalsref{Staff}.@code{shortInstrumentName}, or
402 @internalsref{PianoStaff}.@code{instrumentName} and
403 @internalsref{PianoStaff}.@code{shortInstrumentName}.  This will
404 print text before the start of the staff.  For the first staff,
405 @code{instrumentName} is used.  If set, @code{shortInstrumentName}
406 is used for the following staves.
407
408 @lilypond[quote,verbatim,ragged-right,relative=1,fragment]
409 \set Staff.instrumentName = "Ploink "
410 \set Staff.shortInstrumentName = "Plk "
411 c1
412 \break
413 c''
414 @end lilypond
415
416 You can also use markup texts to construct more complicated
417 instrument names, for example
418
419 @lilypond[quote,fragment,verbatim,ragged-right]
420 \set Staff.instrumentName = \markup {
421   \column { "Clarinetti"
422             \line { "in B" \smaller \flat } } }
423 c''1
424 @end lilypond
425
426 If you wish to center the instrument names, you must center all of
427 them individually:
428
429 @lilypond[quote,verbatim,ragged-right]
430 { <<
431 \new Staff {
432   \set Staff.instrumentName = \markup {
433     \center-align { "Clarinetti"
434       \line { "in B" \smaller \flat } } }
435   c''1
436 }
437 \new Staff {
438   \set Staff.instrumentName =
439        \markup{ \center-align { Vibraphone }}
440   c''1
441 }
442 >>
443 }
444 @end lilypond
445
446 For longer instrument names, it may be useful to increase the
447 @code{indent} setting in the @code{\layout} block.
448
449 To center instrument names while leaving extra space to the right,
450
451 @lilypond[quote,verbatim,ragged-right]
452 \new StaffGroup \relative
453 <<
454   \new Staff {
455     \set Staff.instrumentName =
456         \markup { \hcenter-in #10 "blabla" }
457     c1 c1
458   }
459   \new Staff {
460     \set Staff.instrumentName =
461          \markup { \hcenter-in #10 "blo" }
462     c1 c1
463   }
464 >>
465 @end lilypond
466
467 To add instrument names to other contexts (such as
468 @code{GrandStaff}, @code{ChoirStaff}, or @code{StaffGroup}), the
469 engraver must be added to that context.
470
471 @example
472 \layout@{
473   \context @{\GrandStaff \consists "Instrument_name_engraver"@}
474 @}
475 @end example
476
477 @noindent
478 More information about adding and removing engravers can be found
479 in @ref{Modifying context plug-ins}.
480
481 Instrument names may be changed in the middle of a piece,
482
483 @lilypond[quote,fragment,verbatim,ragged-right]
484 \set Staff.instrumentName = "First"
485 \set Staff.shortInstrumentName = "one"
486 c1 c c c \break
487 c1 c c c \break
488 \set Staff.instrumentName = "Second"
489 \set Staff.shortInstrumentName = "two"
490 c1 c c c \break
491 c1 c c c \break
492 @end lilypond
493
494
495 @seealso
496
497 Snippets: @lsrdir{staff}
498
499 Internals Reference: @internalsref{InstrumentName}.
500
501
502 @node Quoting other voices
503 @unnumberedsubsubsec Quoting other voices
504
505 @cindex cues
506
507 With quotations, fragments of other parts can be inserted into a
508 part directly.  Before a part can be quoted, it must be marked
509 especially as quotable.  This is done with the @code{\addQuote}
510 command.
511
512 @example
513 \addQuote @var{name} @var{music}
514 @end example
515
516
517 @noindent
518 Here, @var{name} is an identifying string.  The @var{music} is any
519 kind of music.  Here is an example of @code{\addQuote}
520
521 @example
522 \addQuote clarinet \relative c' @{
523   f4 fis g gis
524 @}
525 @end example
526
527 This command must be entered at toplevel, i.e., outside any music
528 blocks.  Typically, one would use an already defined music event
529 as the @var{music}:
530
531 @example
532 clarinet = \relative c' @{
533   f4 fis g gis
534 @}
535 \addQuote clarinet @{ \clarinet @}
536 @end example
537
538
539 After calling @code{\addQuote}, the quotation may then be done
540 with @code{\quoteDuring} or @code{\cueDuring},
541
542 @example
543 \quoteDuring #@var{name} @var{music}
544 @end example
545
546 During a part, a piece of music can be quoted with the
547 @code{\quoteDuring} command.
548
549 @example
550 \quoteDuring #"clarinet" @{ s2. @}
551 @end example
552
553 This would cite three quarter notes (the duration of @code{s2.})
554 of the previously added @code{clarinet} voice.
555
556 More precisely, it takes the current time-step of the part being
557 printed, and extracts the notes at the corresponding point of the
558 @code{\addQuote}d voice.  Therefore, the argument to
559 @code{\addQuote} should be the entire part of the voice to be
560 quoted, including any rests at the beginning.
561
562 It is possible to use another music expression instead of
563 @code{s}, thus creating a polyphonic section, but this may not
564 always give the desired result.
565
566 Quotations take into account the transposition of both source and
567 target instruments, if they are specified using the
568 @code{\transposition} command.
569
570 @lilypond[quote,ragged-right,verbatim]
571 \addQuote clarinet \relative c' {
572   \transposition bes
573   f4 fis g gis
574 }
575
576 {
577   e'8 f'8 \quoteDuring #"clarinet" { s2 }
578 }
579 @end lilypond
580
581 The type of events that are present in the quoted music can be
582 trimmed with the @code{quotedEventTypes} property.  The default
583 value is @code{(note-event rest-event)}, which means that only
584 notes and rests of the quoted voice end up in the
585 @code{\quoteDuring}.  Setting
586
587 @example
588 \set Staff.quotedEventTypes =
589        #'(note-event articulation-event dynamic-event)
590 @end example
591
592 @noindent
593 will quote notes (but no rests), together with scripts and
594 dynamics.
595
596 @refbugs
597
598 Only the contents of the first @internalsref{Voice} occurring in
599 an @code{\addQuote} command will be considered for quotation, so
600 @var{music} can not contain @code{\new} and @code{\context Voice}
601 statements that would switch to a different Voice.
602
603 Quoting grace notes is broken and can even cause LilyPond to
604 crash.
605
606 Quoting nested triplets may result in poor notation.
607
608 In earlier versions of LilyPond (pre 2.11), @code{addQuote} was
609 written entirely in lower-case letters: @code{\addquote}.
610
611 @seealso
612
613 Notation Reference: @ref{Instrument transpositions}.
614
615 Snippets: @lsrdir{staff}
616
617 Internals Reference: @internalsref{QuoteMusic}.
618
619
620 @node Formatting cue notes
621 @unnumberedsubsubsec Formatting cue notes
622
623 @cindex cues, formatting
624
625 The previous section deals with inserting notes from another
626 voice.  There is a more advanced music function called
627 @code{\cueDuring}, which makes formatting cue notes easier.
628
629 The syntax is
630
631 @example
632   \cueDuring #@var{name} #@var{updown} @var{music}
633 @end example
634
635 This will insert notes from the part @var{name} into a
636 @internalsref{Voice} called @code{cue}.  This happens
637 simultaneously with @var{music}, which usually is a rest.  When
638 the cue notes start, the staff in effect becomes polyphonic for a
639 moment.  The argument @var{updown} determines whether the cue
640 notes should be notated as a first or second voice.
641
642
643 @lilypond[verbatim,ragged-right]
644 smaller = {
645   \set fontSize = #-2
646   \override Stem #'length-fraction = #0.8
647   \override Beam #'thickness = #0.384
648   \override Beam #'length-fraction = #0.8
649 }
650
651 \addQuote clarinet \relative {
652   R1*20
653   r2 r8 c' f f
654 }
655
656 \new Staff \relative  <<
657
658   % setup a context for cue notes.
659   \new Voice = "cue" { \smaller \skip 1*21 }
660
661   \set Score.skipBars = ##t
662
663   \new Voice {
664     R1*20
665     \cueDuring #"clarinet" #UP {
666       R1
667     }
668     g4 g2.
669   }
670 >>
671 @end lilypond
672
673
674 Here are a couple of hints for successful cue notes
675
676 @itemize
677 @item
678 Cue notes have smaller font sizes.
679
680 @item
681 the cued part is marked with the instrument playing the cue.
682
683 @item
684 when the original part takes over again, this should be marked
685 with the name of the original instrument.
686
687 Any other changes introduced by the cued part should also be
688 undone.  For example, if the cued instrument plays in a different
689 clef, the original clef should be stated once again.
690
691 @end itemize
692
693 The macro @code{\transposedCueDuring} is useful to add cues to
694 instruments which use a completely different octave range (for
695 example, having a cue of a piccolo flute within a contra bassoon
696 part).
697
698 @lilypond[verbatim,ragged-right,quote]
699 picc = \relative c''' {
700   \clef "treble^8"
701   R1 |
702   c8 c c e g2 |
703   a4 g g2 |
704 }
705 \addQuote "picc" { \picc }
706
707 cbsn = \relative c, {
708   \clef "bass_8"
709   c4 r g r
710   \transposedCueDuring #"picc" #UP c,, { R1 } |
711   c4 r g r |
712 }
713
714 <<
715   \context Staff = "picc" \picc
716   \context Staff = "cbsn" \cbsn
717 >>
718 @end lilypond
719
720 @seealso
721
722 Snippets: @lsrdir{staff}
723
724
725
726