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