]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/basic-notation.itely
Assorted minor mostly one-line clarifications.
[lilypond.git] / Documentation / user / basic-notation.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
3
4 @c A menu is needed before every deeper *section nesting of @node's; run
5 @c     M-x texinfo-all-menus-update
6 @c to automatically fill in these menus before saving changes
7
8 @node Basic notation
9 @chapter Basic notation
10
11 This chapter explains how to use basic notation features.
12
13 @menu
14 * Pitches::                     
15 * Rhythms::                     
16 * Multiple notes at once::      
17 * Staff notation::              
18 * Connecting notes::            
19 * Expressive marks::            
20 * Repeats::                     
21 @end menu
22
23
24
25 @node Pitches
26 @section Pitches
27
28 This section discusses how to specify the pitch of notes.
29
30 @menu
31 * Normal pitches::              
32 * Accidentals::                 
33 * Cautionary accidentals::      
34 * Micro tones::                 
35 * Notes names in other languages::  
36 * Relative octaves::            
37 * Octave check::                
38 * Transpose::                   
39 * Rests::                       
40 * Skips::                       
41 @end menu
42
43
44 @node Normal pitches
45 @subsection Normal pitches
46
47 @cindex Pitch names
48 @cindex pitches
49
50 A pitch name is specified using lowercase letters @code{a} through @code{g}.
51 An ascending C-major scale is engraved with
52
53 @lilypond[quote,fragment,verbatim,ragged-right]
54 \clef bass
55 c d e f g a b c'
56 @end lilypond
57
58 The note name @code{c} is engraved one octave below middle C.
59
60 @lilypond[quote,fragment,verbatim,ragged-right]
61 \clef treble
62 c1
63 \clef bass
64 c1
65 @end lilypond
66
67 @funindex '
68 @funindex ,
69
70 The optional octave specification takes the form of a series of
71 single quote (`@code{'}') characters or a series of comma
72 (`@code{,}') characters.  Each @code{'} raises the pitch by one
73 octave; each @code{,} lowers the pitch by an octave.
74
75 @lilypond[quote,ragged-right,fragment,verbatim]
76 \clef treble
77 c' c'' e' g d'' d' d c
78 \clef bass
79 c, c,, e, g d,, d, d c
80 @end lilypond
81
82 An alternate method may be used to declare which octave to
83 engrave a pitch; this method does not require as many
84 octave specifications (@code{'} and @code{,}).  See
85 @ref{Relative octaves}.
86
87
88 @node Accidentals
89 @subsection Accidentals
90
91 @cindex note names, Dutch
92 @cindex note names, default
93
94 A sharp is formed by adding @code{-is} to the end of a pitch name and
95 a flat is formed by adding @code{-es}.  Double sharps and double flats
96 are obtained by adding @code{-isis} or @code{-eses} to a note name.
97
98 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
99 a2 ais a aes
100 a2 aisis a aeses
101 @end lilypond
102
103 @noindent
104 These are the Dutch note names.  In Dutch, @code{aes} is contracted to
105 @code{as}, but both forms are accepted.  Similarly, both
106 @code{es} and @code{ees} are accepted
107
108 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
109 a2 as e es
110 @end lilypond
111
112 A natural will cancel the effect of an accidental or key signature.
113 However, naturals are not encoded into the note name syntax with a
114 suffix; a natural pitch is shown as a simple note name
115
116 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
117 a4 aes a2
118 @end lilypond
119
120 The input @code{d e f} is interpreted as ``print a D-natural,
121 E-natural, and an F-natural,'' regardless of the key
122 signature.  For more information about the distinction between
123 musical content and the presentation of that content, see
124 @ref{More about pitches}.
125
126 @lilypond[fragment,quote,ragged-right,verbatim,relative]
127 \key d \major
128 d e f g
129 d e fis g
130 @end lilypond
131
132
133 @commonprop
134
135 In accordance with standard typesetting rules, a natural sign is printed
136 before a sharp or flat if a previous accidental needs to be
137 cancelled.  To change this behavior, use
138 @code{\set Staff.extraNatural = ##f}
139
140 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
141 ceses4 ces cis c
142 \set Staff.extraNatural = ##f
143 ceses4 ces cis c
144 @end lilypond
145
146
147 @seealso
148
149 Program reference: @internalsref{LedgerLineSpanner},
150 @internalsref{NoteHead}.
151
152
153 @node Cautionary accidentals
154 @subsection Cautionary accidentals
155
156 @cindex accidental, reminder
157 @cindex accidental, cautionary
158 @cindex accidental, parenthesized
159 @cindex reminder accidental
160 @funindex ?
161 @cindex cautionary accidental
162 @cindex parenthesized accidental
163 @funindex !
164
165 Normally accidentals are printed automatically, but you may also
166 print them manually.  A reminder accidental
167 can be forced by adding an exclamation mark @code{!}
168 after the pitch.  A cautionary accidental
169 (i.e., an accidental within parentheses) can be obtained by adding the
170 question mark `@code{?}' after the pitch.  These extra accidentals
171 can be used to produce natural signs, too.
172
173 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
174 cis cis cis! cis? c c? c! c
175 @end lilypond
176
177
178 @seealso
179
180 The automatic production of accidentals can be tuned in many
181 ways.  For more information, see @ref{Automatic accidentals}.
182
183
184 @node Micro tones
185 @subsection Micro tones
186
187 @cindex quarter tones
188 @cindex semi-flats, semi-sharps
189
190 Half-flats and half-sharps are formed by adding @code{-eh} and
191 @code{-ih}; the following is a series of Cs with increasing pitches
192
193 @lilypond[verbatim,ragged-right,quote,relative=2,fragment]
194 \set Staff.extraNatural = ##f
195 ceseh ceh cih cisih
196 @end lilypond
197
198 Micro tones are also exported to the MIDI file.
199
200
201 @refbugs
202
203 There are no generally accepted standards for denoting
204 three-quarter flats, so LilyPond's symbol does not conform to any
205 standard.
206
207
208 @node Notes names in other languages
209 @subsection Notes names in other languages
210
211 There are predefined sets of note names for various other languages.
212 To use them, include the language specific init file.  For
213 example, add @code{\include "english.ly"} to the top of the input
214 file.  The available language files
215 and the note names they define are
216
217 @c  what about micro-tunes, double-sharps, and double-flats?  add
218 @c  more columns to the table?
219 @c  Oh, and should this be made into a multitable?
220 @cindex note names, other languages
221 @example
222                         Note Names               sharp       flat
223 nederlands.ly  c   d   e   f   g   a   bes b   -is         -es
224 english.ly     c   d   e   f   g   a   bf  b   -s/-sharp   -f/-flat
225                                                -x (double)
226 deutsch.ly     c   d   e   f   g   a   b   h   -is         -es
227 norsk.ly       c   d   e   f   g   a   b   h   -iss/-is    -ess/-es
228 svenska.ly     c   d   e   f   g   a   b   h   -iss        -ess
229 italiano.ly    do  re  mi  fa  sol la  sib si  -d          -b
230 catalan.ly     do  re  mi  fa  sol la  sib si  -d/-s       -b
231 espanol.ly     do  re  mi  fa  sol la  sib si  -s          -b
232 @end example
233
234
235 @node Relative octaves
236 @subsection Relative octaves
237
238 @cindex Relative
239 @cindex Relative octave specification
240 @funindex \relative
241
242 Octaves are specified by adding @code{'} and @code{,} to pitch names.
243 When you copy existing music, it is easy to accidentally put a pitch
244 in the wrong octave and hard to find such an error.  The relative
245 octave mode prevents these errors by making the mistakes much
246 larger: a single error puts the rest of the piece off by one octave
247
248 @example
249 \relative @var{startpitch} @var{musicexpr}
250 @end example
251
252 @noindent
253 or
254
255 @example
256 \relative @var{musicexpr}
257 @end example
258
259 @noindent
260 @code{c'} is used as the default if no starting pitch is defined.
261
262 The octave of notes that appear in @var{musicexpr} are calculated as
263 follows: if no octave changing marks are used, the basic interval
264 between this and the last note is always taken to be a fourth or
265 less.  This distance is determined without regarding alterations; a
266 @code{fisis} following a @code{ceses} will be put above the
267 @code{ceses}.  In other words, a doubly-augmented fourth is considered
268 a smaller interval than a diminished fifth, even though the
269 doubly-augmented fourth spans seven semitones while the diminished
270 fifth only spans six semitones.
271
272 The octave changing marks @code{'} and @code{,} can be added to raise
273 or lower the pitch by an extra octave.  Upon entering relative mode,
274 an absolute starting pitch can be specified that will act as the
275 predecessor of the first note of @var{musicexpr}.  If no starting pitch
276 is specified, then middle C is used as a start.
277
278 Here is the relative mode shown in action
279 @lilypond[quote,fragment,ragged-right,verbatim]
280 \relative c'' {
281   b c d c b c bes a
282 }
283 @end lilypond
284
285 Octave changing marks are used for intervals greater than a fourth
286
287 @lilypond[quote,ragged-right,fragment,verbatim]
288 \relative c'' {
289   c g c f, c' a, e''
290 }
291 @end lilypond
292
293 If the preceding item is a chord, the first note of the chord is used
294 to determine the first note of the next chord
295
296 @lilypond[quote,ragged-right,fragment,verbatim]
297 \relative c' {
298   c <c e g>
299   <c' e g>
300   <c, e' g>
301 }
302 @end lilypond
303
304 The pitch after @code{\relative} contains a note name.
305
306 The relative conversion will not affect @code{\transpose},
307 @code{\chordmode} or @code{\relative} sections in its argument.  To use
308 relative within transposed music, an additional @code{\relative} must
309 be placed inside @code{\transpose}.
310
311
312 @node Octave check
313 @subsection Octave check
314
315 @cindex Octave check
316
317 Octave checks make octave errors easier to correct: a note may be
318 followed by @code{=}@var{quotes} which indicates what its absolute
319 octave should be.  In the following example,
320
321 @example
322 \relative c'' @{ c='' b=' d,='' @}
323 @end example
324
325 @noindent
326 the @code{d} will generate a warning, because a @code{d''} is expected
327 (because @code{b'} to @code{d''} is only a third), but a @code{d'} is
328 found.  In the output, the octave is corrected to be a @code{d''} and
329 the next note is calculated relative to @code{d''} instead of @code{d'}.
330
331 There is also an octave check that produces no visible output.  The syntax
332
333 @example
334 \octave @var{pitch}
335 @end example
336
337 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
338 quotes) in @code{\relative} mode compared to the note given in the
339 @code{\relative} command.  If not, a warning is printed, and the
340 octave is corrected.  The @var{pitch} is not printed as a note.
341
342 In the example below, the first check passes without incident, since
343 the @code{e} (in @code{relative} mode) is within a fifth of
344 @code{a'}.  However,
345 the second check produces a warning, since the @code{e} is not within
346 a fifth of @code{b'}.  The warning message is printed, and the octave
347 is adjusted so that the following notes are in the correct octave
348 once again.
349
350 @example
351 \relative c' @{
352   e
353   \octave a'
354   \octave b'
355 @}
356 @end example
357
358
359 The octave of a note following an octave check is determined with
360 respect to the note preceding it.  In the next fragment, the last note
361 is an @code{a'}, above middle C.  That means that the @code{\octave}
362 check passes successfully, so the check could be deleted without changing
363 the output of the piece.
364
365 @lilypond[quote,ragged-right,verbatim,fragment]
366 \relative c' {
367   e
368   \octave b
369   a
370 }
371 @end lilypond
372
373
374 @node Transpose
375 @subsection Transpose
376
377 @cindex Transpose
378 @cindex Transposition of pitches
379 @funindex \transpose
380
381 A music expression can be transposed with @code{\transpose}.  The
382 syntax is
383 @example
384 \transpose @var{from} @var{to} @var{musicexpr}
385 @end example
386
387 This means that @var{musicexpr} is transposed by the interval between
388 the pitches @var{from} and @var{to}: any note with pitch @code{from}
389 is changed to @code{to}.
390
391 For example, consider a piece written in the key of D-major.  If
392 this piece is a little too low for its performer, it can be
393 transposed up to E-major with
394 @example
395 \transpose d e @dots{}
396 @end example
397
398 Consider a part written for violin (a C instrument).  If
399 this part is to be played on the A clarinet (for which an
400 A is notated as a C, and which sounds a minor third lower
401 than notated), the following
402 transposition will produce the appropriate part
403
404 @example
405 \transpose a c @dots{}
406 @end example
407
408 @code{\transpose} distinguishes between enharmonic pitches: both
409 @code{\transpose c cis} or @code{\transpose c des} will transpose up
410 half a tone.  The first version will print sharps and the second
411 version will print flats
412
413 @lilypond[quote,ragged-right,verbatim]
414 mus = { \key d \major cis d fis g }
415 \new Staff {
416   \clef "F" \mus
417   \clef "G"
418   \transpose c g' \mus
419   \transpose c f' \mus
420 }
421 @end lilypond
422
423 @code{\transpose} may also be used to input written notes for a
424 transposing instrument.  Pitches are normally entered into LilyPond
425 in C (or ``concert pitch''), but they may be entered in another
426 key.  For example, when entering music for a B-flat trumpet which
427 begins on concert D, one would write
428
429 @example
430 \transpose c bes @{ e4 @dots{} @}
431 @end example
432
433 To print this music in B-flat again (i.e., producing a trumpet part,
434 instead of a concert pitch conductor's score) you would wrap the
435 existing music with another @code{transpose}
436
437 @example
438 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
439 @end example
440
441
442 @seealso
443
444 Program reference: @internalsref{TransposedMusic}.
445
446 Example: @inputfileref{input/@/test,smart@/-transpose@/.ly}.
447
448
449 @refbugs
450
451 If you want to use both @code{\transpose} and @code{\relative},
452 you must put @code{\transpose} outside of @code{\relative}, since
453 @code{\relative} will have no effect on music that appears inside a
454 @code{\transpose}.
455
456
457 @node Rests
458 @subsection Rests
459 @cindex Rests
460
461 @funindex \rest
462 @funindex r
463
464 Rests are entered like notes with the note name @code{r}
465
466 @lilypond[fragment,quote,ragged-right,verbatim]
467 r1 r2 r4 r8
468 @end lilypond
469
470 Whole bar rests, centered in middle of the bar,
471 must be done with multi-measure rests.  They can be used for a
472 single bar as well as many bars, and are discussed in
473 @ref{Multi measure rests}.
474
475 To explicitly specify a rest's vertical position, write a note
476 followed by @code{\rest}.  A rest will be placed in the position
477 where the note would appear,
478
479 @lilypond[fragment,quote,ragged-right,verbatim]
480 a'4\rest d'4\rest
481 @end lilypond
482
483 @noindent
484 This makes manual formatting of
485 polyphonic music much easier, since the automatic rest collision
486 formatter will leave these rests alone.
487
488 @seealso
489
490 Program reference: @internalsref{Rest}.
491
492
493 @node Skips
494 @subsection Skips
495
496 @cindex Skip
497 @cindex Invisible rest
498 @cindex Space note
499 @funindex \skip
500 @funindex s
501
502 An invisible rest (also called a `skip') can be entered like a note
503 with note name `@code{s}' or with @code{\skip @var{duration}}
504
505 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
506 a4 a4 s4 a4 \skip 1 a4
507 @end lilypond
508
509 The @code{s} syntax is only available in note mode and chord mode.  In
510 other situations, for example, when entering lyrics, you should use
511 the @code{\skip} command
512
513 @lilypond[quote,ragged-right,verbatim]
514 <<
515   \relative { a'2 a2 }
516   \new Lyrics \lyricmode { \skip 2 bla2 }
517 >>
518 @end lilypond
519
520 The skip command is merely an empty musical placeholder.  It does not
521 produce any output, not even transparent output.
522
523 The @code{s} skip command does create @internalsref{Staff} and
524 @internalsref{Voice} when necessary, similar to note and rest
525 commands.  For example, the following results in an empty staff.
526
527 @lilypond[quote,ragged-right,verbatim]
528 { s4 }
529 @end lilypond
530
531 The fragment @code{@{ \skip 4 @} } would produce an empty page.
532
533 @seealso
534
535 Program reference: @internalsref{SkipMusic}.
536
537
538
539 @node Rhythms
540 @section Rhythms
541
542 This section discusses rhythms, durations, and bars.
543
544 @menu
545 * Durations::                   
546 * Augmentation dots::           
547 * Tuplets::                     
548 * Scaling durations::           
549 * Bar check::                   
550 * Barnumber check::             
551 * Automatic note splitting::    
552 @end menu
553
554
555 @node Durations
556 @subsection Durations
557
558 @cindex duration
559 @funindex \longa
560 @funindex \breve
561 @funindex \maxima
562
563 In Note, Chord, and Lyrics mode, durations are designated by numbers and
564 dots: durations are entered as their reciprocal values.  For example, a
565 quarter note is entered using a @code{4} (since it is a 1/4 note), while
566 a half note is entered using a @code{2} (since it is a 1/2 note).  For
567 notes longer than a whole you must use the @code{\longa} and
568 @code{\breve} commands
569
570 @example
571 c'\breve
572 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
573 r\longa r\breve
574 r1 r2 r4 r8 r16 r32 r64 r64
575 @end example
576
577 @lilypond[quote]
578 \score {
579 \relative c'' {
580     a\breve*1/2 \autoBeamOff
581     a1 a2 a4 a8 a16 a32 a64 a64
582    \bar "empty"
583    \break
584     r\longa*1/4 r\breve *1/2
585     r1 r2 r4 r8 r16 r32 r64 r64
586   }
587   \layout {
588     ragged-right = ##t
589     indent=0\mm
590     \context {
591       \Score
592         \remove "Bar_number_engraver"
593     }
594     \context {
595       \Staff
596         \remove "Clef_engraver"
597         \override StaffSymbol #'transparent = ##t
598         \override TimeSignature #'transparent = ##t
599         \override BarLine #'transparent = ##t
600         \consists "Pitch_squash_engraver"
601     }
602   }
603 }
604 @end lilypond
605
606 If the duration is omitted then it is set to the previously entered
607 duration.  The default for the first note is a quarter note.
608
609 @lilypond[quote,ragged-right,verbatim,fragment]
610 { a a a2 a a4 a a1 a }
611 @end lilypond
612
613
614 @node Augmentation dots
615 @subsection Augmentation dots
616
617 @funindex .
618
619 To obtain dotted note lengths, simply add a dot (`@code{.}') to
620 the number.  Double-dotted notes are produced in a similar way.
621
622 @lilypond[quote,ragged-right,fragment,verbatim]
623 a'4 b' c''4. b'8 a'4. b'4.. c''8.
624 @end lilypond
625
626 @refcommands
627
628 Dots are normally moved up to avoid staff lines, except in polyphonic
629 situations.  The following commands may be used to force a particular
630 direction manually
631
632 @funindex \dotsUp
633 @code{\dotsUp},
634 @funindex \dotsDown
635 @code{\dotsDown},
636 @funindex \dotsNeutral
637 @code{\dotsNeutral}.
638
639 @seealso
640
641 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}.
642
643
644 @node Tuplets
645 @subsection Tuplets
646
647 @cindex tuplets
648 @cindex triplets
649 @funindex \times
650
651 Tuplets are made out of a music expression by multiplying all durations
652 with a fraction
653
654 @example
655 \times @var{fraction} @var{musicexpr}
656 @end example
657
658 @noindent
659 The duration of @var{musicexpr} will be multiplied by the fraction.
660 The fraction's denominator will be printed over the notes, optionally
661 with a bracket.  The most common tuplet is the triplet in which 3
662 notes have the length of 2, so the notes are 2/3 of their written
663 length
664
665 @lilypond[quote,ragged-right,fragment,verbatim]
666 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
667 @end lilypond
668
669 Tuplets may be nested, for example,
670
671 @lilypond[fragment,ragged-right,verbatim,relative=2]
672 \override TupletNumber #'text = #tuplet-number::calc-fraction-text
673 \times 4/6 {
674   a4 a
675   \times 3/5 { a a a a a }
676 }
677 @end lilypond
678
679 @refcommands
680
681 @funindex \tupletUp
682 @code{\tupletUp},
683 @funindex \tupletDown
684 @code{\tupletDown},
685 @funindex \tupletNeutral
686 @code{\tupletNeutral}.
687
688
689 @commonprop
690
691 @funindex tupletNumberFormatFunction
692 @cindex tuplet formatting
693
694 The property @code{tupletSpannerDuration} specifies how long each
695 bracket should last.  With this, you can make lots of tuplets while
696 typing @code{\times} only once, thus saving lots of typing.  In the next
697 example, there are two triplets shown, while @code{\times} was only
698 used once
699
700 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
701 \set tupletSpannerDuration = #(ly:make-moment 1 4)
702 \times 2/3 { c8 c c c c c }
703 @end lilypond
704
705 @noindent
706 For more information about @code{make-moment}, see
707 @ref{Time administration}.
708
709 The format of the number is determined by the property @code{text} in
710 @code{TupletNumber}.  The default prints only the denominator, but if
711 it is set to the function @code{tuplet-number::calc-fraction-text},
712 @var{num}:@var{den} will be printed instead.
713
714 To avoid printing tuplet numbers, use
715
716 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
717 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
718 \override TupletNumber #'transparent = ##t
719 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
720 @end lilypond
721
722
723 @seealso
724
725 Program reference: @internalsref{TupletBracket},
726 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
727
728 Examples: @inputfileref{input/@/regression,tuplet@/-nest@/.ly}.
729
730
731
732 @node Scaling durations
733 @subsection Scaling durations
734
735 You can alter the length of duration by a fraction @var{N/M}
736 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}).  This
737 will not affect the appearance of the notes or rests produced.
738
739 In the following example, the first three notes take up exactly two
740 beats, but no triplet bracket is printed.
741 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
742 \time 2/4
743 a4*2/3 gis4*2/3 a4*2/3
744 a4 a4 a4*2
745 b16*4 c4
746 @end lilypond
747
748
749 @seealso
750
751 This manual: @ref{Tuplets}
752
753
754 @node Bar check
755 @subsection Bar check
756
757 @cindex Bar check
758 @funindex barCheckSynchronize
759 @funindex |
760
761 Bar checks help detect errors in the durations.  A bar check is
762 entered using the bar symbol, `@code{|}'.  Whenever it is encountered
763 during interpretation, it should fall on a measure boundary.  If it
764 does not, a warning is printed.  In the next example, the second bar
765 check will signal an error
766 @example
767 \time 3/4 c2 e4 | g2 |
768 @end example
769
770 Bar checks can also be used in lyrics, for example
771
772 @example
773 \lyricmode @{
774   \time 2/4
775   Twin -- kle | Twin -- kle
776 @}
777 @end example
778
779 Failed bar checks are caused by entering incorrect
780 durations.  Incorrect durations often completely garble up the score,
781 especially if the score is polyphonic, so a good place to start correcting
782 input is by scanning for failed bar checks and incorrect durations.
783
784 @funindex |
785 @funindex pipeSymbol
786
787 It is also possible to redefine the meaning of @code{|}.  This is done
788 by assigning a music expression to @code{pipeSymbol},
789
790 @lilypond[quote,ragged-right,verbatim]
791 pipeSymbol = \bar "||"
792
793 { c'2 c' | c'2 c' }
794 @end lilypond
795
796
797 @node Barnumber check
798 @subsection Barnumber check
799
800 When copying large pieces of music, it can be helpful to check that
801 the LilyPond bar number corresponds to the original that you are
802 entering from.  This can be checked with @code{\barNumberCheck}, for
803 example,
804
805 @verbatim
806 \barNumberCheck #123
807 @end verbatim
808
809 @noindent
810 will print a warning if the @code{currentBarNumber} is not 123 when it
811 is processed.
812
813
814 @node Automatic note splitting
815 @subsection Automatic note splitting
816
817 Long notes can be converted automatically to tied notes.  This is done
818 by replacing the @internalsref{Note_heads_engraver} by the
819 @internalsref{Completion_heads_engraver}.
820 In the following examples, notes crossing the bar line are split and tied.
821
822 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
823 \new Voice \with {
824   \remove "Note_heads_engraver"
825   \consists "Completion_heads_engraver"
826 } {
827   c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
828 }
829 @end lilypond
830
831 This engraver splits all running notes at the bar line, and inserts
832 ties.  One of its uses is to debug complex scores: if the measures are
833 not entirely filled, then the ties exactly show how much each measure
834 is off.
835
836
837 @refbugs
838
839 Not all durations (especially those containing tuplets) can be
840 represented exactly with normal notes and dots, but the engraver will
841 not insert tuplets.
842
843 @code{Completion_heads_engraver} only affects notes; it does not split
844 rests.
845
846
847 @seealso
848
849 Examples: @inputfileref{input/@/regression,completion@/-heads@/.ly}.
850
851 @noindent
852
853 Program reference: @internalsref{Completion_heads_engraver}.
854
855
856 @node Multiple notes at once
857 @section Multiple notes at once
858
859 Polyphony in music refers to having more than one voice occurring in
860 a piece of music.  Polyphony in LilyPond refers to having more than
861 one voice on the same staff.
862
863 @menu
864 * Chords::                      
865 * Stems::                       
866 * Basic polyphony::             
867 * Explicitly instantiating voices::  
868 * Collision Resolution::        
869 @end menu
870
871
872 @node Chords
873 @subsection Chords
874
875 @cindex Chords
876
877 A chord is formed by a enclosing a set of pitches between @code{<}
878 and @code{>}.  A chord may be followed by a duration, and a set of
879 articulations, just like simple notes
880
881 @lilypond[verbatim,ragged-right,fragment,quote,relative=1]
882 <c e g>4 <c>8
883 @end lilypond
884
885 For more information about chords, see @ref{Chord names}.
886
887
888 @node Stems
889 @subsection Stems
890
891 Whenever a note is found, a @internalsref{Stem} object is created
892 automatically.  For whole notes and rests, they are also created but
893 made invisible.
894
895 @refcommands
896
897 @funindex \stemUp
898 @code{\stemUp},
899 @funindex \stemDown
900 @code{\stemDown},
901 @funindex \stemNeutral
902 @code{\stemNeutral}.
903
904
905 @commonprop
906
907 To change the direction of stems in the middle of the staff, use
908
909 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
910 a4 b c b
911 \override Stem #'neutral-direction = #up
912 a4 b c b
913 \override Stem #'neutral-direction = #down
914 a4 b c b
915 @end lilypond
916
917
918 @node Basic polyphony
919 @subsection Basic polyphony
920
921 @cindex polyphony
922
923 The easiest way to enter fragments with more than one voice on a staff
924 is to enter each voice as a sequence (with @code{@{...@}}), and combine
925 them simultaneously, separating the voices with @code{\\}
926
927 @funindex \\
928
929 @lilypond[quote,verbatim,fragment]
930 \new Staff \relative c' {
931   c16 d e f
932   <<
933     { g4 f e | d2 e2 } \\
934     { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
935     { s2. | s4 b4 c2 }
936   >>
937 }
938 @end lilypond
939
940 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
941 voices are sometimes called ``layers'' in other notation packages}
942 @cindex layers
943 to be instantiated.  They bear the names @code{"1"}, @code{"2"}, etc.  In
944 each of these contexts, vertical direction of slurs, stems, etc., is set
945 appropriately.
946
947 These voices are all separate from the voice that contains the notes just
948 outside the @code{<< \\ >>} construct.  This should be noted when making
949 changes at the voice level.  This also means that slurs and ties cannot go
950 into or out of a @code{<< \\ >>} construct.  Conversely, parallel voices
951 from separate @code{<< \\ >>} constructs on the same staff are the the
952 same voice.  Here is the same example, with different noteheads for each
953 voice.  Note that the change to the note-head style in the main voice does
954 not affect
955 the inside of the @code{<< \\ >>} constructs.  Also, the change to the
956 second
957 voice in the first @code{<< \\ >>} construct is effective in the second
958 @code{<< \\ >>}, and the voice is tied across the two constructs.
959
960 @cindex note heads, styles
961
962 @lilypond[quote,verbatim,fragment]
963 \new Staff \relative c' {
964   \override NoteHead #'style = #'cross
965   c16 d e f
966   <<
967     { g4 f e } \\
968     { \override NoteHead #'style = #'triangle
969     r8 e4 d c8 ~ }
970   >> |
971   <<
972     { d2 e2 } \\
973     { c8 b16 a b8 g ~ g2 } \\
974     { \override NoteHead #'style = #'slash s4 b4 c2 }
975   >>
976 }
977 @end lilypond
978
979 Polyphony does not change the relationship of notes within a
980 @code{\relative @{ @}} block.  Each note is calculated relative
981 to the note immediately preceding it.
982
983 @example
984 \relative @{ noteA << noteB \\ noteC >> noteD @}
985 @end example
986
987 @code{noteC} is relative to @code{noteB}, not @code{noteA};
988 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
989 @code{noteA}.
990
991 @node Explicitly instantiating voices
992 @subsection Explicitly instantiating voices
993
994 @internalsref{Voice} contexts can also be instantiated manually
995 inside a @code{<< >>} block to create polyphonic music, using
996 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
997 and a horizontal shift for each part.
998
999 Specifically,
1000 @example
1001 << \upper \\ \lower >>
1002 @end example
1003
1004 @noindent
1005 is equivalent to
1006
1007 @example
1008 <<
1009   \new Voice = "1" @{ \voiceOne \upper @}
1010   \new Voice = "2" @{ \voiceTwo \lower @}
1011 >>
1012 @end example
1013
1014 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
1015 articulations, text annotations, augmentation dots of dotted
1016 notes, and fingerings.  @code{\voiceOne} and @code{\voiceThree} make
1017 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
1018 make them point downwards.
1019 The command @code{\oneVoice} will revert back to the normal setting.
1020
1021 An expression that appears directly inside a @code{<< >>} belongs to
1022 the main voice.  This is useful when extra voices appear while the main
1023 voice is playing.  Here is a more correct rendition of the example from
1024 the previous section.  The crossed noteheads demonstrate that the main
1025 melody is now in a single voice context.
1026
1027 @lilypond[quote,ragged-right,verbatim]
1028 \new Staff \relative c' {
1029   \override NoteHead #'style = #'cross
1030   c16 d e f
1031   \voiceOne
1032   <<
1033     { g4 f e | d2 e2 }
1034     \new Voice="1" { \voiceTwo
1035       r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1036       \oneVoice
1037     }
1038     \new Voice { \voiceThree
1039       s2. | s4 b4 c2
1040       \oneVoice
1041     }
1042   >>
1043   \oneVoice
1044 }
1045 @end lilypond
1046
1047 The correct definition of the voices allows the melody to be slurred.
1048 @lilypond[quote,ragged-right,verbatim]
1049 \new Staff \relative c' {
1050   c16^( d e f
1051   \voiceOne
1052   <<
1053     { g4 f e | d2 e2) }
1054     \context Voice="1" { \voiceTwo
1055       r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1056       \oneVoice
1057     }
1058     \new Voice { \voiceThree
1059       s2. s4 b4 c2
1060       \oneVoice
1061     }
1062   >>
1063   \oneVoice
1064 }
1065 @end lilypond
1066
1067 Avoiding the @code{\\} separator also allows nesting polyphony
1068 constructs, which in some case might be a more natural way to typeset
1069 the music.
1070
1071 @lilypond[quote,ragged-right,verbatim]
1072 \new Staff \relative c' {
1073   c16^( d e f
1074   \voiceOne
1075   <<
1076     { g4 f e | d2 e2) }
1077     \context Voice="1" { \voiceTwo
1078       r8 e4 d c8 ~ |
1079       <<
1080         {c8 b16 a b8 g ~ g2}
1081         \new Voice { \voiceThree
1082           s4 b4 c2
1083           \oneVoice
1084         }
1085       >>
1086     \oneVoice
1087     }
1088   >>
1089   \oneVoice
1090 }
1091 @end lilypond
1092
1093
1094 @node Collision Resolution
1095 @subsection Collision Resolution
1096
1097 Normally, note heads with a different number of dots are not merged, but
1098 when the object property @code{merge-differently-dotted} is set in
1099 the @internalsref{NoteCollision} object, they are merged
1100 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
1101 \new Voice << {
1102   g8 g8
1103   \override Staff.NoteCollision
1104     #'merge-differently-dotted = ##t
1105   g8 g8
1106 } \\ { g8.[ f16] g8.[ f16] } >>
1107 @end lilypond
1108
1109 Similarly, you can merge half note heads with eighth notes, by setting
1110 @code{merge-differently-headed}
1111 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
1112 \new Voice << {
1113   c8 c4.
1114   \override Staff.NoteCollision
1115     #'merge-differently-headed = ##t
1116 c8 c4. } \\ { c2 c2 } >>
1117 @end lilypond
1118
1119 LilyPond also vertically shifts rests that are opposite of a stem,
1120 for example
1121
1122 @lilypond[quote,ragged-right,fragment,verbatim]
1123 \new Voice << c''4 \\ r4 >>
1124 @end lilypond
1125
1126
1127 @refcommands
1128
1129 @funindex \oneVoice
1130 @code{\oneVoice},
1131 @funindex \voiceOne
1132 @code{\voiceOne},
1133 @funindex \voiceTwo
1134 @code{\voiceTwo},
1135 @funindex \voiceThree
1136 @code{\voiceThree},
1137 @funindex \voiceFour
1138 @code{\voiceFour}.
1139
1140 @funindex \shiftOn
1141 @code{\shiftOn},
1142 @funindex \shiftOnn
1143 @code{\shiftOnn},
1144 @funindex \shiftOnnn
1145 @code{\shiftOnnn},
1146 @funindex \shiftOff
1147 @code{\shiftOff}: these commands specify in what chords of the current
1148 voice should be shifted.  The outer voices (normally: voice one and
1149 two) have @code{\shiftOff}, while the inner voices (three and four)
1150 have @code{\shiftOn}.  @code{\shiftOnn} and @code{\shiftOnnn} define
1151 further shift levels.
1152
1153 When LilyPond cannot cope, the @code{force-hshift}
1154 property of the @internalsref{NoteColumn} object and pitched rests can
1155 be used to override typesetting decisions.
1156
1157 @lilypond[quote,verbatim,ragged-right]
1158 \relative <<
1159 {
1160   <d g>
1161   <d g>
1162 } \\ {
1163   <b f'>
1164   \once \override NoteColumn #'force-hshift = #1.7
1165   <b f'>
1166 } >>
1167 @end lilypond
1168
1169
1170 @seealso
1171
1172 Program reference: the objects responsible for resolving collisions are
1173 @internalsref{NoteCollision} and @internalsref{RestCollision}.
1174
1175 Examples:
1176 @inputfileref{input/@/regression,collision@/-dots@/.ly},
1177 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
1178 @inputfileref{input/@/regression,collision@/-heads@/.ly},
1179 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
1180 @inputfileref{input/@/regression,collisions@/.ly}.
1181
1182
1183 @refbugs
1184
1185 When using @code{merge-differently-headed} with an upstem eighth or a
1186 shorter note, and a downstem half note, the eighth note gets the wrong
1187 offset.
1188
1189 There is no support for clusters where the same note occurs with
1190 different accidentals in the same chord.  In this case, it is
1191 recommended to use enharmonic transcription, or to use special cluster
1192 notation (see @ref{Clusters}).
1193
1194
1195
1196 @node Staff notation
1197 @section Staff notation
1198
1199 @cindex Staff notation
1200
1201 This section describes music notation that occurs on staff level,
1202 such as key signatures, clefs and time signatures.
1203
1204 @menu
1205 * Clef::                        
1206 * Key signature::               
1207 * Time signature::              
1208 * Partial measures::            
1209 * Bar lines::                   
1210 * Unmetered music::             
1211 * System start delimiters::     
1212 * Staff symbol::                
1213 * Writing music in parallel::   
1214 @end menu
1215
1216
1217 @node Clef
1218 @subsection Clef
1219
1220 @funindex \clef
1221
1222 The clef indicates which lines of the staff correspond to which
1223 pitches.  The clef is set with the @code{\clef} command
1224
1225 @lilypond[quote,ragged-right,fragment,verbatim]
1226 { c''2 \clef alto g'2 }
1227 @end lilypond
1228
1229 @cindex treble clef
1230 @cindex violin clef
1231 @cindex alto clef
1232 @cindex tenor clef
1233 @cindex bass clef
1234 @cindex french clef
1235 @cindex soprano clef
1236 @cindex mezzosoprano clef
1237 @cindex baritone clef
1238 @cindex varbaritone clef
1239 @cindex subbass clef
1240
1241 Supported clefs include
1242
1243 @multitable @columnfractions .33 .66
1244 @headitem Clef @tab Position
1245 @item @code{treble}, violin, G, G2 @tab
1246 G clef on 2nd line
1247 @item @code{alto, C} @tab
1248 C clef on 3rd line
1249 @item @code{tenor} @tab
1250 C clef on 4th line.
1251 @item @code{bass, F} @tab
1252 F clef on 4th line
1253 @item @code{french} @tab
1254 G clef on 1st line, so-called French violin clef
1255 @item @code{soprano} @tab
1256 C clef on 1st line
1257 @item @code{mezzosoprano} @tab
1258 C clef on 2nd line
1259 @item @code{baritone} @tab
1260 C clef on 5th line
1261 @item @code{varbaritone} @tab
1262 F clef on 3rd line
1263 @item @code{subbass} @tab
1264 F clef on 5th line
1265 @item @code{percussion} @tab
1266 percussion clef
1267 @item @code{tab} @tab
1268 tablature clef
1269 @end multitable
1270
1271 By adding @code{_8} or @code{^8} to the clef name, the clef is
1272 transposed one octave down or up, respectively, and @code{_15} and
1273 @code{^15} transposes by two octaves.  The argument @var{clefname}
1274 must be enclosed in quotes when it contains underscores or digits.  For
1275 example,
1276
1277 @cindex choral tenor clef
1278 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
1279 \clef "G_8" c4
1280 @end lilypond
1281
1282
1283 @commonprop
1284
1285 The command @code{\clef "treble_8"} is equivalent to setting
1286 @code{clefGlyph},
1287 @code{clefPosition} (which controls the Y position of the clef),
1288 @code{middleCPosition} and @code{clefOctavation}.  A clef is printed
1289 when any of these properties are changed.  The following example shows
1290 possibilities when setting properties manually.
1291
1292 @lilypond[quote,ragged-right,verbatim]
1293 {
1294   \set Staff.clefGlyph = #"clefs.F"
1295   \set Staff.clefPosition = #2
1296   c'4
1297   \set Staff.clefGlyph = #"clefs.G"
1298   c'4
1299   \set Staff.clefGlyph = #"clefs.C"
1300   c'4
1301   \set Staff.clefOctavation = #7
1302   c'4
1303   \set Staff.clefOctavation = #0
1304   \set Staff.clefPosition = #0
1305   c'4
1306   \clef "bass"
1307   c'4
1308   \set Staff.middleCPosition = #4
1309   c'4
1310 }
1311 @end lilypond
1312
1313
1314 @seealso
1315
1316 Manual: @ref{Grace notes}.
1317
1318 Program reference: @internalsref{Clef}.
1319
1320
1321 @node Key signature
1322 @subsection Key signature
1323
1324 @cindex Key signature
1325 @funindex \key
1326
1327 The key signature indicates the tonality in which a piece is played.  It
1328 is denoted by a set of alterations (flats or sharps) at the start of the
1329 staff.
1330
1331 Setting or changing the key signature is done with the @code{\key}
1332 command
1333
1334 @example
1335 @code{\key} @var{pitch} @var{type}
1336 @end example
1337
1338 @funindex \minor
1339 @funindex \major
1340 @funindex \minor
1341 @funindex \ionian
1342 @funindex \locrian
1343 @funindex \aeolian
1344 @funindex \mixolydian
1345 @funindex \lydian
1346 @funindex \phrygian
1347 @funindex \dorian
1348 @cindex church modes
1349
1350 Here, @var{type} should be @code{\major} or @code{\minor} to get
1351 @var{pitch}-major or @var{pitch}-minor, respectively.  You may also
1352 use the standard mode names (also called ``church modes''): @code{\ionian},
1353 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
1354 @code{\phrygian}, and @code{\dorian}.
1355
1356 This command sets the context property
1357 @code{Staff.keySignature}.  Non-standard key signatures
1358 can be specified by setting this property directly.
1359
1360 Accidentals and key signatures often confuse new users, because
1361 unaltered notes get natural signs depending on the key signature.  For
1362 more information, see @ref{Accidentals} or @ref{More about pitches}.
1363
1364 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1365 \key g \major
1366 f1
1367 fis
1368 @end lilypond
1369
1370
1371 @commonprop
1372
1373 A natural sign is printed to cancel any previous accidentals.  This
1374 can be suppressed by setting the @code{Staff.printKeyCancellation}
1375 property.
1376
1377 @lilypond[quote,fragment,ragged-right,fragment,verbatim,relative=2]
1378 \key d \major
1379 a b cis d
1380 \key g \minor
1381 a bes c d
1382 \set Staff.printKeyCancellation = ##f
1383 \key d \major
1384 a b cis d
1385 \key g \minor
1386 a bes c d
1387 @end lilypond
1388
1389
1390 @seealso
1391
1392 Program reference: @internalsref{KeyCancellation},
1393 @internalsref{KeySignature}.
1394
1395
1396 @node Time signature
1397 @subsection Time signature
1398
1399 @cindex Time signature
1400 @cindex meter
1401 @funindex \time
1402
1403 Time signature indicates the metrum of a piece: a regular pattern of
1404 strong and weak beats.  It is denoted by a fraction at the start of the
1405 staff.
1406
1407 The time signature is set with the @code{\time} command
1408
1409 @lilypond[quote,ragged-right,fragment,verbatim]
1410 \time 2/4 c'2 \time 3/4 c'2.
1411 @end lilypond
1412
1413 @commonprop
1414
1415 The symbol that is printed can be customized with the @code{style}
1416 property.  Setting it to @code{#'()} uses fraction style for 4/4 and
1417 2/2 time,
1418
1419 @lilypond[fragment,quote,ragged-right,verbatim]
1420 \time 4/4 c'1
1421 \time 2/2 c'1
1422 \override Staff.TimeSignature #'style = #'()
1423 \time 4/4 c'1
1424 \time 2/2 c'1
1425 @end lilypond
1426
1427 There are many more options for its layout.  See @ref{Ancient time
1428 signatures} for more examples.
1429
1430 @code{\time} sets the property @code{timeSignatureFraction},
1431 @code{beatLength} and @code{measureLength} in the @code{Timing}
1432 context, which is normally aliased to @internalsref{Score}.  The
1433 property @code{measureLength} determines where bar lines should be
1434 inserted, and how automatic beams should be generated.  Changing the
1435 value of @code{timeSignatureFraction} also causes the symbol to be
1436 printed.
1437
1438 More options are available through the Scheme function
1439 @code{set-time-signature}.  In combination with the
1440 @internalsref{Measure_grouping_engraver}, it will create
1441 @internalsref{MeasureGrouping} signs.  Such signs ease reading
1442 rhythmically complex modern music.  In the following example, the 9/8
1443 measure is subdivided in 2, 2, 2 and 3.  This is passed to
1444 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1445
1446 @lilypond[quote,ragged-right,verbatim]
1447 \score {
1448   \relative c'' {
1449     #(set-time-signature 9 8 '(2 2 2 3))
1450     g8[ g] d[ d] g[ g] a8[( bes g]) |
1451     #(set-time-signature 5 8 '(3 2))
1452     a4. g4
1453   }
1454   \layout {
1455     \context {
1456       \Staff
1457       \consists "Measure_grouping_engraver"
1458     }
1459   }
1460 }
1461 @end lilypond
1462
1463
1464 @seealso
1465
1466 Program reference: @internalsref{TimeSignature}, and
1467 @internalsref{Timing_translator}.
1468
1469 Examples: @inputfileref{input/@/test,compound@/-time@/.ly}.
1470
1471
1472 @refbugs
1473
1474 Automatic beaming does not use the measure grouping specified with
1475 @code{set-time-signature}.
1476
1477
1478 @node Partial measures
1479 @subsection Partial measures
1480
1481 @cindex anacrusis
1482 @cindex upbeat
1483 @cindex partial measure
1484 @cindex measure, partial
1485 @cindex shorten measures
1486 @funindex \partial
1487
1488 Partial measures, such as an anacrusis or upbeat, are entered using the
1489
1490 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1491 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1492 @end lilypond
1493
1494 The syntax for this command is
1495
1496 @example
1497 \partial @var{duration}
1498 @end example
1499
1500 where @code{duration} is the rhythmic length to be added before
1501 the next bar.
1502
1503 This is internally translated into
1504
1505 @example
1506 \set Timing.measurePosition = -@var{length of duration}
1507 @end example
1508
1509 The property @code{measurePosition} contains a rational number
1510 indicating how much of the measure has passed at this point.  Note
1511 that this is a negative number; @code{\partial 4} is internally
1512 translated to mean ``there is a quarter note left in the bar''.
1513
1514
1515 @refbugs
1516
1517 This command does not take into account grace notes at the start of
1518 the music.  When a piece starts with graces notes in the pickup, then
1519 the @code{\partial} should follow the grace notes
1520
1521 @lilypond[verbatim,quote,ragged-right,relative,fragment]
1522 \grace f16
1523 \partial 4
1524 g4
1525 a2 g2
1526 @end lilypond
1527
1528
1529 @node Bar lines
1530 @subsection Bar lines
1531
1532 @cindex Bar lines
1533 @funindex \bar
1534 @cindex measure lines
1535 @cindex repeat bars
1536
1537 Bar lines delimit measures, but are also used to indicate
1538 repeats.  Normally they are inserted automatically.  Line
1539 breaks may only happen on bar lines.
1540
1541 Special types of bar lines can be forced with the @code{\bar} command
1542
1543 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1544 c4 \bar "|:" c4
1545 @end lilypond
1546
1547 The following bar types are available
1548
1549 @lilypondfile[ragged-right,quote]{bar-lines.ly}
1550
1551 In addition, you can specify @code{"||:"}, which is equivalent to 
1552 @code{"|:"} except at line breaks, where it gives a double bar line at
1553 the end of the line and a start repeat at the beginning of the next
1554 line. 
1555
1556 To allow a line break where there is no visible bar line, use
1557
1558 @example
1559 \bar ""
1560 @end example
1561
1562 @noindent
1563 This will insert an invisible bar line and allow line breaks at this
1564 point.  This also increases the bar number counter.
1565
1566 In scores with many staves, a @code{\bar} command in one staff is
1567 automatically applied to all staves.  The resulting bar lines are
1568 connected between different staves of a @code{StaffGroup},
1569 @code{PianoStaff}, or @code{ChoirStaff}.
1570
1571 @lilypond[quote,ragged-right,fragment,verbatim]
1572 <<
1573   \new StaffGroup <<
1574     \new Staff {
1575       e'4 d'
1576       \bar "||"
1577       f' e'
1578     }
1579     \new Staff { \clef bass c4 g e g }
1580   >>
1581   \new Staff { \clef bass c2 c2 }
1582 >>
1583 @end lilypond
1584
1585
1586 @commonprop
1587
1588 @funindex whichBar
1589 @funindex repeatCommands
1590 @funindex defaultBarType
1591
1592 The command @code{\bar }@var{bartype} is a short cut for doing
1593 @code{\set Timing.whichBar = }@var{bartype}.  Whenever @code{whichBar}
1594 is set to a string, a bar line of that type is created.
1595
1596 A bar line is created whenever the @code{whichBar} property is set.
1597 At the start of a measure it is set to the contents of
1598 @code{Timing.defaultBarType}.  The contents of @code{repeatCommands} are
1599 used
1600 to override default measure bars.
1601
1602 You are encouraged to use @code{\repeat} for repetitions.  See
1603 @ref{Repeats}.
1604
1605
1606 @seealso
1607
1608 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1609
1610 Program reference: @internalsref{BarLine} (created at
1611 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1612
1613 Examples: @inputfileref{input/@/test,bar@/-lines@/.ly},
1614
1615
1616 @node Unmetered music
1617 @subsection Unmetered music
1618
1619 @cindex cadenza
1620 @funindex \cadenzaOn
1621 @funindex \cadenzaOff
1622
1623 Bar lines and bar numbers are calculated automatically.  For unmetered
1624 music (cadenzas, for example), this is not desirable.  To turn off
1625 automatic bar lines and bar numbers, use the commands @code{\cadenzaOn}
1626 and @code{\cadenzaOff}.
1627
1628 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1629 c4 d e d
1630 \cadenzaOn
1631 c4 c d8 d d f4 g4.
1632 \cadenzaOff
1633 \bar "|"
1634 d4 e d c
1635 @end lilypond
1636
1637
1638 @refbugs
1639
1640 LilyPond will only insert line breaks and page breaks at a
1641 barline.  Unless the unmetered music ends before the end of
1642 the staff line, you will need to insert
1643 invisible bar lines
1644
1645 @example
1646 \bar ""
1647 @end example
1648
1649 @noindent
1650 to indicate where breaks can occur.
1651
1652
1653 @node System start delimiters
1654 @subsection System start delimiters
1655
1656 @cindex start of system
1657 @cindex Staff, multiple
1658 @cindex bracket, vertical
1659 @cindex brace, vertical
1660 @cindex grand staff
1661 @cindex staff group
1662 @cindex staff, choir
1663
1664 Many scores consist of more than one staff.  These staves can be
1665 joined in four different ways
1666
1667 @itemize @bullet
1668 @item The group is started with a brace at the left, and bar lines are
1669 connected.  This is done with the @internalsref{GrandStaff} context.
1670
1671 @lilypond[verbatim,ragged-right,quote]
1672 \new GrandStaff
1673 \relative <<
1674   \new Staff { c1 c }
1675   \new Staff { c c }
1676 >>
1677 @end lilypond
1678
1679 @item The group is started with a bracket, and bar lines are connected.
1680 This is done with the
1681 @internalsref{StaffGroup} context
1682
1683 @lilypond[verbatim,ragged-right,quote]
1684 \new StaffGroup
1685 \relative <<
1686   \new Staff { c1 c }
1687   \new Staff { c c }
1688 >>
1689 @end lilypond
1690
1691 @item The group is started with a bracket, but bar lines are not
1692 connected.  This is done with the @internalsref{ChoirStaff} context.
1693
1694 @lilypond[verbatim,ragged-right,quote]
1695 \new ChoirStaff
1696 \relative <<
1697   \new Staff { c1 c }
1698   \new Staff { c c }
1699 >>
1700 @end lilypond
1701
1702 @item The group is started with a vertical line.  Bar lines are not
1703 connected.  This is the default for the score.
1704
1705 @lilypond[verbatim,ragged-right,quote]
1706 \relative <<
1707   \new Staff { c1 c }
1708   \new Staff { c c }
1709 >>
1710 @end lilypond
1711 @end itemize
1712
1713
1714 @seealso
1715
1716 The bar lines at the start of each system are
1717 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1718 @internalsref{SystemStartBracket}.  Only one of these types is created
1719 in every context, and that type is determined by the property
1720 @internalsref{systemStartDelimiter}.
1721
1722
1723 @node Staff symbol
1724 @subsection Staff symbol
1725
1726 @cindex adjusting staff symbol
1727
1728 Notes, dynamic signs, etc., are grouped
1729 with a set of horizontal lines, called a staff (plural `staves').  In
1730 LilyPond, these lines are drawn using a separate layout object called
1731 @code{staff symbol}.
1732
1733 The staff symbol may be tuned in the number, thickness and distance
1734 of lines, using properties.  This is demonstrated in the example files
1735 @inputfileref{input/@/test,staff@/-lines@/.ly},
1736 @inputfileref{input/@/test,staff@/-size@/.ly}.
1737
1738 In addition, staves may be started and stopped at will. This is done
1739 with @code{\startStaff} and @code{\stopStaff}.
1740
1741 @lilypond[verbatim,relative=2,fragment]
1742 b4 b
1743 \override Staff.StaffSymbol #'line-count = 2
1744 \stopStaff \startStaff
1745 b b
1746 \revert Staff.StaffSymbol #'line-count
1747 \stopStaff \startStaff
1748 b b
1749 @end lilypond
1750
1751 In combination with Frenched staves, this may be used to typeset ossia
1752 sections. An example is in @inputfileref{input/@/test@/,ossia.ly},
1753 shown here
1754
1755 @cindex ossia
1756
1757 @lilypondfile{ossia.ly}
1758
1759 @cindex staff lines, setting number of
1760 @cindex staff lines, setting thickness of
1761 @cindex thickness of staff lines, setting
1762 @cindex number of staff lines, setting
1763
1764 @seealso
1765
1766 Program reference: @internalsref{StaffSymbol}.
1767
1768 Examples: @inputfileref{input/@/test,staff@/-lines@/.ly},
1769 @inputfileref{input/@/test@/,ossia.ly},
1770 @inputfileref{input/@/test,staff@/-size@/.ly},
1771 @inputfileref{input/@/regression,staff@/-line@/-positions@/.ly}.
1772
1773
1774 @node Writing music in parallel
1775 @subsection Writing music in parallel
1776
1777 @cindex Writing music in parallel
1778 @cindex Interleaved music
1779
1780 Music for multiple parts can be interleaved
1781
1782 @lilypond[quote,fragment,verbatim]
1783 \parallelMusic #'(voiceA voiceB) {
1784   r8     g'16[ c''] e''[ g' c'' e''] r8     g'16[ c''] e''[ g' c'' e''] |
1785   c'2                                c'2                                |
1786   r8     a'16[ d''] f''[ a' d'' f''] r8     a'16[ d''] f''[ a' d'' f''] |
1787   c'2                                c'2                                |
1788 }
1789 \new StaffGroup <<
1790   \new Staff \new Voice \voiceA
1791   \new Staff \new Voice \voiceB
1792 >>
1793 @end lilypond
1794
1795
1796
1797 @node Connecting notes
1798 @section Connecting notes
1799
1800 This section deals with notation that affects groups of notes.
1801
1802 @menu
1803 * Ties::                        
1804 * Slurs::                       
1805 * Phrasing slurs::              
1806 * Laissez vibrer ties::         
1807 * Automatic beams::             
1808 * Manual beams::                
1809 * Grace notes::                 
1810 @end menu
1811
1812
1813 @node Ties
1814 @subsection Ties
1815
1816 @cindex tie
1817 @funindex ~
1818
1819 A tie connects two adjacent note heads of the same pitch.  The tie in
1820 effect extends the length of a note.  Ties should not be confused with
1821 slurs, which indicate articulation, or phrasing slurs, which indicate
1822 musical phrasing.  A tie is entered using the tilde symbol `@code{~}'
1823
1824 @lilypond[quote,ragged-right,fragment,verbatim]
1825 e' ~ e' <c' e' g'> ~ <c' e' g'>
1826 @end lilypond
1827
1828 When a tie is applied to a chord, all note heads whose pitches match
1829 are connected.  When no note heads match, no ties will be created.
1830
1831 A tie is just a way of extending a note duration, similar to the
1832 augmentation dot.  The following example shows two ways of notating
1833 exactly the same concept
1834
1835 @lilypond[quote,fragment,ragged-right]
1836 \time 3/4 c'2. c'2 ~ c'4
1837 @end lilypond
1838
1839 @noindent
1840 Ties are used either when the note crosses a bar line, or when dots
1841 cannot be used to denote the rhythm.  When using ties, larger note
1842 values should be aligned to subdivisions of the measure, such as
1843
1844 @lilypond[fragment,quote,ragged-right]
1845 \relative {
1846   r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
1847 }
1848 @end lilypond
1849
1850 If you need to tie a lot of notes over bars, it may be easier to use
1851 automatic note splitting (see @ref{Automatic note splitting}).  This
1852 mechanism automatically splits long notes, and ties them across bar
1853 lines.
1854
1855 @funindex \repeatTie
1856
1857 When a second alternative of a repeat starts with a tied note, you
1858 have to repeat the tie. This can be achieved with @code{\repeatTie},
1859
1860 @lilypond[fragment,quote,ragged-right,relative=2]
1861 r <c e g>\repeatTie
1862 @end lilypond
1863
1864 @cindex repeating ties
1865 @cindex volta brackets and ties
1866
1867 @commonprop
1868
1869 Ties are sometimes used to write out arpeggios.  In this case, two tied
1870 notes need not be consecutive.  This can be achieved by setting the
1871 @code{tieWaitForNote} property to true. The same feature is also useful,
1872 for example, to tie a tremolo to a chord. For example,
1873
1874 @lilypond[fragment,verbatim,relative=1,ragged-right]
1875 \set tieWaitForNote = ##t
1876 \grace { c16[~ e~ g]~ } <c, e g>2
1877 \repeat "tremolo" 8 { c32~ c'~ } <c c,>1
1878 @end lilypond
1879
1880
1881 @refcommands
1882
1883
1884 @funindex \tieUp
1885 @code{\tieUp},
1886 @funindex \tieDown
1887 @code{\tieDown},
1888 @funindex \tieNeutral
1889 @code{\tieNeutral},
1890 @funindex \tieDotted
1891 @code{\tieDotted},
1892 @funindex \tieDashed
1893 @code{\tieDashed},
1894 @funindex \tieSolid
1895 @code{\tieSolid}.
1896
1897
1898 @seealso
1899
1900 In this manual: @ref{Automatic note splitting}.
1901
1902 Program reference: @internalsref{Tie}.
1903
1904 Examples:
1905 @inputfileref{input/@/regression,tie-arpeggio.ly}
1906 @inputfileref{input/@/regression,tie-manual.ly}
1907
1908
1909
1910
1911 @refbugs
1912
1913 Switching staves when a tie is active will not produce a slanted tie.
1914
1915
1916 @node Slurs
1917 @subsection Slurs
1918
1919 @cindex Slurs
1920
1921 A slur indicates that notes are to be played bound or
1922 @emph{legato}.  They are entered using parentheses
1923
1924 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1925 f( g a) a8 b( a4 g2 f4)
1926 <c e>2( <b d>2)
1927 @end lilypond
1928
1929 The direction of a slur can be specified with
1930 @code{\slur@emph{DIR}}, where @code{@emph{DIR}} is
1931 either @code{Up}, @code{Down}, or @code{Neutral} (automatically
1932 selected).
1933
1934 However, there is a convenient shorthand for forcing slur
1935 directions.  By adding @code{_} or @code{^} before the opening
1936 parentheses, the direction is also set.  For example,
1937
1938 @lilypond[relative=2,ragged-right,quote,verbatim,fragment]
1939 c4_( c) c^( c)
1940 @end lilypond
1941
1942 Only one slur can be printed at once.  If you need to print a long
1943 slur over a few small slurs, please see @ref{Phrasing slurs}.
1944
1945
1946 @commonprop
1947
1948 Some composers write two slurs when they want legato chords.  This can
1949 be achieved in LilyPond by setting @code{doubleSlurs},
1950
1951 @lilypond[verbatim,ragged-right,relative,fragment,quote]
1952 \set doubleSlurs = ##t
1953 <c e>4 ( <d f> <c e> <d f> )
1954 @end lilypond
1955
1956
1957 @refcommands
1958
1959 @funindex \slurUp
1960 @code{\slurUp},
1961 @funindex \slurDown
1962 @code{\slurDown},
1963 @funindex \slurNeutral
1964 @code{\slurNeutral},
1965 @funindex \slurDashed
1966 @code{\slurDashed},
1967 @funindex \slurDotted
1968 @code{\slurDotted},
1969 @funindex \slurSolid
1970 @code{\slurSolid}.
1971
1972 @seealso
1973
1974 Program reference: @seeinternals{Slur}.
1975
1976
1977 @node Phrasing slurs
1978 @subsection Phrasing slurs
1979
1980 @cindex phrasing slurs
1981 @cindex phrasing marks
1982
1983 A phrasing slur (or phrasing mark) connects notes and is used to
1984 indicate a musical sentence.  It is written using @code{\(} and @code{\)}
1985 respectively
1986
1987 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
1988 \time 6/4 c'\( d( e) f( e) d\)
1989 @end lilypond
1990
1991 Typographically, the phrasing slur behaves almost exactly like a
1992 normal slur.  However, they are treated as different objects.  A
1993 @code{\slurUp} will have no effect on a phrasing slur; instead, use
1994 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1995 @code{\phrasingSlurNeutral}.
1996
1997 You cannot have simultaneous phrasing slurs.
1998
1999
2000 @refcommands
2001
2002 @funindex \phrasingSlurUp
2003 @code{\phrasingSlurUp},
2004 @funindex \phrasingSlurDown
2005 @code{\phrasingSlurDown},
2006 @funindex \phrasingSlurNeutral
2007 @code{\phrasingSlurNeutral}.
2008
2009
2010 @seealso
2011
2012 Program reference: @internalsref{PhrasingSlur}.
2013
2014
2015 @node Laissez vibrer ties
2016 @subsection Laissez vibrer ties
2017 @cindex Laissez vibrer
2018 @cindex Ties, laissez vibrer
2019
2020 L.v. ties (laissez vibrer) indicate that notes must not be damped at the
2021 end. It is used in notation for piano, harp and other string and
2022 percussion instruments. They can be entered using @code{\laissezVibrer},
2023
2024 @lilypond[fragment,ragged-right,verbatim,relative=1]
2025 <c f g>\laissezVibrer
2026 @end lilypond
2027
2028 @seealso
2029
2030 Program reference:
2031 @internalsref{LaissezVibrerTie}
2032 @internalsref{LaissezVibrerTieColumn}
2033
2034 Example files:
2035 @inputfileref{input/regression,laissez-vibrer-tie.ly}
2036
2037
2038 @node Automatic beams
2039 @subsection Automatic beams
2040
2041 LilyPond inserts beams automatically
2042
2043 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2044 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
2045 @end lilypond
2046
2047 When these automatic decisions are not good enough, beaming can be
2048 entered explicitly.  It is also possible to define beaming patterns
2049 that differ from the defaults.  See @ref{Setting automatic beam behavior}
2050 for details.
2051
2052 Individual notes may be marked with @code{\noBeam} to prevent them
2053 from being beamed
2054
2055 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2056 \time 2/4 c8 c\noBeam c c
2057 @end lilypond
2058
2059
2060 @seealso
2061
2062 Program reference: @internalsref{Beam}.
2063
2064
2065 @node Manual beams
2066 @subsection Manual beams
2067
2068 @cindex beams, manual
2069 @funindex ]
2070 @funindex [
2071
2072 In some cases it may be necessary to override the automatic beaming
2073 algorithm.  For example, the autobeamer will not put beams over rests
2074 or bar lines.  Such beams are specified manually by marking the begin
2075 and end point with @code{[} and @code{]}
2076
2077 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2078 {
2079   r4 r8[ g' a r8] r8 g[ | a] r8
2080 }
2081 @end lilypond
2082
2083
2084 @commonprop
2085
2086 @funindex stemLeftBeamCount
2087 @funindex stemRightBeamCount
2088
2089 Normally, beaming patterns within a beam are determined automatically.
2090 If necessary, the properties @code{stemLeftBeamCount} and
2091 @code{stemRightBeamCount} can be used to override the defaults.  If
2092 either property is set, its value will be used only once, and then it
2093 is erased
2094
2095 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2096 {
2097    f8[ r16
2098       f g a]
2099    f8[ r16
2100    \set stemLeftBeamCount = #1
2101       f g a]
2102 }
2103 @end lilypond
2104
2105 The property @code{subdivideBeams} can be set in order to subdivide
2106 all 16th or shorter beams at beat positions, as defined by the
2107 @code{beatLength} property.
2108
2109 @lilypond[fragment,quote,relative=2,verbatim]
2110 c16[ c c c c c c c]
2111 \set subdivideBeams = ##t
2112 c16[ c c c c c c c]
2113 \set Score.beatLength = #(ly:make-moment 1 8)
2114 c16[ c c c c c c c]
2115 @end lilypond
2116 @funindex subdivideBeams
2117
2118 @noindent
2119 For more information about @code{make-moment}, see
2120 @ref{Time administration}.
2121
2122 Line breaks are normally forbidden when beams cross bar lines.  This
2123 behavior can be changed by setting @code{allowBeamBreak}.
2124
2125 @funindex allowBeamBreak
2126 @cindex beams and line breaks
2127 @cindex beams, kneed
2128 @cindex kneed beams
2129 @cindex auto-knee-gap
2130
2131
2132 @refbugs
2133
2134 Kneed beams are inserted automatically when a large gap is detected
2135 between the note heads.  This behavior can be tuned through the object.
2136
2137 Automatically kneed cross-staff beams cannot be used together with
2138 hidden staves.  See @ref{Hiding staves}.
2139
2140 Beams do not avoid collisions with symbols around the notes, such as
2141 texts and accidentals.
2142
2143
2144 @node Grace notes
2145 @subsection Grace notes
2146
2147 @funindex \grace
2148 @cindex ornaments
2149 @cindex grace notes
2150 @cindex appoggiatura
2151 @cindex acciaccatura
2152
2153 Grace notes are ornaments that are written out.  The most common ones
2154 are acciaccatura, which should be played as very short.  It is denoted
2155 by a slurred small note with a slashed stem.  The appoggiatura is a
2156 grace note that takes a fixed fraction of the main note, and is
2157 denoted as a slurred note in small print without a slash.  They
2158 are entered with the commands @code{\acciaccatura} and
2159 @code{\appoggiatura}, as demonstrated in the following example
2160
2161 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2162 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
2163 \acciaccatura { g16[ f] } e4
2164 @end lilypond
2165
2166 Both are special forms of the @code{\grace} command.  By prefixing this
2167 keyword to a music expression, a new one is formed, which will be
2168 printed in a smaller font and takes up no logical time in a measure.
2169
2170 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2171 c4 \grace c16 c4
2172 \grace { c16[ d16] } c2 c4
2173 @end lilypond
2174
2175 @noindent
2176 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
2177 @code{\grace} command does not start a slur.
2178
2179 Internally, timing for grace notes is done using a second, `grace'
2180 timing.  Every point in time consists of two rational numbers: one
2181 denotes the logical time, one denotes the grace timing.  The above
2182 example is shown here with timing tuples
2183
2184 @lilypond[quote,ragged-right]
2185 <<
2186   \relative c''{
2187     c4 \grace c16 c4 \grace {
2188     c16[ d16] } c2 c4
2189   }
2190   \new Lyrics \lyricmode {
2191     \override LyricText #'font-family = #'typewriter
2192
2193     \markup { (0,0) } 4
2194     \grace { \markup {
2195       ( \fraction 1 4 , \fraction -1 16 ) } 16 }
2196     \markup { (\fraction 1 4 , 0 ) } 4
2197     \grace {
2198       \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
2199       \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
2200     }
2201     \markup { ( \fraction 2 4 , 0 ) }
2202   }
2203 >>
2204 @end lilypond
2205
2206 The placement of grace notes is synchronized between different staves.
2207 In the following example, there are two sixteenth grace notes for
2208 every eighth grace note
2209
2210 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2211 << \new Staff { e4 \grace { c16[ d e f] } e4 }
2212    \new Staff { c4 \grace { g8[ b] } c4 } >>
2213 @end lilypond
2214
2215 @funindex \afterGrace
2216
2217 If you want to end a note with a grace, use the @code{\afterGrace}
2218 command.  It takes two arguments: the main note, and the grace notes
2219 following the main note.
2220
2221 @lilypond[ragged-right, verbatim,relative=2,fragment]
2222 c1 \afterGrace d1 { c16[ d] } c4
2223 @end lilypond
2224
2225 This will put the grace notes after a ``space'' lasting 3/4 of the
2226 length of the main note.  The fraction 3/4 can be changed by setting
2227 @code{afterGraceFraction}, ie.
2228
2229 @example
2230 afterGraceFraction = #(cons 7 8)
2231 @end example
2232
2233 @noindent
2234 will put the grace note at 7/8 of the main note.
2235
2236 The same effect can be achieved manually by doing
2237
2238 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2239 \new Voice {
2240   << { d1^\trill_( }
2241      { s2 \grace { c16[ d] } } >>
2242   c4)
2243 }
2244 @end lilypond
2245
2246 @noindent
2247 By adjusting the duration of the skip note (here it is a half-note),
2248 the space between the main-note and the grace is adjusted.
2249
2250 A @code{\grace} section will introduce special typesetting settings,
2251 for example, to produce smaller type, and set directions.  Hence, when
2252 introducing layout tweaks, they should be inside the grace section,
2253 for example,
2254
2255 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2256 \new Voice {
2257   \acciaccatura {
2258     \stemDown
2259     f16->
2260     \stemNeutral
2261   }
2262   g4
2263 }
2264 @end lilypond
2265
2266 @noindent
2267 The overrides should also be reverted inside the grace section.
2268
2269 The layout of grace sections can be changed throughout the music using
2270 the function @code{add-grace-property}.  The following example
2271 undefines the @code{Stem} direction for this grace, so
2272 that stems do not always point up.
2273
2274 @example
2275 \new Staff @{
2276   #(add-grace-property 'Voice 'Stem 'direction '())
2277   @dots{}
2278 @}
2279 @end example
2280
2281 @noindent
2282 Another option is to change the variables @code{startGraceMusic},
2283 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2284 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2285 @code{stopAppoggiaturaMusic}.  More information is in the file
2286 @file{ly/@/grace@/-init@/.ly}.
2287
2288 @noindent
2289 The slash through the stem in acciaccaturas can be obtained
2290 in other situations by @code{\override Stem  #'stroke-style = #"grace"}.
2291
2292 @seealso
2293
2294 Program reference: @internalsref{GraceMusic}.
2295
2296
2297 @refbugs
2298
2299 A score that starts with a @code{\grace} section needs an explicit
2300 @code{\new Voice} declaration, otherwise the main note and the grace
2301 note end up on different staves.
2302
2303 Grace note synchronization can also lead to surprises.  Staff notation,
2304 such as key signatures, bar lines, etc., are also synchronized.  Take
2305 care when you mix staves with grace notes and staves without, for example,
2306
2307 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2308 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2309    \new Staff { c4 \bar "|:" d4 } >>
2310 @end lilypond
2311
2312 @noindent
2313 This can be remedied by inserting grace skips of the corresponding
2314 durations in the other staves. For the above example
2315
2316 @example
2317 \new Staff @{ c4 \bar "|:" \grace s16 d4 @}
2318 @end example
2319
2320 Grace sections should only be used within sequential music
2321 expressions.  Nesting or juxtaposing grace sections is not supported,
2322 and might produce crashes or other errors.
2323
2324
2325
2326 @node Expressive marks
2327 @section Expressive marks
2328
2329 Expressive marks help musicians to bring more to the music than simple
2330 notes and rhythms.
2331
2332 @menu
2333 * Articulations::               
2334 * Fingering instructions::      
2335 * Dynamics::                    
2336 * Breath marks::                
2337 * Trills::                      
2338 * Glissando::                   
2339 * Arpeggio::                    
2340 @end menu
2341
2342
2343 @node Articulations
2344 @subsection Articulations
2345
2346 @cindex Articulations
2347 @cindex scripts
2348 @cindex ornaments
2349
2350 A variety of symbols can appear above and below notes to indicate
2351 different characteristics of the performance.  They are added to a note
2352 by adding a dash and the character signifying the
2353 articulation.  They are demonstrated here
2354
2355 @lilypondfile[quote,ragged-right]{script-abbreviations.ly}
2356
2357 The meanings of these shorthands can be changed.  See
2358 @file{ly/@/script@/-init@/.ly} for examples.
2359
2360 The script is automatically placed, but the direction can be forced as
2361 well.  Like other pieces of LilyPond code, @code{_} will place them
2362 below the staff, and @code{^} will place them above.
2363
2364 @lilypond[quote,ragged-right,fragment,verbatim]
2365 c''4^^ c''4_^
2366 @end lilypond
2367
2368 Other symbols can be added using the syntax
2369 @var{note}@code{\}@var{name}.  Again, they
2370 can be forced up or down using @code{^} and @code{_},
2371 e.g.,
2372
2373 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
2374 c\fermata c^\fermata c_\fermata
2375 @end lilypond
2376
2377 @cindex accent
2378 @cindex marcato
2379 @cindex staccatissimo
2380 @cindex espressivo
2381 @cindex fermata
2382 @cindex stopped
2383 @cindex staccato
2384 @cindex portato
2385 @cindex tenuto
2386 @cindex upbow
2387 @cindex downbow
2388 @cindex foot marks
2389 @cindex organ pedal marks
2390 @cindex turn
2391 @cindex open
2392 @cindex flageolet
2393 @cindex reverseturn
2394 @cindex trill
2395 @cindex prall
2396 @cindex mordent
2397 @cindex prallprall
2398 @cindex prallmordent
2399 @cindex prall, up
2400 @cindex prall, down
2401 @cindex mordent
2402 @cindex thumb marking
2403 @cindex segno
2404 @cindex coda
2405 @cindex varcoda
2406
2407 Here is a chart showing all scripts available,
2408
2409 @lilypondfile[ragged-right,quote]{script-chart.ly}
2410
2411
2412 @commonprop
2413
2414 The vertical ordering of scripts is controlled with the
2415 @code{script-priority} property.  The lower this number, the closer it
2416 will be put to the note.  In this example, the
2417 @internalsref{TextScript} (the sharp symbol) first has the lowest
2418 priority, so it is put lowest in the first example.  In the second, the
2419 prall trill (the @internalsref{Script}) has the lowest, so it is on the
2420 inside.  When two objects have the same priority, the order in which
2421 they are entered decides which one comes first.
2422
2423 @lilypond[verbatim,relative=3,ragged-right,fragment,quote]
2424 \once \override TextScript #'script-priority = #-100
2425 a4^\prall^\markup { \sharp }
2426
2427 \once \override Script #'script-priority = #-100
2428 a4^\prall^\markup { \sharp }
2429 @end lilypond
2430
2431
2432 @seealso
2433
2434 Program reference: @internalsref{Script}.
2435
2436
2437 @refbugs
2438
2439 These signs appear in the printed output but have no effect on the
2440 MIDI rendering of the music.
2441
2442
2443 @node Fingering instructions
2444 @subsection Fingering instructions
2445
2446 @cindex fingering
2447 @cindex finger change
2448
2449 Fingering instructions can be entered using
2450 @example
2451 @var{note}-@var{digit}
2452 @end example
2453 For finger changes, use markup texts
2454
2455 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2456 c4-1 c-2 c-3 c-4
2457 c^\markup { \finger "2 - 3" }
2458 @end lilypond
2459
2460 You can use the thumb-script to indicate that a note should be
2461 played with the thumb (e.g., in cello music)
2462 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2463 <a_\thumb a'-3>8 <b_\thumb b'-3>
2464 @end lilypond
2465
2466 Fingerings for chords can also be added to individual notes
2467 of the chord by adding them after the pitches
2468 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2469 < c-1 e-2 g-3 b-5 >4
2470 @end lilypond
2471
2472
2473 @commonprop
2474
2475 You may exercise greater control over fingering chords by
2476 setting @code{fingeringOrientations}
2477
2478 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2479 \set fingeringOrientations = #'(left down)
2480 <c-1 es-2 g-4 bes-5 > 4
2481 \set fingeringOrientations = #'(up right down)
2482 <c-1 es-2 g-4 bes-5 > 4
2483 @end lilypond
2484
2485 Using this feature, it is also possible to put fingering instructions
2486 very close to note heads in monophonic music,
2487
2488 @lilypond[verbatim,ragged-right,quote,fragment]
2489 \set fingeringOrientations = #'(right)
2490 <es'-2>4
2491 @end lilypond
2492
2493
2494 @seealso
2495
2496 Program reference: @internalsref{Fingering}.
2497
2498 Examples: @inputfileref{input/@/regression,finger@/-chords@/.ly}.
2499
2500
2501 @node Dynamics
2502 @subsection Dynamics
2503
2504 @cindex Dynamics
2505 @funindex \pppp
2506 @funindex \ppp
2507 @funindex \pp
2508 @funindex \p
2509 @funindex \mp
2510 @funindex \mf
2511 @funindex \f
2512 @funindex \ff
2513 @funindex \fff
2514 @funindex \ffff
2515 @funindex \fp
2516 @funindex \sf
2517 @funindex \sff
2518 @funindex \sp
2519 @funindex \spp
2520 @funindex \sfz
2521 @funindex \rfz
2522
2523 Absolute dynamic marks are specified using a command after a note
2524 @code{c4\ff}.  The available dynamic marks are @code{\ppppp},
2525 @code{\pppp}, @code{\ppp},
2526 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2527 @code{\fff}, @code{\ffff}, @code{\fp}, @code{\sf}, @code{\sff},
2528 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2529
2530 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2531 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2532 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2533 @end lilypond
2534
2535 @funindex \<
2536 @funindex \>
2537 @funindex \!
2538
2539 A crescendo mark is started with @code{\<} and terminated with
2540 @code{\!} or an absolute dynamic.  A decrescendo is started with
2541 @code{\>} and is also terminated with @code{\!} or an absolute
2542 dynamic.  @code{\cr} and @code{\decr} may be used instead of
2543 @code{\<} and @code{\>}.  Because these marks are bound to notes, you must
2544 use spacer notes if multiple marks are needed during one note
2545
2546 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2547 c\< c\! d\> e\!
2548 << f1 { s4 s4\< s4\! \> s4\! } >>
2549 @end lilypond
2550
2551 @noindent
2552 A hairpin starts at the left edge of the beginning note and ends on the
2553 right edge of the ending note.
2554
2555 In some situations the @code{\espressivo} articulation mark may
2556 be suitable to indicate a crescendo and decrescendo on the one note,
2557
2558 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2559 c2 b4 a g1\espressivo
2560 @end lilypond
2561
2562 This may give rise to very short hairpins.  Use @code{minimum-length}
2563 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2564 example
2565
2566 @example
2567 \override Voice.Hairpin #'minimum-length = #5
2568 @end example
2569
2570 @cindex crescendo
2571 @cindex decrescendo
2572 @cindex diminuendo
2573
2574 You can also use text saying @emph{cresc.} instead of hairpins
2575
2576 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2577 \setTextCresc
2578 c\< d e f\!
2579 \setHairpinCresc
2580 e\> d c b\!
2581 \setTextDecresc
2582 c\> d e f\!
2583 \setTextDim
2584 e\> d c b\!
2585 @end lilypond
2586
2587 You can also supply your own texts
2588 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2589 \set crescendoText = \markup { \italic "cresc. poco" }
2590 \set crescendoSpanner = #'dashed-line
2591 a'2\< a a a\!\mf
2592 @end lilypond
2593
2594 To create new dynamic marks or text that should be aligned
2595 with dynamics, see @ref{New dynamic marks}.
2596
2597
2598 @commonprop
2599
2600 Dynamics that occur at, begin on, or end on, the same note
2601 will be vertically aligned.  If you want to ensure that dynamics
2602 are aligned when they do not occur on the same note, you can
2603 increase the @code{staff-padding} property.
2604
2605 @example
2606 \override DynamicLineSpanner #'staff-padding = #4
2607 @end example
2608
2609 You may also use this property if the dynamics are colliding
2610 with other notation.
2611
2612 Crescendi and decrescendi that end on the first note of a
2613 new line are not printed.  To change this behavior, use
2614
2615 @example
2616 \override Score.Hairpin #'after-line-breaking = ##t
2617 @end example
2618
2619 Text style dynamic changes (such as @emph{cresc.} and @emph{dim.})
2620 are printed with a
2621 dashed line showing their extent.  To surpress printing this line, use
2622
2623 @example
2624 \override DynamicTextSpanner #'dash-period = #-1.0
2625 @end example
2626
2627
2628 @refcommands
2629
2630 @funindex \dynamicUp
2631 @code{\dynamicUp},
2632 @funindex \dynamicDown
2633 @code{\dynamicDown},
2634 @funindex \dynamicNeutral
2635 @code{\dynamicNeutral}.
2636
2637
2638 @seealso
2639
2640 Program reference: @internalsref{DynamicText}, @internalsref{Hairpin}.
2641 Vertical positioning of these symbols is handled by
2642 @internalsref{DynamicLineSpanner}.
2643
2644
2645 @node Breath marks
2646 @subsection Breath marks
2647
2648 Breath marks are entered using @code{\breathe}
2649
2650 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2651 c'4 \breathe d4
2652 @end lilypond
2653
2654
2655 @commonprop
2656
2657 The glyph of the breath mark can be tuned by overriding the
2658 @code{text} property of the @code{BreathingSign} layout object with
2659 any markup text.  For example,
2660 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2661 c'4
2662 \override BreathingSign #'text
2663   = #(make-musicglyph-markup "scripts.rvarcomma")
2664 \breathe
2665 d4
2666 @end lilypond
2667
2668 @seealso
2669
2670 Program reference: @internalsref{BreathingSign}.
2671
2672 Examples: @inputfileref{input/@/regression,breathing@/-sign@/.ly}.
2673
2674
2675 @node Trills
2676 @subsection Trills
2677
2678 Short trills are printed like normal articulation; see @ref{Articulations}.
2679
2680 Long running trills are made with @code{\startTrillSpan} and
2681 @code{\stopTrillSpan},
2682
2683 @lilypond[verbatim,ragged-right,relative=2,quote,fragment]
2684 \new Voice {
2685   << { c1 \startTrillSpan }
2686      { s2. \grace { d16[\stopTrillSpan e] } } >>
2687   c4 }
2688 @end lilypond
2689
2690 @cindex Pitched trills
2691
2692 Trills that should be executed on an explicitly specified pitch can be
2693 typeset with the command @code{pitchedTrill},
2694
2695 @lilypond[ragged-right,verbatim,fragment,relative=1,quote]
2696 \pitchedTrill c4\startTrillSpan fis
2697 f\stopTrillSpan
2698 @end lilypond
2699
2700 The first argument is the main note.  The pitch of the second
2701 is printed as a stemless note head in parentheses.
2702
2703
2704 @refcommands
2705
2706 @code{\startTrillSpan},
2707 @funindex \startTrillSpan
2708 @code{\stopTrillSpan}.
2709 @funindex \stopTrillSpan
2710
2711
2712 @seealso
2713
2714 Program reference: @internalsref{TrillSpanner}.
2715
2716
2717 @node Glissando
2718 @subsection Glissando
2719
2720 @cindex Glissando
2721 @funindex \glissando
2722
2723 A glissando is a smooth change in pitch.  It is denoted by a line or a
2724 wavy line between two notes.  It is requested by attaching
2725 @code{\glissando} to a note
2726
2727 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2728 c2\glissando c'
2729 \override Glissando #'style = #'zigzag
2730 c2\glissando c,
2731 @end lilypond
2732
2733
2734 @seealso
2735
2736 Program reference: @internalsref{Glissando}.
2737
2738 Example files: @file{input/@/regression/@/glissando@/.ly}.
2739
2740
2741 @refbugs
2742
2743 Printing text over the line (such as @emph{gliss.}) is not supported.
2744
2745
2746 @node Arpeggio
2747 @subsection Arpeggio
2748
2749 @cindex Arpeggio
2750 @cindex broken chord
2751 @funindex \arpeggio
2752
2753 You can specify an arpeggio sign (also known as broken chord) on a
2754 chord by attaching an @code{\arpeggio} to a chord
2755
2756 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2757 <c e g c>\arpeggio
2758 @end lilypond
2759
2760 A square bracket on the left indicates that the player should not
2761 arpeggiate the chord
2762
2763 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2764 \arpeggioBracket
2765 <c' e g c>\arpeggio
2766 @end lilypond
2767
2768 The direction of the arpeggio is sometimes denoted by adding an
2769 arrowhead to the wiggly line
2770
2771 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2772 \new Voice {
2773   \arpeggioUp
2774   <c e g c>\arpeggio
2775   \arpeggioDown
2776   <c e g c>\arpeggio
2777 }
2778 @end lilypond
2779
2780
2781 @commonprop
2782
2783 When an arpeggio crosses staves, you may attach an arpeggio to the chords
2784 in both staves and set
2785 @internalsref{PianoStaff}.@code{connectArpeggios}
2786
2787 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2788 \new PianoStaff <<
2789   \set PianoStaff.connectArpeggios = ##t
2790   \new Staff { <c' e g c>\arpeggio }
2791   \new Staff { \clef bass <c,, e g>\arpeggio }
2792 >>
2793 @end lilypond
2794
2795
2796 @refcommands
2797
2798 @code{\arpeggio},
2799 @funindex \arpeggioUp
2800 @code{\arpeggioUp},
2801 @funindex \arpeggioDown
2802 @code{\arpeggioDown},
2803 @funindex \arpeggioNeutral
2804 @code{\arpeggioNeutral},
2805 @funindex \arpeggioBracket
2806 @code{\arpeggioBracket}.
2807
2808
2809 @seealso
2810
2811 Notation manual: @ref{Ties}, for writing out arpeggios.
2812
2813 Program reference: @internalsref{Arpeggio}.
2814
2815
2816 @refbugs
2817
2818 It is not possible to mix connected arpeggios and unconnected
2819 arpeggios in one @internalsref{PianoStaff} at the same point in time.
2820
2821
2822
2823
2824
2825 @node Repeats
2826 @section Repeats
2827
2828 Repetition is a central concept in music, and multiple notations exist
2829 for repetitions.
2830
2831 @menu
2832 * Repeat types::                
2833 * Repeat syntax::               
2834 * Repeats and MIDI::            
2835 * Manual repeat commands::      
2836 * Tremolo repeats::             
2837 * Tremolo subdivisions::        
2838 * Measure repeats::             
2839 @end menu
2840
2841
2842 @node Repeat types
2843 @subsection Repeat types
2844
2845 @cindex repeats
2846 @funindex \repeat
2847
2848 The following types of repetition are supported
2849
2850 @table @code
2851 @item unfold
2852 Repeated music is fully written (played) out.  This is useful when
2853 entering repetitious music.  This is the only kind of repeat that
2854 is included in MIDI output.
2855
2856 @item volta
2857 Repeats are not written out, but alternative endings (volte) are
2858 printed, left to right with brackets.  This is the standard notation
2859 for repeats with alternatives.  These are not played in MIDI output by
2860 default.
2861
2862 @ignore
2863 @item fold
2864 Alternative endings are written stacked.  This has limited use but may be
2865 used to typeset two lines of lyrics in songs with repeats, see
2866 @inputfileref{input,star-spangled-banner@/.ly}.
2867 @end ignore
2868
2869 @item tremolo
2870 Make tremolo beams.  These are not played in MIDI output by default.
2871
2872 @item percent
2873 Make beat or measure repeats.  These look like percent signs.  These
2874 are not played in MIDI output by default.  Percent repeats must be
2875 declared within a @code{Voice} context.
2876
2877 @end table
2878
2879
2880 @node Repeat syntax
2881 @subsection Repeat syntax
2882
2883 LilyPond has one syntactic construct for specifying different types of
2884 repeats.  The syntax is
2885
2886 @example
2887 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2888 @end example
2889
2890 If you have alternative endings, you may add
2891 @funindex \alternative
2892 @example
2893 \alternative @{
2894   @var{alternative1}
2895   @var{alternative2}
2896   @var{alternative3}
2897   @dots{}
2898 @}
2899 @end example
2900
2901 @noindent
2902 where each @var{alternative} is a music expression.  If you do not
2903 give enough alternatives for all of the repeats, the first alternative
2904 is assumed to be played more than once.
2905
2906 Standard repeats are used like this
2907 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2908 c1
2909 \repeat volta 2 { c4 d e f }
2910 \repeat volta 2 { f e d c }
2911 @end lilypond
2912
2913 With alternative endings
2914 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2915 c1
2916 \repeat volta 2 {c4 d e f}
2917 \alternative { {d2 d} {f f,} }
2918 @end lilypond
2919
2920 In the following example, the first ending is not a complete
2921 bar (it only had 3 beats).  The beginning of the second ending
2922 contains the 4th beat from the first ending.  This ``extra''
2923 beat in the second ending is due to the first time ending,
2924 and has nothing to do with the @code{\partial} at the
2925 beginning of the example.
2926
2927 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2928 \new Staff {
2929   \partial 4
2930   \repeat volta 4 { e | c2 d2 | e2 f2 | }
2931   \alternative { { g4 g g } { a | a a a a | b2. } }
2932 }
2933 @end lilypond
2934
2935 @funindex \repeatTie
2936
2937 Ties may be added to a second ending,
2938
2939 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2940 c1
2941 \repeat volta 2 {c4 d e f ~ }
2942 \alternative { {f2 d} {f\repeatTie f,} }
2943 @end lilypond
2944
2945 It is possible to shorten volta brackets
2946 by setting @code{voltaSpannerDuration}.  In the next example, the
2947 bracket only lasts one measure, which is a duration of 3/4.
2948
2949 @lilypond[verbatim,ragged-right,quote]
2950 \relative c''{
2951   \time 3/4
2952   c c c
2953   \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2954   \repeat "volta" 5 { d d d }
2955   \alternative { { e e e f f f }
2956   { g g g } }
2957 }
2958 @end lilypond
2959
2960
2961 @seealso
2962
2963 Examples:
2964
2965 Brackets for the repeat are normally only printed over the topmost
2966 staff.  This can be adjusted by setting the @code{voltaOnThisStaff}
2967 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2968
2969
2970 @refbugs
2971
2972 @cindex repeat, ambiguous
2973
2974 A nested repeat like
2975
2976 @example
2977 \repeat @dots{}
2978 \repeat @dots{}
2979 \alternative
2980 @end example
2981
2982 @noindent
2983 is ambiguous, since it is is not clear to which @code{\repeat} the
2984 @code{\alternative} belongs.  This ambiguity is resolved by always
2985 having the @code{\alternative} belong to the inner @code{\repeat}.
2986 For clarity, it is advisable to use braces in such situations.
2987
2988 Timing information is not remembered at the start of an alternative,
2989 so after a repeat timing information must be reset by hand; for
2990 example, by setting @code{Score.measurePosition} or entering
2991 @code{\partial}.  Similarly, slurs or ties are also not repeated.
2992
2993
2994 @node Repeats and MIDI
2995 @subsection Repeats and MIDI
2996
2997 @cindex expanding repeats
2998 @funindex \unfoldRepeats
2999
3000 With a little bit of tweaking, all types of repeats can be present
3001 in the MIDI output.  This is achieved by applying the
3002 @code{\unfoldRepeats} music function.  This function changes all
3003 repeats to unfold repeats.
3004
3005 @lilypond[quote,verbatim,fragment,line-width=8.0\cm]
3006 \unfoldRepeats {
3007   \repeat tremolo 8 {c'32 e' }
3008   \repeat percent 2 { c''8 d'' }
3009   \repeat volta 2 {c'4 d' e' f'}
3010   \alternative {
3011     { g' a' a' g' }
3012     {f' e' d' c' }
3013   }
3014 }
3015 \bar "|."
3016 @end lilypond
3017
3018 When creating a score file using @code{\unfoldRepeats} for MIDI,
3019 it is necessary to make two @code{\score} blocks: one for MIDI (with
3020 unfolded repeats) and one for notation (with volta, tremolo, and
3021 percent repeats).  For example,
3022
3023 @example
3024 \score @{
3025   @var{..music..}
3026   \layout @{ .. @}
3027 @}
3028 \score @{
3029   \unfoldRepeats @var{..music..}
3030   \midi @{ .. @}
3031 @}
3032 @end example
3033
3034
3035 @node Manual repeat commands
3036 @subsection Manual repeat commands
3037
3038 @funindex repeatCommands
3039
3040 The property @code{repeatCommands} can be used to control the layout of
3041 repeats.  Its value is a Scheme list of repeat commands.
3042
3043 @table @asis
3044 @item @code{start-repeat}
3045 Print a @code{|:} bar line.
3046
3047 @item @code{end-repeat}
3048 Print a @code{:|} bar line.
3049
3050 @item @code{(volta @var{text})}
3051 Print a volta bracket saying @var{text}: The text can be specified as
3052 a text string or as a markup text, see @ref{Text markup}.  Do not
3053 forget to change the font, as the default number font does not contain
3054 alphabetic characters;
3055
3056 @item @code{(volta #f)}
3057 Stop a running volta bracket.
3058 @end table
3059
3060 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
3061 c4
3062   \set Score.repeatCommands = #'((volta "93") end-repeat)
3063 c4 c4
3064   \set Score.repeatCommands = #'((volta #f))
3065 c4 c4
3066 @end lilypond
3067
3068
3069 @seealso
3070
3071 Program reference: @internalsref{VoltaBracket},
3072 @internalsref{RepeatedMusic},
3073 @internalsref{VoltaRepeatedMusic},
3074 @internalsref{UnfoldedRepeatedMusic}, and
3075 @internalsref{FoldedRepeatedMusic}.
3076
3077
3078 @node Tremolo repeats
3079 @subsection Tremolo repeats
3080
3081 @cindex tremolo beams
3082
3083 To place tremolo marks between notes, use @code{\repeat} with tremolo
3084 style
3085 @lilypond[quote,verbatim,ragged-right]
3086 \new Voice \relative c' {
3087   \repeat "tremolo" 8 { c16 d16 }
3088   \repeat "tremolo" 4 { c16 d16 }
3089   \repeat "tremolo" 2 { c16 d16 }
3090 }
3091 @end lilypond
3092
3093 Tremolo marks can also be put on a single note.  In this case, the
3094 note should not be surrounded by braces.
3095 @lilypond[quote,verbatim,ragged-right]
3096 \repeat "tremolo" 4 c'16
3097 @end lilypond
3098
3099 Similar output is obtained using the tremolo subdivision, described in
3100 @ref{Tremolo subdivisions}.
3101
3102
3103 @seealso
3104
3105 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
3106
3107 Program reference: @internalsref{Beam}, @internalsref{StemTremolo}.
3108
3109 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
3110 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
3111
3112
3113 @node Tremolo subdivisions
3114 @subsection Tremolo subdivisions
3115
3116 @cindex tremolo marks
3117 @funindex tremoloFlags
3118
3119 Tremolo marks can be printed on a single note by adding
3120 `@code{:}[@var{number}]' after the note.  The number indicates the
3121 duration of the subdivision, and it must be at least 8.  A
3122 @var{length} value of 8 gives one line across the note stem.  If the
3123 length is omitted, the last value (stored in @code{tremoloFlags}) is
3124 used
3125
3126 @lilypond[quote,ragged-right,verbatim,fragment]
3127 c'2:8 c':32 | c': c': |
3128 @end lilypond
3129
3130
3131 @refbugs
3132
3133 Tremolos entered in this way do not carry over into the MIDI output.
3134
3135
3136 @seealso
3137
3138 In this manual: @ref{Tremolo repeats}.
3139
3140 Elsewhere: @internalsref{StemTremolo}.
3141
3142
3143 @node Measure repeats
3144 @subsection Measure repeats
3145
3146 @cindex percent repeats
3147 @cindex measure repeats
3148
3149 In the @code{percent} style, a note pattern can be repeated.  It is
3150 printed once, and then the pattern is replaced with a special sign.
3151 Patterns of one and two measures are replaced by percent-like signs,
3152 patterns that divide the measure length are replaced by slashes.
3153 Percent repeats must be declared within a @code{Voice} context.
3154
3155 @lilypond[quote,verbatim,ragged-right]
3156 \new Voice \relative c' {
3157   \repeat "percent" 4 { c4 }
3158   \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
3159 }
3160 @end lilypond
3161
3162 Measure repeats of more than 2 measures get a counter, if you switch
3163 on the @code{countPercentRepeats} property,
3164
3165 @lilypond[relative=2,fragment,quote,verbatim,ragged-right]
3166 \new Voice {
3167 \set countPercentRepeats = ##t
3168   \repeat "percent" 4 { c1 }
3169 }
3170 @end lilypond
3171
3172
3173
3174 Isolated percents can also be printed. This is done by putting a
3175 multi-measure rest with a different print function,
3176
3177 @lilypond[fragment,verbatim,quote]
3178 \override MultiMeasureRest #'stencil
3179   = #ly:multi-measure-rest::percent
3180 R1
3181 @end lilypond
3182
3183
3184
3185
3186 @seealso
3187
3188 Program reference: @internalsref{RepeatSlash},
3189 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
3190 @internalsref{DoublePercentRepeatCounter},
3191 @internalsref{PercentRepeatCounter},
3192 @internalsref{PercentRepeatedMusic}.
3193
3194
3195