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