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