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