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