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