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