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