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