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