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