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