]> 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 @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 @cindex staves, empty 
253
254 In orchestral scores, staff lines that only have rests are usually
255 removed; this saves some space.  This style is called @q{French
256 Score}.  For @code{Lyrics}, @code{ChordNames} and
257 @code{FiguredBass}, this is switched on by default.  When
258 the lines of these contexts turn out empty after the line-breaking
259 process, they are removed.
260
261 For normal staves, a specialized @code{Staff} context is
262 available, which does the same: staves containing nothing (or only
263 multi-measure rests) are removed.  The context definition is
264 stored in @code{\RemoveEmptyStaffContext} variable.  Observe how
265 the second staff in this example disappears in the second line
266
267 @lilypond[quote,ragged-right,verbatim]
268 \layout {
269   \context { \RemoveEmptyStaffContext }
270 }
271
272 {
273   \relative c' <<
274     \new Staff { e4 f g a \break c1 }
275     \new Staff { c4 d e f \break R1 }
276   >>
277 }
278 @end lilypond
279
280 The first system shows all staves in full.  If empty staves should
281 be removed from the first system too, set @code{remove-first} to
282 true in @code{VerticalAxisGroup}.
283
284 @example
285 \override Score.VerticalAxisGroup #'remove-first = ##t
286 @end example
287
288 To remove other types of contexts, use
289 @code{\AncientRemoveEmptyStaffContext} or
290 @code{\RemoveEmptyRhythmicStaffContext}.
291
292 @cindex ossia
293
294 Another application of the @code{\RemoveEmptyStaffContext} is to
295 make ossia sections, i.e., alternative melodies on a separate
296 piece of staff, with help of a Frenched staff.  See @ref{Staff
297 symbol}. 
298
299 You can make the staff lines invisible by removing the
300 @code{Staff_symbol_engraver} from the @code{Staff} context.
301
302
303 @lilypond[quote,ragged-right,verbatim]
304 \score {
305   \context Staff \relative c'' { c8 c c16 c c c }
306   \layout{
307     \context {
308       \Staff
309       \remove Staff_symbol_engraver
310     }
311   }
312 }
313 @end lilypond
314
315 @seealso
316
317 Notation Reference: @ref{Staff symbol}.
318
319 Snippets: @lsrdir{staff}
320
321 Internals Reference: @internalsref{ChordNames},
322 @internalsref{FiguredBass}, @internalsref{Lyrics},
323 @internalsref{Staff}, @internalsref{VerticalAxisGroup}.
324
325 @node Writing parts
326 @subsection Writing parts
327
328 @menu
329 * Metronome marks::             
330 * Instrument names::            
331 * Quoting other voices::        
332 * Formatting cue notes::        
333 @end menu
334
335 @node Metronome marks
336 @unnumberedsubsubsec Metronome marks
337
338 @cindex Tempo
339 @cindex beats per minute
340 @cindex metronome marking
341
342 Metronome settings can be entered as follows
343
344 @example
345 \tempo @var{duration} = @var{per-minute}
346 @end example
347
348 In the MIDI output, they are interpreted as a tempo change.  In
349 the layout output, a metronome marking is printed
350
351 @funindex \tempo
352
353 @lilypond[quote,ragged-right,verbatim,fragment]
354 \tempo 8.=120 c''1
355 @end lilypond
356
357
358 @commonprop
359
360 To change the tempo in the MIDI output without printing anything,
361 make the metronome marking invisible @example \once \override
362 Score.MetronomeMark #'transparent = ##t @end example
363
364 To print other metronome markings, use these markup commands
365 @lilypond[quote,ragged-right,verbatim,relative,fragment]
366 c4^\markup {
367   (
368   \smaller \general-align #Y #DOWN \note #"16." #1
369   =
370   \smaller \general-align #Y #DOWN \note #"8" #1
371   ) }
372 @end lilypond
373
374 @noindent
375 For more details, see @ref{Text markup}.
376
377
378 @seealso
379
380 Music Glossary: @rglos{metronome}, @rglos{metronomic indication},
381 @rglos{tempo indication}.
382 @c FIXME : add @rglos{Mälzels Metronome}, @rglos{M.M.}, @rglos{tempo}?
383
384 Notation Reference: @ref{Text markup}.
385
386 Snippets: @lsrdir{staff}.
387
388 Internals Reference: @internalsref{MetronomeMark}, @ref{MIDI
389 output}.
390
391
392 @refbugs
393
394 Collisions are not checked.  If you have notes above the top line
395 of the staff (or notes with articulations, slurs, text, etc), then
396 the metronome marking may be printed on top of musical symbols.
397 If this occurs, increase the padding of the metronome mark to
398 place it further away from the staff.
399
400 @example
401 \override Score.MetronomeMark #'padding = #2.5
402 @end example
403
404 @c perhaps also an example of how to move it horizontally?
405
406
407 @node Instrument names
408 @unnumberedsubsubsec Instrument names
409
410 In an orchestral score, instrument names are printed at the left
411 side of the staves.
412
413 This can be achieved by setting
414 @internalsref{Staff}.@code{instrumentName} and
415 @internalsref{Staff}.@code{shortInstrumentName}, or
416 @internalsref{PianoStaff}.@code{instrumentName} and
417 @internalsref{PianoStaff}.@code{shortInstrumentName}.  This will
418 print text before the start of the staff.  For the first staff,
419 @code{instrumentName} is used.  If set, @code{shortInstrumentName}
420 is used for the following staves.
421
422 @lilypond[quote,verbatim,ragged-right,relative=1,fragment]
423 \set Staff.instrumentName = "Ploink "
424 \set Staff.shortInstrumentName = "Plk "
425 c1
426 \break
427 c''
428 @end lilypond
429
430 You can also use markup texts to construct more complicated
431 instrument names, for example
432
433 @lilypond[quote,fragment,verbatim,ragged-right]
434 \set Staff.instrumentName = \markup {
435   \column { "Clarinetti"
436             \line { "in B" \smaller \flat } } }
437 c''1
438 @end lilypond
439
440 If you wish to center the instrument names, you must center all of
441 them individually:
442
443 @lilypond[quote,verbatim,ragged-right]
444 { <<
445 \new Staff {
446   \set Staff.instrumentName = \markup {
447     \center-align { "Clarinetti"
448       \line { "in B" \smaller \flat } } }
449   c''1
450 }
451 \new Staff {
452   \set Staff.instrumentName =
453        \markup{ \center-align { Vibraphone }}
454   c''1
455 }
456 >>
457 }
458 @end lilypond
459
460 For longer instrument names, it may be useful to increase the
461 @code{indent} setting in the @code{\layout} block.
462
463 To center instrument names while leaving extra space to the right,
464
465 @lilypond[quote,verbatim,ragged-right]
466 \new StaffGroup \relative
467 <<
468   \new Staff {
469     \set Staff.instrumentName =
470         \markup { \hcenter-in #10 "blabla" }
471     c1 c1
472   }
473   \new Staff {
474     \set Staff.instrumentName =
475          \markup { \hcenter-in #10 "blo" }
476     c1 c1
477   }
478 >>
479 @end lilypond
480
481 To add instrument names to other contexts (such as
482 @code{GrandStaff}, @code{ChoirStaff}, or @code{StaffGroup}), the
483 engraver must be added to that context.
484
485 @example
486 \layout@{
487   \context @{\GrandStaff \consists "Instrument_name_engraver"@}
488 @}
489 @end example
490
491 @noindent
492 More information about adding and removing engravers can be found
493 in @ref{Modifying context plug-ins}.
494
495 Instrument names may be changed in the middle of a piece,
496
497 @lilypond[quote,fragment,verbatim,ragged-right]
498 \set Staff.instrumentName = "First"
499 \set Staff.shortInstrumentName = "one"
500 c1 c c c \break
501 c1 c c c \break
502 \set Staff.instrumentName = "Second"
503 \set Staff.shortInstrumentName = "two"
504 c1 c c c \break
505 c1 c c c \break
506 @end lilypond
507
508
509 @seealso
510
511 Snippets: @lsrdir{staff}
512
513 Internals Reference: @internalsref{InstrumentName}.
514
515
516 @node Quoting other voices
517 @unnumberedsubsubsec Quoting other voices
518
519 @cindex cues
520
521 With quotations, fragments of other parts can be inserted into a
522 part directly.  Before a part can be quoted, it must be marked
523 especially as quotable.  This is done with the @code{\addQuote}
524 command.
525
526 @example
527 \addQuote @var{name} @var{music}
528 @end example
529
530
531 @noindent
532 Here, @var{name} is an identifying string.  The @var{music} is any
533 kind of music.  Here is an example of @code{\addQuote}
534
535 @example
536 \addQuote clarinet \relative c' @{
537   f4 fis g gis
538 @}
539 @end example
540
541 This command must be entered at toplevel, i.e., outside any music
542 blocks.  Typically, one would use an already defined music event
543 as the @var{music}:
544
545 @example
546 clarinet = \relative c' @{
547   f4 fis g gis
548 @}
549 \addQuote clarinet @{ \clarinet @}
550 @end example
551
552
553 After calling @code{\addQuote}, the quotation may then be done
554 with @code{\quoteDuring} or @code{\cueDuring},
555
556 @example
557 \quoteDuring #@var{name} @var{music}
558 @end example
559
560 During a part, a piece of music can be quoted with the
561 @code{\quoteDuring} command.
562
563 @example
564 \quoteDuring #"clarinet" @{ s2. @}
565 @end example
566
567 This would cite three quarter notes (the duration of @code{s2.})
568 of the previously added @code{clarinet} voice.
569
570 More precisely, it takes the current time-step of the part being
571 printed, and extracts the notes at the corresponding point of the
572 @code{\addQuote}d voice.  Therefore, the argument to
573 @code{\addQuote} should be the entire part of the voice to be
574 quoted, including any rests at the beginning.
575
576 It is possible to use another music expression instead of
577 @code{s}, thus creating a polyphonic section, but this may not
578 always give the desired result.
579
580 Quotations take into account the transposition of both source and
581 target instruments, if they are specified using the
582 @code{\transposition} command.
583
584 @lilypond[quote,ragged-right,verbatim]
585 \addQuote clarinet \relative c' {
586   \transposition bes
587   f4 fis g gis
588 }
589
590 {
591   e'8 f'8 \quoteDuring #"clarinet" { s2 }
592 }
593 @end lilypond
594
595 The type of events that are present in the quoted music can be
596 trimmed with the @code{quotedEventTypes} property.  The default
597 value is @code{(note-event rest-event)}, which means that only
598 notes and rests of the quoted voice end up in the
599 @code{\quoteDuring}.  Setting
600
601 @example
602 \set Staff.quotedEventTypes =
603        #'(note-event articulation-event dynamic-event)
604 @end example
605
606 @noindent
607 will quote notes (but no rests), together with scripts and
608 dynamics.
609
610 @refbugs
611
612 Only the contents of the first @internalsref{Voice} occurring in
613 an @code{\addQuote} command will be considered for quotation, so
614 @var{music} can not contain @code{\new} and @code{\context Voice}
615 statements that would switch to a different Voice.
616
617 Quoting grace notes is broken and can even cause LilyPond to
618 crash.
619
620 Quoting nested triplets may result in poor notation.
621
622 In earlier versions of LilyPond (pre 2.11), @code{addQuote} was
623 written entirely in lower-case letters: @code{\addquote}.
624
625 @seealso
626
627 Notation Reference: @ref{Instrument transpositions}.
628
629 Snippets: @lsrdir{staff}
630
631 Internals Reference: @internalsref{QuoteMusic}.
632
633
634 @node Formatting cue notes
635 @unnumberedsubsubsec Formatting cue notes
636
637 @cindex cues, formatting
638
639 The previous section deals with inserting notes from another
640 voice.  There is a more advanced music function called
641 @code{\cueDuring}, which makes formatting cue notes easier.
642
643 The syntax is
644
645 @example
646   \cueDuring #@var{name} #@var{updown} @var{music}
647 @end example
648
649 This will insert notes from the part @var{name} into a
650 @internalsref{Voice} called @code{cue}.  This happens
651 simultaneously with @var{music}, which usually is a rest.  When
652 the cue notes start, the staff in effect becomes polyphonic for a
653 moment.  The argument @var{updown} determines whether the cue
654 notes should be notated as a first or second voice.
655
656
657 @lilypond[verbatim,ragged-right]
658 smaller = {
659   \set fontSize = #-2
660   \override Stem #'length-fraction = #0.8
661   \override Beam #'thickness = #0.384
662   \override Beam #'length-fraction = #0.8
663 }
664
665 \addQuote clarinet \relative {
666   R1*20
667   r2 r8 c' f f
668 }
669
670 \new Staff \relative  <<
671
672   % setup a context for cue notes.
673   \new Voice = "cue" { \smaller \skip 1*21 }
674
675   \set Score.skipBars = ##t
676
677   \new Voice {
678     R1*20
679     \cueDuring #"clarinet" #UP {
680       R1
681     }
682     g4 g2.
683   }
684 >>
685 @end lilypond
686
687
688 Here are a couple of hints for successful cue notes
689
690 @itemize
691 @item
692 Cue notes have smaller font sizes.
693
694 @item
695 the cued part is marked with the instrument playing the cue.
696
697 @item
698 when the original part takes over again, this should be marked
699 with the name of the original instrument.
700
701 Any other changes introduced by the cued part should also be
702 undone.  For example, if the cued instrument plays in a different
703 clef, the original clef should be stated once again.
704
705 @end itemize
706
707 The macro @code{\transposedCueDuring} is useful to add cues to
708 instruments which use a completely different octave range (for
709 example, having a cue of a piccolo flute within a contra bassoon
710 part).
711
712 @lilypond[verbatim,ragged-right,quote]
713 picc = \relative c''' {
714   \clef "treble^8"
715   R1 |
716   c8 c c e g2 |
717   a4 g g2 |
718 }
719 \addQuote "picc" { \picc }
720
721 cbsn = \relative c, {
722   \clef "bass_8"
723   c4 r g r
724   \transposedCueDuring #"picc" #UP c,, { R1 } |
725   c4 r g r |
726 }
727
728 <<
729   \context Staff = "picc" \picc
730   \context Staff = "cbsn" \cbsn
731 >>
732 @end lilypond
733
734 @seealso
735
736 Snippets: @lsrdir{staff}
737
738
739
740