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