]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/basic-notation.itely
Misc small updates from bugs and mailist.
[lilypond.git] / Documentation / user / basic-notation.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
3 @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: @lsr{scheme,transpose-pitches-with-minimum-accidentals.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 Use the @code{\tweak} function to override nested tuplets beginning at the
766 same music moment.  In this example, @code{\tweak} specifies fraction
767 text for the
768 outer @code{TupletNumber} and denominator text for the @code{TupletNumber}
769 of the first of the three inner tuplets.
770
771 @lilypond[quote,ragged-right,verbatim]
772 \new Staff {
773   \tweak #'text #tuplet-number::calc-fraction-text
774   \times 4/3 {
775      \tweak #'text #tuplet-number::calc-denominator-text
776      \times 2/3 { c'8[ c'8 c'8] }
777      \times 2/3 { c'8[ c'8 c'8] }
778      \times 2/3 { c'8[ c'8 c'8] }
779   }
780 }
781 @end lilypond
782
783 Here @code{\tweak} and @code{\override} work together to specify
784 @code{TupletBracket} direction.  The first @code{\tweak} positions
785 the @code{TupletBracket} of the outer
786 tuplet above the staff.  The second @code{\tweak} positions the
787 @code{TupletBracket} of the first of the three inner tuplets below the
788 staff.  Note that this pair of @code{\tweak} functions affects only
789 the outer tuplet and the first of the three inner tuplets because only
790 those two tuplets begin at the same music moment.  We use @code{\override}
791 in the usual way to position the @code{TupletBrackets} of
792 the second and third of the inner tuplets below the staff.
793
794 @lilypond[quote,ragged-right,verbatim]
795 \new Staff {
796   \tweak #'text #tuplet-number::calc-fraction-text
797   \tweak #'direction #up
798   \times 4/3 {
799      \tweak #'direction #down
800      \times 2/3 { c'8[ c'8 c'8] }
801      \override TupletBracket #'direction = #down
802      \times 2/3 { c'8[ c'8 c'8] }
803      \times 2/3 { c'8[ c'8 c'8] }
804   }
805 }
806 @end lilypond
807
808 Tuplet brackets can be made to run to prefatory matter or
809 the next note
810
811 @lilypond[ragged-right]
812 \new RhythmicStaff {
813   \set tupletFullLength = ##t
814   \time 4/4
815   \times 4/5 {
816     c4 c1
817   }
818   \set tupletFullLengthNote = ##t
819   \time 2/4
820   \times 2/3 {
821     c4 c c 
822   }
823   \time 3/4
824   c4 
825 }
826 @end lilypond
827
828
829 @seealso
830
831 Program reference: @internalsref{TupletBracket},
832 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
833
834
835
836 @node Scaling durations
837 @subsection Scaling durations
838
839 You can alter the length of duration by a fraction @var{N/M}
840 appending @samp{*@var{N/M}} (or @samp{*@var{N}} if @var{M=1}).  This
841 will not affect the appearance of the notes or rests produced.  These
842 may be combined such as @samp{*M*N}.
843
844 In the following example, the first three notes take up exactly two
845 beats, but no triplet bracket is printed.
846
847 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
848 \time 2/4
849 a4*2/3 gis4*2/3 a4*2/3
850 a4 a4 a4*2
851 b16*4 c4
852 @end lilypond
853
854
855 @seealso
856
857 This manual: @ref{Tuplets}.
858
859
860 @node Bar check
861 @subsection Bar check
862
863 @cindex Bar check
864 @funindex barCheckSynchronize
865 @funindex |
866
867 Bar checks help detect errors in the durations.  A bar check is
868 entered using the bar symbol, @samp{|}.  Whenever it is encountered
869 during interpretation, it should fall on a measure boundary.  If it
870 does not, a warning is printed.  In the next example, the second bar
871 check will signal an error
872 @example
873 \time 3/4 c2 e4 | g2 |
874 @end example
875
876 Bar checks can also be used in lyrics, for example
877
878 @example
879 \lyricmode @{
880   \time 2/4
881   Twin -- kle | Twin -- kle
882 @}
883 @end example
884
885 Failed bar checks are caused by entering incorrect
886 durations.  Incorrect durations often completely garble up the score,
887 especially if the score is polyphonic, so a good place to start correcting
888 input is by scanning for failed bar checks and incorrect durations.
889
890 @funindex |
891 @funindex pipeSymbol
892
893 It is also possible to redefine the meaning of @code{|}.  This is done
894 by assigning a music expression to @code{pipeSymbol},
895
896 @lilypond[quote,ragged-right,verbatim]
897 pipeSymbol = \bar "||"
898
899 { c'2 c' | c'2 c' }
900 @end lilypond
901
902
903 @node Barnumber check
904 @subsection Barnumber check
905
906 When copying large pieces of music, it can be helpful to check that
907 the LilyPond bar number corresponds to the original that you are
908 entering from.  This can be checked with @code{\barNumberCheck}, for
909 example,
910
911 @verbatim
912 \barNumberCheck #123
913 @end verbatim
914
915 @noindent
916 will print a warning if the @code{currentBarNumber} is not 123 when it
917 is processed.
918
919
920 @node Automatic note splitting
921 @subsection Automatic note splitting
922
923 Long notes can be converted automatically to tied notes.  This is done
924 by replacing the @internalsref{Note_heads_engraver} by the
925 @internalsref{Completion_heads_engraver}.
926 In the following examples, notes crossing the bar line are split and tied.
927
928 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
929 \new Voice \with {
930   \remove "Note_heads_engraver"
931   \consists "Completion_heads_engraver"
932 } {
933   c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
934 }
935 @end lilypond
936
937 This engraver splits all running notes at the bar line, and inserts
938 ties.  One of its uses is to debug complex scores: if the measures are
939 not entirely filled, then the ties exactly show how much each measure
940 is off.
941
942 If you want to allow line breaking on the bar lines where
943 @internalsref{Completion_heads_engraver} splits notes, you must
944 also remove @internalsref{Forbid_line_break_engraver}.
945
946
947 @refbugs
948
949 Not all durations (especially those containing tuplets) can be
950 represented exactly with normal notes and dots, but the engraver will
951 not insert tuplets.
952
953 @code{Completion_heads_engraver} only affects notes; it does not split
954 rests.
955
956
957 @seealso
958
959 Program reference: @internalsref{Completion_heads_engraver}.
960
961
962 @node Polyphony
963 @section Polyphony
964
965 Polyphony in music refers to having more than one voice occurring in
966 a piece of music.  Polyphony in LilyPond refers to having more than
967 one voice on the same staff.
968
969 @menu
970 * Chords::                      
971 * Stems::                       
972 * Basic polyphony::             
973 * Explicitly instantiating voices::  
974 * Collision Resolution::        
975 @end menu
976
977
978 @node Chords
979 @subsection Chords
980
981 @cindex Chords
982
983 A chord is formed by a enclosing a set of pitches between @code{<}
984 and @code{>}.  A chord may be followed by a duration, and a set of
985 articulations, just like simple notes
986
987 @lilypond[verbatim,ragged-right,fragment,quote,relative=1]
988 <c e g>4 <c>8
989 @end lilypond
990
991 For more information about chords, see @ref{Chord names}.
992
993
994 @c  I don't like having this here, but I can't think of
995 @c  anywhere else to put it.  :(   -gp
996 @node Stems
997 @subsection Stems
998
999 Whenever a note is found, a @internalsref{Stem} object is created
1000 automatically.  For whole notes and rests, they are also created but
1001 made invisible.
1002
1003 @refcommands
1004
1005 @funindex \stemUp
1006 @code{\stemUp},
1007 @funindex \stemDown
1008 @code{\stemDown},
1009 @funindex \stemNeutral
1010 @code{\stemNeutral}.
1011
1012
1013 @commonprop
1014
1015 To change the direction of stems in the middle of the staff, use
1016
1017 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
1018 a4 b c b
1019 \override Stem #'neutral-direction = #up
1020 a4 b c b
1021 \override Stem #'neutral-direction = #down
1022 a4 b c b
1023 @end lilypond
1024
1025
1026 @node Basic polyphony
1027 @subsection Basic polyphony
1028
1029 @cindex polyphony
1030
1031 The easiest way to enter fragments with more than one voice on a staff
1032 is to enter each voice as a sequence (with @code{@{...@}}), and combine
1033 them simultaneously, separating the voices with @code{\\}
1034
1035 @funindex \\
1036
1037 @lilypond[quote,verbatim,fragment]
1038 \new Staff \relative c' {
1039   c16 d e f
1040   <<
1041     { g4 f e | d2 e2 } \\
1042     { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
1043     { s2. | s4 b4 c2 }
1044   >>
1045 }
1046 @end lilypond
1047
1048 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
1049 voices are sometimes called @q{layers} in other notation packages}
1050 @cindex layers
1051 to be instantiated.  They bear the names @code{"1"}, @code{"2"}, etc.  In
1052 each of these contexts, vertical direction of slurs, stems, etc., is set
1053 appropriately.
1054
1055 These voices are all separate from the voice that contains the notes just
1056 outside the @code{<< \\ >>} construct.  This should be noted when making
1057 changes at the voice level.  This also means that slurs and ties cannot go
1058 into or out of a @code{<< \\ >>} construct.  Conversely, parallel voices
1059 from separate @code{<< \\ >>} constructs on the same staff are the
1060 same voice.  Here is the same example, with different noteheads and
1061 colors for each
1062 voice.  Note that the change to the note-head style in the main voice does
1063 not affect
1064 the inside of the @code{<< \\ >>} constructs.  Also, the change to the
1065 second
1066 voice in the first @code{<< \\ >>} construct is effective in the second
1067 @code{<< \\ >>}, and the voice is tied across the two constructs.
1068
1069 @cindex note heads, styles
1070
1071 @lilypond[quote,verbatim,fragment]
1072 \new Staff \relative c' {
1073   \override NoteHead #'style = #'cross
1074   \override NoteHead #'color = #red
1075   c16 d e f
1076   <<
1077     { g4 f e } \\
1078     { \override NoteHead #'style = #'triangle
1079       \override NoteHead #'color = #blue
1080     r8 e4 d c8 ~ }
1081   >> |
1082   <<
1083     { d2 e2 } \\
1084     { c8 b16 a b8 g ~ g2 } \\
1085     { \override NoteHead #'style = #'slash 
1086       \override NoteHead #'color = #green
1087       s4 b4 c2 }
1088   >>
1089 }
1090 @end lilypond
1091
1092 Polyphony does not change the relationship of notes within a
1093 @code{\relative @{ @}} block.  Each note is calculated relative
1094 to the note immediately preceding it.
1095
1096 @example
1097 \relative @{ noteA << noteB \\ noteC >> noteD @}
1098 @end example
1099
1100 @code{noteC} is relative to @code{noteB}, not @code{noteA};
1101 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
1102 @code{noteA}.
1103
1104
1105 @node Explicitly instantiating voices
1106 @subsection Explicitly instantiating voices
1107
1108 @internalsref{Voice} contexts can also be instantiated manually
1109 inside a @code{<< >>} block to create polyphonic music, using
1110 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
1111 and a horizontal shift for each part.
1112
1113 Specifically,
1114 @example
1115 << \upper \\ \lower >>
1116 @end example
1117
1118 @noindent
1119 is equivalent to
1120
1121 @example
1122 <<
1123   \new Voice = "1" @{ \voiceOne \upper @}
1124   \new Voice = "2" @{ \voiceTwo \lower @}
1125 >>
1126 @end example
1127
1128 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
1129 articulations, text annotations, augmentation dots of dotted
1130 notes, and fingerings.  @code{\voiceOne} and @code{\voiceThree} make
1131 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
1132 make them point downwards.
1133 The command @code{\oneVoice} will revert back to the normal setting.
1134
1135 An expression that appears directly inside a @code{<< >>} belongs to
1136 the main voice.  This is useful when extra voices appear while the main
1137 voice is playing.  Here is a more correct rendition of the example from
1138 the previous section.  The crossed colored noteheads demonstrate that the main
1139 melody is now in a single voice context.
1140
1141 @lilypond[quote,ragged-right,verbatim]
1142 \new Staff \relative c' {
1143   \override NoteHead #'style = #'cross
1144   \override NoteHead #'color = #red
1145   c16 d e f
1146   \voiceOne
1147   <<
1148     { g4 f e | d2 e2 }
1149     \new Voice="1" { \voiceTwo
1150       r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1151       \oneVoice
1152     }
1153     \new Voice { \voiceThree
1154       s2. | s4 b4 c2
1155       \oneVoice
1156     }
1157   >>
1158   \oneVoice
1159 }
1160 @end lilypond
1161
1162 The correct definition of the voices allows the melody to be slurred.
1163 @lilypond[quote,ragged-right,verbatim]
1164 \new Staff \relative c' {
1165   c16^( d e f
1166   \voiceOne
1167   <<
1168     { g4 f e | d2 e2) }
1169     \context Voice="1" { \voiceTwo
1170       r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1171       \oneVoice
1172     }
1173     \new Voice { \voiceThree
1174       s2. s4 b4 c2
1175       \oneVoice
1176     }
1177   >>
1178   \oneVoice
1179 }
1180 @end lilypond
1181
1182 Avoiding the @code{\\} separator also allows nesting polyphony
1183 constructs, which in some case might be a more natural way to typeset
1184 the music.
1185
1186 @lilypond[quote,ragged-right,verbatim]
1187 \new Staff \relative c' {
1188   c16^( d e f
1189   \voiceOne
1190   <<
1191     { g4 f e | d2 e2) }
1192     \context Voice="1" { \voiceTwo
1193       r8 e4 d c8 ~ |
1194       <<
1195         {c8 b16 a b8 g ~ g2}
1196         \new Voice { \voiceThree
1197           s4 b4 c2
1198           \oneVoice
1199         }
1200       >>
1201     \oneVoice
1202     }
1203   >>
1204   \oneVoice
1205 }
1206 @end lilypond
1207
1208 In some instances of complex polyphonic music, you may need additional
1209 voices to avoid collisions between notes.  Additional voices are added
1210 by defining an identifier, as shown below:
1211
1212 @lilypond[quote,verbatim,ragged-right,relative=2]
1213 voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice)
1214
1215 \relative c''' <<
1216   { \voiceOne g4 ~  \stemDown g32[ f( es d c b a b64 )g] } \\
1217   { \voiceThree  b4} \\
1218   { \voiceFive d,} \\
1219   { \voiceTwo g,}
1220 >>
1221 @end lilypond
1222
1223
1224 @node Collision Resolution
1225 @subsection Collision Resolution
1226
1227 Normally, note heads with a different number of dots are not merged, but
1228 when the object property @code{merge-differently-dotted} is set in
1229 the @internalsref{NoteCollision} object, they are merged:
1230
1231 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
1232 \new Voice << {
1233   g8 g8
1234   \override Staff.NoteCollision
1235     #'merge-differently-dotted = ##t
1236   g8 g8
1237 } \\ { g8.[ f16] g8.[ f16] } >>
1238 @end lilypond
1239
1240 Similarly, you can merge half note heads with eighth notes, by setting
1241 @code{merge-differently-headed}:
1242
1243 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
1244 \new Voice << {
1245   c8 c4.
1246   \override Staff.NoteCollision
1247     #'merge-differently-headed = ##t
1248 c8 c4. } \\ { c2 c2 } >>
1249 @end lilypond
1250
1251 @noindent
1252 @code{merge-differently-headed} and @code{merge-differently-dotted}
1253 only apply to opposing stem directions (ie. Voice 1 & 2).
1254
1255 LilyPond also vertically shifts rests that are opposite of a stem,
1256 for example
1257
1258 @lilypond[quote,ragged-right,fragment,verbatim]
1259 \new Voice << c''4 \\ r4 >>
1260 @end lilypond
1261
1262 If three or more notes line up in the same column,
1263 @code{merge-differently-headed} cannot
1264 successfully complete the merge of the two notes that should be merged.
1265 To allow the merge to work properly, apply a @code{\shift} to the note that
1266 should not be merged.  In the first measure of following example,
1267 @code{merge-differently-headed} does not work (the half-note head is
1268 solid).  In the second measure, @code{\shiftOn} is applied to move the
1269 top @code{g} out of the column, and @code{merge-differently-headed}
1270 works properly.
1271
1272 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1273 \override Staff.NoteCollision #'merge-differently-headed = ##t
1274 <<
1275   { d=''2 g2 } \\
1276   { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
1277   { \voiceFour e,,2 e'2}
1278 >>
1279 <<
1280   { d'=''2 \shiftOn g2 } \\ 
1281   { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
1282   { \voiceFour e,,2 e'2}
1283 >>
1284 @end lilypond
1285
1286
1287 @refcommands
1288
1289 @funindex \oneVoice
1290 @code{\oneVoice},
1291 @funindex \voiceOne
1292 @code{\voiceOne},
1293 @funindex \voiceTwo
1294 @code{\voiceTwo},
1295 @funindex \voiceThree
1296 @code{\voiceThree},
1297 @funindex \voiceFour
1298 @code{\voiceFour}.
1299
1300 @funindex \shiftOn
1301 @code{\shiftOn},
1302 @funindex \shiftOnn
1303 @code{\shiftOnn},
1304 @funindex \shiftOnnn
1305 @code{\shiftOnnn},
1306 @funindex \shiftOff
1307 @code{\shiftOff}: these commands specify the
1308 degree to which chords of the current voice should be shifted.
1309 The outer voices (normally: voice one and
1310 two) have @code{\shiftOff}, while the inner voices (three and four)
1311 have @code{\shiftOn}.  @code{\shiftOnn} and @code{\shiftOnnn} define
1312 further shift levels.
1313
1314 When LilyPond cannot cope, the @code{force-hshift}
1315 property of the @internalsref{NoteColumn} object and pitched rests can
1316 be used to override typesetting decisions.
1317
1318 @lilypond[quote,verbatim,ragged-right]
1319 \relative <<
1320 {
1321   <d g>
1322   <d g>
1323 } \\ {
1324   <b f'>
1325   \once \override NoteColumn #'force-hshift = #1.7
1326   <b f'>
1327 } >>
1328 @end lilypond
1329
1330
1331 @seealso
1332
1333 Program reference: the objects responsible for resolving collisions are
1334 @internalsref{NoteCollision} and @internalsref{RestCollision}.
1335
1336
1337 @refbugs
1338
1339 When using @code{merge-differently-headed} with an upstem eighth or a
1340 shorter note, and a downstem half note, the eighth note gets the wrong
1341 offset.
1342
1343 There is no support for clusters where the same note occurs with
1344 different accidentals in the same chord.  In this case, it is
1345 recommended to use enharmonic transcription, or to use special cluster
1346 notation (see @ref{Clusters}).
1347
1348
1349
1350 @node Staff notation
1351 @section Staff notation
1352
1353 @cindex Staff notation
1354
1355 This section describes music notation that occurs on staff level,
1356 such as key signatures, clefs and time signatures.
1357
1358 @menu
1359 * Clef::                        
1360 * Key signature::               
1361 * Time signature::              
1362 * Partial measures::            
1363 * Bar lines::                   
1364 * Unmetered music::             
1365 * System start delimiters::     
1366 * Staff symbol::                
1367 * Writing music in parallel::   
1368 @end menu
1369
1370
1371 @node Clef
1372 @subsection Clef
1373
1374 @funindex \clef
1375
1376 The clef indicates which lines of the staff correspond to which
1377 pitches.  The clef is set with the @code{\clef} command
1378
1379 @lilypond[quote,ragged-right,fragment,verbatim]
1380 { c''2 \clef alto g'2 }
1381 @end lilypond
1382
1383 @cindex treble clef
1384 @cindex violin clef
1385 @cindex alto clef
1386 @cindex tenor clef
1387 @cindex bass clef
1388 @cindex french clef
1389 @cindex soprano clef
1390 @cindex mezzosoprano clef
1391 @cindex baritone clef
1392 @cindex varbaritone clef
1393 @cindex subbass clef
1394
1395 Supported clefs include
1396
1397 @multitable @columnfractions .33 .66
1398 @headitem Clef @tab Position
1399 @item @code{treble}, violin, G, G2 @tab
1400 G clef on 2nd line
1401 @item @code{alto, C} @tab
1402 C clef on 3rd line
1403 @item @code{tenor} @tab
1404 C clef on 4th line.
1405 @item @code{bass, F} @tab
1406 F clef on 4th line
1407 @item @code{french} @tab
1408 G clef on 1st line, so-called French violin clef
1409 @item @code{soprano} @tab
1410 C clef on 1st line
1411 @item @code{mezzosoprano} @tab
1412 C clef on 2nd line
1413 @item @code{baritone} @tab
1414 C clef on 5th line
1415 @item @code{varbaritone} @tab
1416 F clef on 3rd line
1417 @item @code{subbass} @tab
1418 F clef on 5th line
1419 @item @code{percussion} @tab
1420 percussion clef
1421 @item @code{tab} @tab
1422 tablature clef
1423 @end multitable
1424
1425 By adding @code{_8} or @code{^8} to the clef name, the clef is
1426 transposed one octave down or up, respectively, and @code{_15} and
1427 @code{^15} transposes by two octaves.  The argument @var{clefname}
1428 must be enclosed in quotes when it contains underscores or digits.  For
1429 example,
1430
1431 @cindex choral tenor clef
1432 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
1433 \clef "G_8" c4
1434 @end lilypond
1435
1436
1437 @commonprop
1438
1439 The command @code{\clef "treble_8"} is equivalent to setting
1440 @code{clefGlyph},
1441 @code{clefPosition} (which controls the Y position of the clef),
1442 @code{middleCPosition} and @code{clefOctavation}.  A clef is printed
1443 when any of these properties are changed.  The following example shows
1444 possibilities when setting properties manually.
1445
1446 @lilypond[quote,ragged-right,verbatim]
1447 {
1448   \set Staff.clefGlyph = #"clefs.F"
1449   \set Staff.clefPosition = #2
1450   c'4
1451   \set Staff.clefGlyph = #"clefs.G"
1452   c'4
1453   \set Staff.clefGlyph = #"clefs.C"
1454   c'4
1455   \set Staff.clefOctavation = #7
1456   c'4
1457   \set Staff.clefOctavation = #0
1458   \set Staff.clefPosition = #0
1459   c'4
1460   \clef "bass"
1461   c'4
1462   \set Staff.middleCPosition = #4
1463   c'4
1464 }
1465 @end lilypond
1466
1467
1468 @seealso
1469
1470 Manual: @ref{Grace notes}.
1471
1472 Program reference: @internalsref{Clef}.
1473
1474
1475 @node Key signature
1476 @subsection Key signature
1477
1478 @cindex Key signature
1479 @funindex \key
1480
1481 The key signature indicates the tonality in which a piece is played.  It
1482 is denoted by a set of alterations (flats or sharps) at the start of the
1483 staff.
1484
1485 Setting or changing the key signature is done with the @code{\key}
1486 command
1487
1488 @example
1489 @code{\key} @var{pitch} @var{type}
1490 @end example
1491
1492 @funindex \minor
1493 @funindex \major
1494 @funindex \minor
1495 @funindex \ionian
1496 @funindex \locrian
1497 @funindex \aeolian
1498 @funindex \mixolydian
1499 @funindex \lydian
1500 @funindex \phrygian
1501 @funindex \dorian
1502 @cindex church modes
1503
1504 Here, @var{type} should be @code{\major} or @code{\minor} to get
1505 @var{pitch}-major or @var{pitch}-minor, respectively.  You may also
1506 use the standard mode names (also called @q{church modes}): @code{\ionian},
1507 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
1508 @code{\phrygian}, and @code{\dorian}.
1509
1510 This command sets the context property
1511 @code{Staff.keySignature}.  Non-standard key signatures
1512 can be specified by setting this property directly.
1513
1514 Accidentals and key signatures often confuse new users, because
1515 unaltered notes get natural signs depending on the key signature.  For
1516 more information, see @ref{Accidentals}, or @ref{Accidentals and key signatures}.
1517
1518 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1519 \key g \major
1520 f1
1521 fis
1522 @end lilypond
1523
1524
1525 @commonprop
1526
1527 A natural sign is printed to cancel any previous accidentals.  This
1528 can be suppressed by setting the @code{Staff.printKeyCancellation}
1529 property.
1530
1531 @lilypond[quote,fragment,ragged-right,fragment,verbatim,relative=2]
1532 \key d \major
1533 a b cis d
1534 \key g \minor
1535 a bes c d
1536 \set Staff.printKeyCancellation = ##f
1537 \key d \major
1538 a b cis d
1539 \key g \minor
1540 a bes c d
1541 @end lilypond
1542
1543
1544 @seealso
1545
1546 Program reference: @internalsref{KeyCancellation},
1547 @internalsref{KeySignature}.
1548
1549
1550 @node Time signature
1551 @subsection Time signature
1552
1553 @cindex Time signature
1554 @cindex meter
1555 @funindex \time
1556
1557 Time signature indicates the metrum of a piece: a regular pattern of
1558 strong and weak beats.  It is denoted by a fraction at the start of the
1559 staff.
1560
1561 The time signature is set with the @code{\time} command
1562
1563 @lilypond[quote,ragged-right,fragment,verbatim]
1564 \time 2/4 c'2 \time 3/4 c'2.
1565 @end lilypond
1566
1567 @commonprop
1568
1569 The symbol that is printed can be customized with the @code{style}
1570 property.  Setting it to @code{#'()} uses fraction style for 4/4 and
1571 2/2 time,
1572
1573 @lilypond[fragment,quote,ragged-right,verbatim]
1574 \time 4/4 c'1
1575 \time 2/2 c'1
1576 \override Staff.TimeSignature #'style = #'()
1577 \time 4/4 c'1
1578 \time 2/2 c'1
1579 @end lilypond
1580
1581 There are many more options for its layout.  See @ref{Ancient time
1582 signatures}, for more examples.
1583
1584 @code{\time} sets the property @code{timeSignatureFraction},
1585 @code{beatLength} and @code{measureLength} in the @code{Timing}
1586 context, which is normally aliased to @internalsref{Score}.  The
1587 property @code{measureLength} determines where bar lines should be
1588 inserted, and how automatic beams should be generated.  Changing the
1589 value of @code{timeSignatureFraction} also causes the symbol to be
1590 printed.
1591
1592 More options are available through the Scheme function
1593 @code{set-time-signature}.  In combination with the
1594 @internalsref{Measure_grouping_engraver}, it will create
1595 @internalsref{MeasureGrouping} signs.  Such signs ease reading
1596 rhythmically complex modern music.  In the following example, the 9/8
1597 measure is subdivided in 2, 2, 2 and 3.  This is passed to
1598 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1599
1600 @lilypond[quote,ragged-right,verbatim]
1601 \score {
1602   \relative c'' {
1603     #(set-time-signature 9 8 '(2 2 2 3))
1604     g8[ g] d[ d] g[ g] a8[( bes g]) |
1605     #(set-time-signature 5 8 '(3 2))
1606     a4. g4
1607   }
1608   \layout {
1609     \context {
1610       \Staff
1611       \consists "Measure_grouping_engraver"
1612     }
1613   }
1614 }
1615 @end lilypond
1616
1617
1618 @seealso
1619
1620 Program reference: @internalsref{TimeSignature}, and
1621 @internalsref{Timing_translator}.
1622
1623 Examples: @lsr{contemporary,compound-time-signature.ly}.
1624
1625
1626 @refbugs
1627
1628 Automatic beaming does not use the measure grouping specified with
1629 @code{set-time-signature}.
1630
1631
1632 @node Partial measures
1633 @subsection Partial measures
1634
1635 @cindex anacrusis
1636 @cindex upbeat
1637 @cindex partial measure
1638 @cindex measure, partial
1639 @cindex shorten measures
1640 @funindex \partial
1641
1642 Partial measures, such as an anacrusis or upbeat, are entered using the
1643
1644 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1645 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1646 @end lilypond
1647
1648 The syntax for this command is
1649
1650 @example
1651 \partial @var{duration}
1652 @end example
1653
1654 where @code{duration} is the rhythmic length to be added before
1655 the next bar.
1656
1657 This is internally translated into
1658
1659 @example
1660 \set Timing.measurePosition = -@var{length of duration}
1661 @end example
1662
1663 The property @code{measurePosition} contains a rational number
1664 indicating how much of the measure has passed at this point.  Note
1665 that this is a negative number; @code{\partial 4} is internally
1666 translated to mean @qq{there is a quarter note left in the bar.}
1667
1668
1669 @refbugs
1670
1671 This command does not take into account grace notes at the start of
1672 the music.  When a piece starts with graces notes in the pickup, then
1673 the @code{\partial} should follow the grace notes
1674
1675 @lilypond[verbatim,quote,ragged-right,relative,fragment]
1676 \grace f16
1677 \partial 4
1678 g4
1679 a2 g2
1680 @end lilypond
1681
1682 @code{\partial} is only intended to be used at the beginning of a
1683 piece.  If you use it after the beginning, some odd warnings may
1684 occur.
1685
1686
1687 @node Bar lines
1688 @subsection Bar lines
1689
1690 @cindex Bar lines
1691 @funindex \bar
1692 @cindex measure lines
1693 @cindex repeat bars
1694
1695 Bar lines delimit measures, but are also used to indicate
1696 repeats.  Normally they are inserted automatically.  Line
1697 breaks may only happen on bar lines.
1698
1699 Special types of bar lines can be forced with the @code{\bar} command
1700
1701 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1702 c4 \bar "|:" c4
1703 @end lilypond
1704
1705 The following bar types are available
1706
1707 @lilypondfile[ragged-right,quote]{bar-lines.ly}
1708
1709 In addition, you can specify @code{"||:"}, which is equivalent to 
1710 @code{"|:"} except at line breaks, where it gives a double bar line at
1711 the end of the line and a start repeat at the beginning of the next
1712 line. 
1713
1714 To allow a line break where there is no visible bar line, use
1715
1716 @example
1717 \bar ""
1718 @end example
1719
1720 @noindent
1721 This will insert an invisible bar line and allow line breaks at this
1722 point (without increasing the bar number counter).
1723
1724 In scores with many staves, a @code{\bar} command in one staff is
1725 automatically applied to all staves.  The resulting bar lines are
1726 connected between different staves of a @code{StaffGroup},
1727 @code{PianoStaff}, or @code{GrandStaff}.
1728
1729 @lilypond[quote,ragged-right,fragment,verbatim]
1730 <<
1731   \new StaffGroup <<
1732     \new Staff {
1733       e'4 d'
1734       \bar "||"
1735       f' e'
1736     }
1737     \new Staff { \clef bass c4 g e g }
1738   >>
1739   \new Staff { \clef bass c2 c2 }
1740 >>
1741 @end lilypond
1742
1743
1744 @commonprop
1745
1746 @funindex whichBar
1747 @funindex repeatCommands
1748 @funindex defaultBarType
1749
1750 The command @code{\bar }@var{bartype} is a short cut for doing
1751 @code{\set Timing.whichBar = }@var{bartype}.  Whenever @code{whichBar}
1752 is set to a string, a bar line of that type is created.
1753
1754 A bar line is created whenever the @code{whichBar} property is set.
1755 At the start of a measure it is set to the contents of
1756 @code{Timing.defaultBarType}.  The contents of @code{repeatCommands} are
1757 used
1758 to override default measure bars.
1759
1760 You are encouraged to use @code{\repeat} for repetitions.  See
1761 @ref{Repeats}.
1762
1763
1764 @seealso
1765
1766 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1767
1768 Program reference: @internalsref{BarLine} (created at
1769 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1770
1771
1772 @node Unmetered music
1773 @subsection Unmetered music
1774
1775 @cindex cadenza
1776 @funindex \cadenzaOn
1777 @funindex \cadenzaOff
1778
1779 Bar lines and bar numbers are calculated automatically.  For unmetered
1780 music (cadenzas, for example), this is not desirable.  To turn off
1781 automatic bar lines and bar numbers, use the commands @code{\cadenzaOn}
1782 and @code{\cadenzaOff}.
1783
1784 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1785 c4 d e d
1786 \cadenzaOn
1787 c4 c d8 d d f4 g4.
1788 \cadenzaOff
1789 \bar "|"
1790 d4 e d c
1791 @end lilypond
1792
1793
1794 @refbugs
1795
1796 LilyPond will only insert line breaks and page breaks at a
1797 barline.  Unless the unmetered music ends before the end of
1798 the staff line, you will need to insert
1799 invisible bar lines
1800
1801 @example
1802 \bar ""
1803 @end example
1804
1805 @noindent
1806 to indicate where breaks can occur.
1807
1808
1809 @node System start delimiters
1810 @subsection System start delimiters
1811
1812 @cindex start of system
1813 @cindex Staff, multiple
1814 @cindex bracket, vertical
1815 @cindex brace, vertical
1816 @cindex grand staff
1817 @cindex staff group
1818 @cindex staff, choir
1819
1820 Many scores consist of more than one staff.  These staves can be
1821 joined in four different ways
1822
1823 @itemize @bullet
1824 @item The group is started with a brace at the left, and bar lines are
1825 connected.  This is done with the @internalsref{GrandStaff} context.
1826
1827 @lilypond[verbatim,ragged-right,quote]
1828 \new GrandStaff
1829 \relative <<
1830   \new Staff { c1 c }
1831   \new Staff { c c }
1832 >>
1833 @end lilypond
1834
1835 @item The group is started with a bracket, and bar lines are connected.
1836 This is done with the
1837 @internalsref{StaffGroup} context
1838
1839 @lilypond[verbatim,ragged-right,quote]
1840 \new StaffGroup
1841 \relative <<
1842   \new Staff { c1 c }
1843   \new Staff { c c }
1844 >>
1845 @end lilypond
1846
1847 @item The group is started with a bracket, but bar lines are not
1848 connected.  This is done with the @internalsref{ChoirStaff} context.
1849
1850 @lilypond[verbatim,ragged-right,quote]
1851 \new ChoirStaff
1852 \relative <<
1853   \new Staff { c1 c }
1854   \new Staff { c c }
1855 >>
1856 @end lilypond
1857
1858 @item The group is started with a vertical line.  Bar lines are not
1859 connected.  This is the default for the score.
1860
1861 @lilypond[verbatim,ragged-right,quote]
1862 \relative <<
1863   \new Staff { c1 c }
1864   \new Staff { c c }
1865 >>
1866 @end lilypond
1867 @end itemize
1868
1869
1870 @seealso
1871
1872 The bar lines at the start of each system are
1873 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1874 @internalsref{SystemStartBracket}.  Only one of these types is created
1875 in every context, and that type is determined by the property
1876 @code{systemStartDelimiter}.
1877
1878
1879 @commonprop
1880
1881 System start delimiters may be deeply nested,
1882
1883 @lilypond[quote,ragged-right,verbatim]
1884 \new StaffGroup
1885 \relative <<
1886   \set StaffGroup.systemStartDelimiterHierarchy
1887     = #'(SystemStartSquare (SystemStartBracket a (SystemStartSquare b)) d)
1888   \new Staff { c1 }
1889   \new Staff { c1 }
1890   \new Staff { c1 }
1891   \new Staff { c1 }
1892   \new Staff { c1 }
1893 >>
1894 @end lilypond
1895
1896
1897 @node Staff symbol
1898 @subsection Staff symbol
1899
1900 @cindex adjusting staff symbol
1901
1902 Notes, dynamic signs, etc., are grouped
1903 with a set of horizontal lines, called a staff (plural @q{staves}).  In
1904 LilyPond, these lines are drawn using a separate layout object called
1905 @code{staff symbol}.
1906
1907 The staff symbol may be tuned in the number, thickness and distance
1908 of lines, using properties.  This is demonstrated in the example files
1909 @lsr{staff,changing-the-number-of-lines-in-a-staff.ly} and
1910 @lsr{staff,changing-the-staff-size.ly}.
1911
1912 In addition, staves may be started and stopped at will. This is done
1913 with @code{\startStaff} and @code{\stopStaff}.
1914
1915 @lilypond[verbatim,relative=2,fragment]
1916 b4 b
1917 \override Staff.StaffSymbol #'line-count = 2
1918 \stopStaff \startStaff
1919 b b
1920 \revert Staff.StaffSymbol #'line-count
1921 \stopStaff \startStaff
1922 b b
1923 @end lilypond
1924
1925 In combination with Frenched staves, this may be used to typeset ossia
1926 sections. An example is shown here
1927
1928 @cindex ossia
1929
1930 @lilypondfile{ossia.ly}
1931
1932 @cindex staff lines, setting number of
1933 @cindex staff lines, setting thickness of
1934 @cindex thickness of staff lines, setting
1935 @cindex number of staff lines, setting
1936
1937 @seealso
1938
1939 Program reference: @internalsref{StaffSymbol}.
1940
1941 Examples: @lsrdir{staff}
1942
1943
1944 @node Writing music in parallel
1945 @subsection Writing music in parallel
1946
1947 @cindex Writing music in parallel
1948 @cindex Interleaved music
1949
1950 Music for multiple parts can be interleaved
1951
1952 @lilypond[quote,fragment,verbatim]
1953 \parallelMusic #'(voiceA voiceB) {
1954   r8     g'16[ c''] e''[ g' c'' e''] r8     g'16[ c''] e''[ g' c'' e''] |
1955   c'2                                c'2                                |
1956   r8     a'16[ d''] f''[ a' d'' f''] r8     a'16[ d''] f''[ a' d'' f''] |
1957   c'2                                c'2                                |
1958 }
1959 \new StaffGroup <<
1960   \new Staff \new Voice \voiceA
1961   \new Staff \new Voice \voiceB
1962 >>
1963 @end lilypond
1964
1965 This works quite well for piano music
1966
1967 @lilypond[quote,verbatim]
1968 music = {
1969   \key c \major
1970   \time 4/4
1971   \parallelMusic #'(voiceA voiceB voiceC voiceD) {
1972     % Bar 1
1973     r8  g'16[ c''] e''[ g' c'' e''] r8  g'16[ c''] e''[ g' c''
1974 e''] |
1975     c'2                                 c'2 |
1976     r8  a16[ d'] f'[ a d' f']       r8  a16[ d'] f'[ a d' f'] |
1977     c2                                  c2 |
1978
1979     % Bar 2
1980     a'8 b'      c'' d''    e'' f''    g'' a'' |
1981     d'4         d'         d'         d' |
1982     c16 d e f   d e f g    e f g a    f g a b |
1983     a,4         a,4        a,4        a,4 |
1984
1985     % Bar 3 ...
1986   }
1987 }
1988
1989 \score {
1990   \new PianoStaff <<
1991     \music
1992     \new Staff <<
1993       \voiceA \\
1994       \voiceB
1995     >>
1996     \new Staff {
1997       \clef bass
1998       <<
1999         \voiceC \\
2000         \voiceD
2001       >>
2002     }
2003   >>
2004 }
2005 @end lilypond
2006
2007
2008 @node Connecting notes
2009 @section Connecting notes
2010
2011 This section deals with notation that affects groups of notes.
2012
2013 @menu
2014 * Ties::                        
2015 * Slurs::                       
2016 * Phrasing slurs::              
2017 * Laissez vibrer ties::         
2018 * Automatic beams::             
2019 * Manual beams::                
2020 * Grace notes::                 
2021 @end menu
2022
2023
2024 @node Ties
2025 @subsection Ties
2026
2027 @cindex tie
2028 @funindex ~
2029
2030 A tie connects two adjacent note heads of the same pitch.  The tie in
2031 effect extends the length of a note.  Ties should not be confused with
2032 slurs, which indicate articulation, or phrasing slurs, which indicate
2033 musical phrasing.  A tie is entered using the tilde symbol @samp{~}
2034
2035 @lilypond[quote,ragged-right,fragment,verbatim]
2036 e' ~ e' <c' e' g'> ~ <c' e' g'>
2037 @end lilypond
2038
2039 When a tie is applied to a chord, all note heads whose pitches match
2040 are connected.  When no note heads match, no ties will be created.  Chords
2041 may be partially tied by placing the tie inside the chord,
2042
2043 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2044 <c~ e g~ b> <c e g b>
2045 @end lilypond
2046
2047 A tie is just a way of extending a note duration, similar to the
2048 augmentation dot.  The following example shows two ways of notating
2049 exactly the same concept
2050
2051 @lilypond[quote,fragment,ragged-right]
2052 \time 3/4 c'2. c'2 ~ c'4
2053 @end lilypond
2054
2055 @noindent
2056 Ties are used either when the note crosses a bar line, or when dots
2057 cannot be used to denote the rhythm.  When using ties, larger note
2058 values should be aligned to subdivisions of the measure, such as
2059
2060 @lilypond[fragment,quote,ragged-right]
2061 \relative {
2062   r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
2063 }
2064 @end lilypond
2065
2066 If you need to tie a lot of notes over bars, it may be easier to use
2067 automatic note splitting (see @ref{Automatic note splitting}).  This
2068 mechanism automatically splits long notes, and ties them across bar
2069 lines.
2070
2071 @funindex \repeatTie
2072
2073 When a second alternative of a repeat starts with a tied note, you
2074 have to repeat the tie. This can be achieved with @code{\repeatTie},
2075
2076 @lilypond[fragment,quote,ragged-right,relative=2]
2077 r <c e g>\repeatTie
2078 @end lilypond
2079
2080 @cindex repeating ties
2081 @cindex volta brackets and ties
2082
2083 @commonprop
2084
2085 Ties are sometimes used to write out arpeggios.  In this case, two tied
2086 notes need not be consecutive.  This can be achieved by setting the
2087 @code{tieWaitForNote} property to true. The same feature is also useful,
2088 for example, to tie a tremolo to a chord. For example,
2089
2090 @lilypond[fragment,verbatim,relative=1,ragged-right,quote]
2091 \set tieWaitForNote = ##t
2092 \grace { c16[~ e~ g]~ } <c, e g>2
2093 \repeat tremolo 8 { c32~ c'~ } <c c,>1
2094 e8~ c~ a~ f~ <e' c a f>2
2095 @end lilypond
2096
2097 Ties may be engraved manually by changing the @code{tie-configuration}
2098 property.  The first number indicates the distance from the center
2099 of the staff in staff-spaces, and the second number indicates the
2100 direction (1=up, -1=down).
2101
2102 @lilypond[fragment,verbatim,relative=1,ragged-right,quote]
2103 <c e g>2~ <c e g> |
2104 \override TieColumn #'tie-configuration =
2105   #'((0.0 . 1) (-2.0 . 1) (-4.0 . 1))
2106 <c e g>~ <c e g> |
2107 @end lilypond
2108
2109
2110 @refcommands
2111
2112
2113 @funindex \tieUp
2114 @code{\tieUp},
2115 @funindex \tieDown
2116 @code{\tieDown},
2117 @funindex \tieNeutral
2118 @code{\tieNeutral},
2119 @funindex \tieDotted
2120 @code{\tieDotted},
2121 @funindex \tieDashed
2122 @code{\tieDashed},
2123 @funindex \tieSolid
2124 @code{\tieSolid}.
2125
2126
2127 @seealso
2128
2129 In this manual: @ref{Automatic note splitting}.
2130
2131 Program reference: @internalsref{Tie}.
2132
2133
2134 @refbugs
2135
2136 Switching staves when a tie is active will not produce a slanted tie.
2137
2138 Changing clefs or octavations during a tie is not really
2139 well-defined.  In these cases, a slur may be preferable.
2140
2141
2142 @node Slurs
2143 @subsection Slurs
2144
2145 @cindex Slurs
2146
2147 A slur indicates that notes are to be played bound or
2148 @emph{legato}.  They are entered using parentheses
2149
2150 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
2151 f( g a) a8 b( a4 g2 f4)
2152 <c e>2( <b d>2)
2153 @end lilypond
2154
2155 The direction of a slur can be specified with
2156 @code{\slur@emph{DIR}}, where @code{@emph{DIR}} is
2157 either @code{Up}, @code{Down}, or @code{Neutral} (automatically
2158 selected).
2159
2160 However, there is a convenient shorthand for forcing slur
2161 directions.  By adding @code{_} or @code{^} before the opening
2162 parentheses, the direction is also set.  For example,
2163
2164 @lilypond[relative=2,ragged-right,quote,verbatim,fragment]
2165 c4_( c) c^( c)
2166 @end lilypond
2167
2168 Only one slur can be printed at once.  If you need to print a long
2169 slur over a few small slurs, please see @ref{Phrasing slurs}.
2170
2171
2172 @commonprop
2173
2174 Some composers write two slurs when they want legato chords.  This can
2175 be achieved in LilyPond by setting @code{doubleSlurs},
2176
2177 @lilypond[verbatim,ragged-right,relative,fragment,quote]
2178 \set doubleSlurs = ##t
2179 <c e>4 ( <d f> <c e> <d f> )
2180 @end lilypond
2181
2182
2183 @refcommands
2184
2185 @funindex \slurUp
2186 @code{\slurUp},
2187 @funindex \slurDown
2188 @code{\slurDown},
2189 @funindex \slurNeutral
2190 @code{\slurNeutral},
2191 @funindex \slurDashed
2192 @code{\slurDashed},
2193 @funindex \slurDotted
2194 @code{\slurDotted},
2195 @funindex \slurSolid
2196 @code{\slurSolid}.
2197
2198 @seealso
2199
2200 Program reference: @seeinternals{Slur}.
2201
2202
2203 @node Phrasing slurs
2204 @subsection Phrasing slurs
2205
2206 @cindex phrasing slurs
2207 @cindex phrasing marks
2208
2209 A phrasing slur (or phrasing mark) connects notes and is used to
2210 indicate a musical sentence.  It is written using @code{\(} and @code{\)}
2211 respectively
2212
2213 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2214 \time 6/4 c'\( d( e) f( e) d\)
2215 @end lilypond
2216
2217 Typographically, the phrasing slur behaves almost exactly like a
2218 normal slur.  However, they are treated as different objects.  A
2219 @code{\slurUp} will have no effect on a phrasing slur; instead, use
2220 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
2221 @code{\phrasingSlurNeutral}.
2222
2223 You cannot have simultaneous phrasing slurs.
2224
2225
2226 @refcommands
2227
2228 @funindex \phrasingSlurUp
2229 @code{\phrasingSlurUp},
2230 @funindex \phrasingSlurDown
2231 @code{\phrasingSlurDown},
2232 @funindex \phrasingSlurNeutral
2233 @code{\phrasingSlurNeutral}.
2234
2235
2236 @seealso
2237
2238 Program reference: @internalsref{PhrasingSlur}.
2239
2240
2241 @node Laissez vibrer ties
2242 @subsection Laissez vibrer ties
2243 @cindex Laissez vibrer
2244 @cindex Ties, laissez vibrer
2245
2246 L.v. ties (laissez vibrer) indicate that notes must not be damped at the
2247 end. It is used in notation for piano, harp and other string and
2248 percussion instruments. They can be entered using @code{\laissezVibrer},
2249
2250 @lilypond[fragment,ragged-right,verbatim,relative=1]
2251 <c f g>\laissezVibrer
2252 @end lilypond
2253
2254 @seealso
2255
2256 Program reference:
2257 @internalsref{LaissezVibrerTie}
2258 @internalsref{LaissezVibrerTieColumn}
2259
2260 Example files:
2261 @lsr{connecting,laissez-vibrer-ties.ly}
2262
2263
2264 @node Automatic beams
2265 @subsection Automatic beams
2266
2267 LilyPond inserts beams automatically
2268
2269 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2270 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
2271 @end lilypond
2272
2273 When these automatic decisions are not good enough, beaming can be
2274 entered explicitly.  It is also possible to define beaming patterns
2275 that differ from the defaults.  See @ref{Setting automatic beam behavior},
2276 for details.
2277
2278 Individual notes may be marked with @code{\noBeam} to prevent them
2279 from being beamed
2280
2281 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2282 \time 2/4 c8 c\noBeam c c
2283 @end lilypond
2284
2285
2286 @seealso
2287
2288 Program reference: @internalsref{Beam}.
2289
2290
2291 @node Manual beams
2292 @subsection Manual beams
2293
2294 @cindex beams, manual
2295 @funindex ]
2296 @funindex [
2297
2298 In some cases it may be necessary to override the automatic beaming
2299 algorithm.  For example, the autobeamer will not put beams over rests
2300 or bar lines.  Such beams are specified manually by marking the begin
2301 and end point with @code{[} and @code{]}
2302
2303 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2304 {
2305   r4 r8[ g' a r8] r8 g[ | a] r8
2306 }
2307 @end lilypond
2308
2309
2310 @commonprop
2311
2312 @funindex stemLeftBeamCount
2313 @funindex stemRightBeamCount
2314
2315
2316 LilyPond can automatically determine beaming patterns within a beam,
2317 but this automatic behavior can sometimes produce odd results;
2318 therefore the @code{stemLeftBeamCount} and @code{stemRightBeamCount} properties can
2319 be used to override the defaults.  If
2320 either property is set, its value will be used only once, and then it
2321 is erased.
2322
2323 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2324 {
2325    f8[ r16
2326       f g a]
2327    f8[ r16
2328    \set stemLeftBeamCount = #1
2329       f g a]
2330 }
2331 @end lilypond
2332
2333 The property @code{subdivideBeams} can be set in order to subdivide
2334 all 16th or shorter beams at beat positions, as defined by the
2335 @code{beatLength} property.
2336
2337 @lilypond[fragment,quote,relative=2,verbatim]
2338 c16[ c c c c c c c]
2339 \set subdivideBeams = ##t
2340 c16[ c c c c c c c]
2341 \set Score.beatLength = #(ly:make-moment 1 8)
2342 c16[ c c c c c c c]
2343 @end lilypond
2344 @funindex subdivideBeams
2345
2346 @noindent
2347 For more information about @code{make-moment}, see
2348 @ref{Time administration}.
2349
2350 Line breaks are normally forbidden when beams cross bar lines.  This
2351 behavior can be changed by setting @code{breakable}.
2352
2353 @funindex breakable
2354
2355 @cindex beams and line breaks
2356 @cindex beams, kneed
2357 @cindex kneed beams
2358 @cindex auto-knee-gap
2359
2360 Kneed beams are inserted automatically when a large gap is detected
2361 between the note heads.  This behavior can be tuned through the
2362 @code{auto-knee-gap} object.
2363
2364
2365 @refbugs
2366
2367 Automatically kneed cross-staff beams cannot be used together with
2368 hidden staves.  See @ref{Hiding staves}.
2369
2370 @c Is this still true with skyline spacing stuff? -J.Mandereau
2371 Beams do not avoid collisions with symbols around the notes, such as
2372 texts and accidentals.
2373
2374
2375 @node Grace notes
2376 @subsection Grace notes
2377
2378 @funindex \grace
2379 @cindex ornaments
2380 @cindex grace notes
2381 @cindex appoggiatura
2382 @cindex acciaccatura
2383
2384 Grace notes are ornaments that are written out.  The most common ones
2385 are acciaccatura, which should be played as very short.  It is denoted
2386 by a slurred small note with a slashed stem.  The appoggiatura is a
2387 grace note that takes a fixed fraction of the main note, and is
2388 denoted as a slurred note in small print without a slash.  They
2389 are entered with the commands @code{\acciaccatura} and
2390 @code{\appoggiatura}, as demonstrated in the following example
2391
2392 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2393 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
2394 \acciaccatura { g16[ f] } e4
2395 @end lilypond
2396
2397 Both are special forms of the @code{\grace} command.  By prefixing this
2398 keyword to a music expression, a new one is formed, which will be
2399 printed in a smaller font and takes up no logical time in a measure.
2400
2401 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2402 c4 \grace c16 c4
2403 \grace { c16[ d16] } c2 c4
2404 @end lilypond
2405
2406 @noindent
2407 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
2408 @code{\grace} command does not start a slur.
2409
2410 @cindex timing, internal
2411
2412 Internally, timing for grace notes is done using a second, @q{grace}
2413 timing.  Every point in time consists of two rational numbers: one
2414 denotes the logical time, one denotes the grace timing.  The above
2415 example is shown here with timing tuples
2416
2417 @lilypond[quote,ragged-right]
2418 <<
2419   \relative c''{
2420     c4 \grace c16 c4 \grace {
2421     c16[ d16] } c2 c4
2422   }
2423   \new Lyrics \lyricmode {
2424     \override LyricText #'font-family = #'typewriter
2425
2426     \markup { (0,0) } 4
2427     \grace { \markup {
2428       ( \fraction 1 4 , \fraction -1 16 ) } 16 }
2429     \markup { (\fraction 1 4 , 0 ) } 4
2430     \grace {
2431       \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
2432       \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
2433     }
2434     \markup { ( \fraction 2 4 , 0 ) }
2435   }
2436 >>
2437 @end lilypond
2438
2439 The placement of grace notes is synchronized between different staves.
2440 In the following example, there are two sixteenth grace notes for
2441 every eighth grace note
2442
2443 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2444 << \new Staff { e4 \grace { c16[ d e f] } e4 }
2445    \new Staff { c4 \grace { g8[ b] } c4 } >>
2446 @end lilypond
2447
2448 @funindex \afterGrace
2449
2450 If you want to end a note with a grace, use the @code{\afterGrace}
2451 command.  It takes two arguments: the main note, and the grace notes
2452 following the main note.
2453
2454 @lilypond[ragged-right, verbatim,relative=2,fragment]
2455 c1 \afterGrace d1 { c16[ d] } c4
2456 @end lilypond
2457
2458 This will put the grace notes after a @q{space} lasting 3/4 of the
2459 length of the main note.  The fraction 3/4 can be changed by setting
2460 @code{afterGraceFraction}, ie.
2461
2462 @example
2463 #(define afterGraceFraction (cons 7 8))
2464 @end example
2465
2466 @noindent
2467 will put the grace note at 7/8 of the main note.
2468
2469 The same effect can be achieved manually by doing
2470
2471 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2472 \new Voice {
2473   << { d1^\trill_( }
2474      { s2 \grace { c16[ d] } } >>
2475   c4)
2476 }
2477 @end lilypond
2478
2479 @noindent
2480 By adjusting the duration of the skip note (here it is a half-note),
2481 the space between the main-note and the grace is adjusted.
2482
2483 A @code{\grace} music expression will introduce special typesetting settings,
2484 for example, to produce smaller type, and set directions.  Hence, when
2485 introducing layout tweaks, they should be inside the grace expression,
2486 for example,
2487
2488 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2489 \new Voice {
2490   \acciaccatura {
2491     \stemDown
2492     f16->
2493     \stemNeutral
2494   }
2495   g4
2496 }
2497 @end lilypond
2498
2499 @noindent
2500 The overrides should also be reverted inside the grace expression.
2501
2502 The layout of grace expressions can be changed throughout the music
2503 using the function @code{add-grace-property}.  The following example
2504 undefines the @code{Stem} direction for this grace, so that stems do not
2505 always point up.
2506
2507 @example
2508 \new Staff @{
2509   #(add-grace-property 'Voice 'Stem 'direction '())
2510   @dots{}
2511 @}
2512 @end example
2513
2514 @noindent
2515 Another option is to change the variables @code{startGraceMusic},
2516 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2517 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2518 @code{stopAppoggiaturaMusic}.  More information is in the file
2519 @file{ly/@/grace@/-init@/.ly}.
2520
2521 @noindent
2522 The slash through the stem in acciaccaturas can be obtained
2523 in other situations by @code{\override Stem  #'stroke-style = #"grace"}.
2524
2525
2526 @commonprop
2527
2528 Grace notes may be forced to use floating spacing,
2529
2530 @lilypond[relative=2,ragged-right]
2531 <<
2532   \override Score.SpacingSpanner #'strict-grace-spacing = ##t
2533   \new Staff {
2534      c'4
2535      \afterGrace
2536      c'4
2537      { c'16[ c'8 c'16] }
2538      c'4
2539   }  
2540   \new Staff {
2541      c'16[ c'16 c'16 c'16]
2542      c'16[ c'16 c'16 c'16]
2543      c'4
2544   }
2545 >>
2546 @end lilypond
2547
2548
2549 @seealso
2550
2551 Program reference: @internalsref{GraceMusic}.
2552
2553
2554 @refbugs
2555
2556 A score that starts with a @code{\grace} expression needs an explicit
2557 @code{\new Voice} declaration, otherwise the main note and the grace
2558 note end up on different staves.
2559
2560 Grace note synchronization can also lead to surprises.  Staff notation,
2561 such as key signatures, bar lines, etc., are also synchronized.  Take
2562 care when you mix staves with grace notes and staves without, for example,
2563
2564 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2565 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2566    \new Staff { c4 \bar "|:" d4 } >>
2567 @end lilypond
2568
2569 @noindent
2570 This can be remedied by inserting grace skips of the corresponding
2571 durations in the other staves. For the above example
2572
2573 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2574 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2575    \new Staff { c4 \bar "|:" \grace s16 d4 } >>
2576 @end lilypond
2577
2578 Grace sections should only be used within sequential music
2579 expressions.  Nesting or juxtaposing grace sections is not supported,
2580 and might produce crashes or other errors.
2581
2582
2583
2584 @node Expressive marks
2585 @section Expressive marks
2586
2587 Expressive marks help musicians to bring more to the music than simple
2588 notes and rhythms.
2589
2590 @menu
2591 * Articulations::               
2592 * Fingering instructions::      
2593 * Dynamics::                    
2594 * Breath marks::                
2595 * Trills::                      
2596 * Glissando::                   
2597 * Arpeggio::                    
2598 * Falls and doits::             
2599 @end menu
2600
2601
2602 @node Articulations
2603 @subsection Articulations
2604
2605 @cindex Articulations
2606 @cindex scripts
2607 @cindex ornaments
2608
2609 A variety of symbols can appear above and below notes to indicate
2610 different characteristics of the performance.  They are added to a note
2611 by adding a dash and the character signifying the
2612 articulation.  They are demonstrated here
2613
2614 @lilypondfile[quote,ragged-right]{script-abbreviations.ly}
2615
2616 The meanings of these shorthands can be changed.  See
2617 @file{ly/@/script@/-init@/.ly} for examples.
2618
2619 The script is automatically placed, but the direction can be forced as
2620 well.  Like other pieces of LilyPond code, @code{_} will place them
2621 below the staff, and @code{^} will place them above.
2622
2623 @lilypond[quote,ragged-right,fragment,verbatim]
2624 c''4^^ c''4_^
2625 @end lilypond
2626
2627 Other symbols can be added using the syntax
2628 @var{note}@code{\}@var{name}.  Again, they
2629 can be forced up or down using @code{^} and @code{_},
2630 e.g.,
2631
2632 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
2633 c\fermata c^\fermata c_\fermata
2634 @end lilypond
2635
2636 @cindex accent
2637 @cindex marcato
2638 @cindex staccatissimo
2639 @cindex espressivo
2640 @cindex fermata
2641 @cindex stopped
2642 @cindex staccato
2643 @cindex portato
2644 @cindex tenuto
2645 @cindex upbow
2646 @cindex downbow
2647 @cindex foot marks
2648 @cindex organ pedal marks
2649 @cindex turn
2650 @cindex open
2651 @cindex stopped
2652 @cindex flageolet
2653 @cindex reverseturn
2654 @cindex trill
2655 @cindex prall
2656 @cindex mordent
2657 @cindex prallprall
2658 @cindex prallmordent
2659 @cindex prall, up
2660 @cindex prall, down
2661 @cindex thumb marking
2662 @cindex segno
2663 @cindex coda
2664 @cindex varcoda
2665
2666 Here is a chart showing all scripts available,
2667
2668 @lilypondfile[ragged-right,quote]{script-chart.ly}
2669
2670
2671 @commonprop
2672
2673 The vertical ordering of scripts is controlled with the
2674 @code{script-priority} property.  The lower this number, the closer it
2675 will be put to the note.  In this example, the
2676 @internalsref{TextScript} (the sharp symbol) first has the lowest
2677 priority, so it is put lowest in the first example.  In the second, the
2678 prall trill (the @internalsref{Script}) has the lowest, so it is on the
2679 inside.  When two objects have the same priority, the order in which
2680 they are entered decides which one comes first.
2681
2682 @lilypond[verbatim,relative=3,ragged-right,fragment,quote]
2683 \once \override TextScript #'script-priority = #-100
2684 a4^\prall^\markup { \sharp }
2685
2686 \once \override Script #'script-priority = #-100
2687 a4^\prall^\markup { \sharp }
2688 @end lilypond
2689
2690
2691 @seealso
2692
2693 Program reference: @internalsref{Script}.
2694
2695
2696 @refbugs
2697
2698 These signs appear in the printed output but have no effect on the
2699 MIDI rendering of the music.
2700
2701
2702 @node Fingering instructions
2703 @subsection Fingering instructions
2704
2705 @cindex fingering
2706 @cindex finger change
2707
2708 Fingering instructions can be entered using
2709 @example
2710 @var{note}-@var{digit}
2711 @end example
2712 For finger changes, use markup texts
2713
2714 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2715 c4-1 c-2 c-3 c-4
2716 c^\markup { \finger "2 - 3" }
2717 @end lilypond
2718
2719 You can use the thumb-script to indicate that a note should be
2720 played with the thumb (e.g., in cello music)
2721 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2722 <a_\thumb a'-3>8 <b_\thumb b'-3>
2723 @end lilypond
2724
2725 Fingerings for chords can also be added to individual notes
2726 of the chord by adding them after the pitches
2727 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2728 < c-1 e-2 g-3 b-5 >4
2729 @end lilypond
2730
2731
2732 @commonprop
2733
2734 You may exercise greater control over fingering chords by
2735 setting @code{fingeringOrientations}
2736
2737 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2738 \set fingeringOrientations = #'(left down)
2739 <c-1 es-2 g-4 bes-5 > 4
2740 \set fingeringOrientations = #'(up right down)
2741 <c-1 es-2 g-4 bes-5 > 4
2742 @end lilypond
2743
2744 Using this feature, it is also possible to put fingering instructions
2745 very close to note heads in monophonic music,
2746
2747 @lilypond[verbatim,ragged-right,quote,fragment]
2748 \set fingeringOrientations = #'(right)
2749 <es'-2>4
2750 @end lilypond
2751
2752
2753 @seealso
2754
2755 Program reference: @internalsref{Fingering}.
2756
2757 Examples: @lsr{expressive,fingering-chords.ly}
2758
2759
2760 @node Dynamics
2761 @subsection Dynamics
2762
2763 @cindex Dynamics
2764 @funindex \pppp
2765 @funindex \ppp
2766 @funindex \pp
2767 @funindex \p
2768 @funindex \mp
2769 @funindex \mf
2770 @funindex \f
2771 @funindex \ff
2772 @funindex \fff
2773 @funindex \ffff
2774 @funindex \fp
2775 @funindex \sf
2776 @funindex \sff
2777 @funindex \sp
2778 @funindex \spp
2779 @funindex \sfz
2780 @funindex \rfz
2781
2782 Absolute dynamic marks are specified using a command after a note
2783 @code{c4\ff}.  The available dynamic marks are @code{\ppppp},
2784 @code{\pppp}, @code{\ppp},
2785 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2786 @code{\fff}, @code{\ffff}, @code{\fp}, @code{\sf}, @code{\sff},
2787 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2788
2789 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2790 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2791 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2792 @end lilypond
2793
2794 @funindex \<
2795 @funindex \>
2796 @funindex \!
2797
2798 A crescendo mark is started with @code{\<} and terminated with
2799 @code{\!} or an absolute dynamic.  A decrescendo is started with
2800 @code{\>} and is also terminated with @code{\!} or an absolute
2801 dynamic.  @code{\cr} and @code{\decr} may be used instead of
2802 @code{\<} and @code{\>}.  Because these marks are bound to notes, you must
2803 use spacer notes if multiple marks are needed during one note
2804
2805 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2806 c\< c\! d\> e\!
2807 << f1 { s4 s4\< s4\! \> s4\! } >>
2808 @end lilypond
2809
2810 @noindent
2811 A hairpin normally starts at the left edge of the beginning note
2812 and ends on the right edge of the ending note.  If the ending
2813 note falls on the downbeat, the hairpin ends on the immediately
2814 preceding barline. This may be modified by setting the
2815 @code{hairpinToBarline} property,
2816
2817 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2818 \set hairpinToBarline = ##f
2819 c4\< c2. c4\!
2820 @end lilypond
2821
2822 In some situations the @code{\espressivo} articulation mark may
2823 be suitable to indicate a crescendo and decrescendo on the one note,
2824
2825 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2826 c2 b4 a g1\espressivo
2827 @end lilypond
2828
2829 This may give rise to very short hairpins.  Use @code{minimum-length}
2830 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2831 example
2832
2833 @example
2834 \override Voice.Hairpin #'minimum-length = #5
2835 @end example
2836
2837 @cindex al niente
2838 @cindex niente, al
2839
2840 Hairpins may be printed with a circled tip (al niente notation) by
2841 setting the @code{circled-tip} property,
2842
2843 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2844 \override Hairpin #'circled-tip = ##t
2845 c2\< c\!
2846 c4\> c\< c2\!
2847 @end lilypond
2848
2849
2850 @cindex crescendo
2851 @cindex decrescendo
2852 @cindex diminuendo
2853
2854 You can also use text saying @emph{cresc.} instead of hairpins
2855
2856 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2857 \setTextCresc
2858 c\< d e f\!
2859 \setHairpinCresc
2860 e\> d c b\!
2861 \setTextDecresc
2862 c\> d e f\!
2863 \setTextDim
2864 e\> d c b\!
2865 @end lilypond
2866
2867 You can also supply your own texts
2868 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2869 \set crescendoText = \markup { \italic "cresc. poco" }
2870 \set crescendoSpanner = #'dashed-line
2871 a'2\< a a a\!\mf
2872 @end lilypond
2873
2874 To create new dynamic marks or text that should be aligned
2875 with dynamics, see @ref{New dynamic marks}.
2876
2877 Vertical positioning of dynamics is handled by
2878 @internalsref{DynamicLineSpanner}.
2879
2880
2881 @commonprop
2882
2883 Dynamics that occur at, begin on, or end on, the same note
2884 will be vertically aligned.  If you want to ensure that dynamics
2885 are aligned when they do not occur on the same note, you can
2886 increase the @code{staff-padding} property.
2887
2888 @example
2889 \override DynamicLineSpanner #'staff-padding = #4
2890 @end example
2891
2892 You may also use this property if the dynamics are colliding
2893 with other notation.
2894
2895 Crescendi and decrescendi that end on the first note of a
2896 new line are not printed.  To change this behavior, use
2897
2898 @example
2899 \override Score.Hairpin #'after-line-breaking = ##t
2900 @end example
2901
2902 Text style dynamic changes (such as @emph{cresc.} and @emph{dim.})
2903 are printed with a
2904 dashed line showing their extent.  To surpress printing this line, use
2905
2906 @example
2907 \override DynamicTextSpanner #'dash-period = #-1.0
2908 @end example
2909
2910
2911 @refcommands
2912
2913 @funindex \dynamicUp
2914 @code{\dynamicUp},
2915 @funindex \dynamicDown
2916 @code{\dynamicDown},
2917 @funindex \dynamicNeutral
2918 @code{\dynamicNeutral}.
2919
2920
2921 @seealso
2922
2923 Program reference: @internalsref{DynamicText}, @internalsref{Hairpin}.
2924 Vertical positioning of these symbols is handled by
2925 @internalsref{DynamicLineSpanner}.
2926
2927
2928 @node Breath marks
2929 @subsection Breath marks
2930
2931 Breath marks are entered using @code{\breathe}
2932
2933 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2934 c'4 \breathe d4
2935 @end lilypond
2936
2937
2938 @commonprop
2939
2940 The glyph of the breath mark can be tuned by overriding the
2941 @code{text} property of the @code{BreathingSign} layout object with
2942 any markup text.  For example,
2943 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2944 c'4
2945 \override BreathingSign #'text
2946   = #(make-musicglyph-markup "scripts.rvarcomma")
2947 \breathe
2948 d4
2949 @end lilypond
2950
2951 @seealso
2952
2953 Program reference: @internalsref{BreathingSign}.
2954
2955 Examples: @lsr{expressive,breathing-sign.ly}
2956
2957
2958 @node Trills
2959 @subsection Trills
2960
2961 Short trills are printed like normal articulation; see @ref{Articulations}.
2962
2963 Long running trills are made with @code{\startTrillSpan} and
2964 @code{\stopTrillSpan},
2965
2966 @lilypond[verbatim,ragged-right,relative=2,quote,fragment]
2967 \new Voice {
2968   << { c1 \startTrillSpan }
2969      { s2. \grace { d16[\stopTrillSpan e] } } >>
2970   c4 }
2971 @end lilypond
2972
2973 @cindex Pitched trills
2974
2975 Trills that should be executed on an explicitly specified pitch can be
2976 typeset with the command @code{pitchedTrill},
2977
2978 @lilypond[ragged-right,verbatim,fragment,relative=1,quote]
2979 \pitchedTrill c4\startTrillSpan fis
2980 f\stopTrillSpan
2981 @end lilypond
2982
2983 @noindent
2984 The first argument is the main note.  The pitch of the second
2985 is printed as a stemless note head in parentheses.
2986
2987
2988 @refcommands
2989
2990 @code{\startTrillSpan},
2991 @funindex \startTrillSpan
2992 @code{\stopTrillSpan}.
2993 @funindex \stopTrillSpan
2994
2995
2996 @seealso
2997
2998 Program reference: @internalsref{TrillSpanner}.
2999
3000
3001 @node Glissando
3002 @subsection Glissando
3003
3004 @cindex Glissando
3005 @funindex \glissando
3006
3007 A glissando is a smooth change in pitch.  It is denoted by a line or a
3008 wavy line between two notes.  It is requested by attaching
3009 @code{\glissando} to a note
3010
3011 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
3012 c2\glissando c'
3013 \override Glissando #'style = #'zigzag
3014 c2\glissando c,
3015 @end lilypond
3016
3017
3018 @commonprop
3019
3020 @lilypond[quote,ragged-right,verbatim]
3021 I = \once \override NoteColumn #'ignore-collision = ##t
3022
3023 \relative <<
3024   { \oneVoice \stemDown f2 \glissando \stemNeutral a } \\
3025   { \oneVoice \I c2 \glissando \I d, }
3026 >>
3027 @end lilypond
3028
3029
3030
3031 @seealso
3032
3033 Program reference: @internalsref{Glissando}.
3034
3035 Example files:
3036 @lsr{expressive,glissando.ly}, @lsr{expressive,line-styles.ly}
3037
3038
3039 @refbugs
3040
3041 Printing text over the line (such as @emph{gliss.}) is not supported.
3042
3043
3044 @node Arpeggio
3045 @subsection Arpeggio
3046
3047 @cindex Arpeggio
3048 @cindex broken chord
3049 @funindex \arpeggio
3050
3051 You can specify an arpeggio sign (also known as broken chord) on a
3052 chord by attaching an @code{\arpeggio} to a chord
3053
3054 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
3055 <c e g c>\arpeggio
3056 @end lilypond
3057
3058 A square bracket on the left indicates that the player should not
3059 arpeggiate the chord
3060
3061 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
3062 \arpeggioBracket
3063 <c' e g c>\arpeggio
3064 @end lilypond
3065
3066 The direction of the arpeggio is sometimes denoted by adding an
3067 arrowhead to the wiggly line
3068
3069 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
3070 \new Voice {
3071   \arpeggioUp
3072   <c e g c>\arpeggio
3073   \arpeggioDown
3074   <c e g c>\arpeggio
3075 }
3076 @end lilypond
3077
3078
3079 @commonprop
3080
3081 When an arpeggio crosses staves, you may attach an arpeggio to the chords
3082 in both staves and set
3083 @internalsref{PianoStaff}.@code{connectArpeggios}
3084
3085 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
3086 \new PianoStaff <<
3087   \set PianoStaff.connectArpeggios = ##t
3088   \new Staff { <c' e g c>\arpeggio }
3089   \new Staff { \clef bass <c,, e g>\arpeggio }
3090 >>
3091 @end lilypond
3092
3093 @c TODO: cross-voice arpeggio example?
3094 @c such an example is already in LSR -J.Mandereau
3095
3096 @refcommands
3097
3098 @code{\arpeggio},
3099 @funindex \arpeggioUp
3100 @code{\arpeggioUp},
3101 @funindex \arpeggioDown
3102 @code{\arpeggioDown},
3103 @funindex \arpeggioNeutral
3104 @code{\arpeggioNeutral},
3105 @funindex \arpeggioBracket
3106 @code{\arpeggioBracket}.
3107
3108
3109 @seealso
3110
3111 Notation manual: @ref{Ties}, for writing out arpeggios.
3112
3113 Program reference: @internalsref{Arpeggio}.
3114
3115
3116 @refbugs
3117
3118 It is not possible to mix connected arpeggios and unconnected
3119 arpeggios in one @internalsref{PianoStaff} at the same point in time.
3120
3121
3122 @node Falls and doits
3123 @subsection Falls and doits
3124
3125 Falls and doits can be added to notes using the @code{\bendAfter}
3126 command,
3127
3128 @lilypond[fragment,ragged-right,relative=2]
3129 \override Score.SpacingSpanner #'shortest-duration-space = #3.0
3130 c4-\bendAfter #+5
3131 c4-\bendAfter #-3
3132 @end lilypond
3133
3134
3135 @node Repeats
3136 @section Repeats
3137
3138 Repetition is a central concept in music, and multiple notations exist
3139 for repetitions.
3140
3141 @menu
3142 * Repeat types::                
3143 * Repeat syntax::               
3144 * Repeats and MIDI::            
3145 * Manual repeat commands::      
3146 * Tremolo repeats::             
3147 * Tremolo subdivisions::        
3148 * Measure repeats::             
3149 @end menu
3150
3151
3152 @node Repeat types
3153 @subsection Repeat types
3154
3155 @cindex repeats
3156
3157 The following types of repetition are supported
3158
3159 @table @code
3160 @item unfold
3161 Repeated music is fully written (played) out.  This is useful when
3162 entering repetitious music.  This is the only kind of repeat that
3163 is included in MIDI output.
3164
3165 @item volta
3166 Repeats are not written out, but alternative endings (volte) are
3167 printed, left to right with brackets.  This is the standard notation
3168 for repeats with alternatives.  These are not played in MIDI output by
3169 default.
3170
3171
3172 @item tremolo
3173 Make tremolo beams.  These are not played in MIDI output by default.
3174
3175 @item percent
3176 Make beat or measure repeats.  These look like percent signs.  These
3177 are not played in MIDI output by default.  Percent repeats must be
3178 declared within a @code{Voice} context.
3179
3180 @end table
3181
3182
3183 @node Repeat syntax
3184 @subsection Repeat syntax
3185
3186 @cindex volta
3187 @cindex prima volta
3188 @cindex seconda volta
3189 @funindex \repeat
3190
3191 LilyPond has one syntactic construct for specifying different types of
3192 repeats.  The syntax is
3193
3194 @example
3195 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
3196 @end example
3197
3198 If you have alternative endings, you may add
3199 @funindex \alternative
3200 @example
3201 \alternative @{
3202   @var{alternative1}
3203   @var{alternative2}
3204   @var{alternative3}
3205   @dots{}
3206 @}
3207 @end example
3208
3209 @noindent
3210 where each @var{alternative} is a music expression.  If you do not
3211 give enough alternatives for all of the repeats, the first alternative
3212 is assumed to be played more than once.
3213
3214 Standard repeats are used like this
3215
3216 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
3217 c1
3218 \repeat volta 2 { c4 d e f }
3219 \repeat volta 2 { f e d c }
3220 @end lilypond
3221
3222 With alternative endings
3223
3224 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
3225 c1
3226 \repeat volta 2 {c4 d e f}
3227 \alternative { {d2 d} {f f,} }
3228 @end lilypond
3229
3230 Repeats with upbeats may be created.
3231
3232 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
3233 \new Staff {
3234   \partial 4 e |
3235   \repeat volta 4 { c2 d2 | e2 f2 | }
3236   \alternative { { g4 g g e } { a a a a | b2. } }
3237 }
3238 @end lilypond
3239
3240 @noindent
3241 or
3242
3243 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
3244 \new Staff {
3245   \partial 4 
3246   \repeat volta 4 { e | c2 d2 | e2 f2 | }
3247   \alternative { { \partial 4*3 g4 g g } { a a a a | b2. } }
3248 }
3249 @end lilypond
3250
3251
3252
3253 @funindex \repeatTie
3254
3255 Ties may be added to a second ending,
3256
3257 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
3258 c1
3259 \repeat volta 2 {c4 d e f ~ }
3260 \alternative { {f2 d} {f\repeatTie f,} }
3261 @end lilypond
3262
3263 It is possible to shorten volta brackets
3264 by setting @code{voltaSpannerDuration}.  In the next example, the
3265 bracket only lasts one measure, which is a duration of 3/4.
3266
3267 @lilypond[verbatim,ragged-right,quote]
3268 \relative c''{
3269   \time 3/4
3270   c c c
3271   \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
3272   \repeat volta 5 { d d d }
3273   \alternative { { e e e f f f }
3274   { g g g } }
3275 }
3276 @end lilypond
3277
3278 If you want to start a repeat at the beginning of a line and have a
3279 double bar at the end of the previous line, use
3280 @example
3281 @dots{} \bar "||:" \break 
3282 \repeat volta 2 @{ @dots{} 
3283 @end example
3284 see @ref{Bar lines} for more information.
3285
3286 @seealso
3287
3288 Examples:
3289
3290 Brackets for the repeat are normally only printed over the topmost
3291 staff.  This can be adjusted by moving @code{Volta_engraver} to the
3292 Staff context where you want the brackets to appear;
3293 see @ref{Modifying context plug-ins} and
3294
3295 @lsr{repeats,volta@/-multi@/-staff@/.ly}.
3296
3297
3298 @refbugs
3299
3300 @cindex repeat, ambiguous
3301
3302 A nested repeat like
3303
3304 @example
3305 \repeat @dots{}
3306 \repeat @dots{}
3307 \alternative
3308 @end example
3309
3310 @noindent
3311 is ambiguous, since it is is not clear to which @code{\repeat} the
3312 @code{\alternative} belongs.  This ambiguity is resolved by always
3313 having the @code{\alternative} belong to the inner @code{\repeat}.
3314 For clarity, it is advisable to use braces in such situations.
3315
3316 Timing information is not remembered at the start of an alternative,
3317 so after a repeat timing information must be reset by hand; for
3318 example, by setting @code{Score.measurePosition} or entering
3319 @code{\partial}.  Similarly, slurs or ties are also not repeated.
3320
3321
3322 @node Repeats and MIDI
3323 @subsection Repeats and MIDI
3324
3325 @cindex expanding repeats
3326 @funindex \unfoldRepeats
3327
3328 With a little bit of tweaking, all types of repeats can be present
3329 in the MIDI output.  This is achieved by applying the
3330 @code{\unfoldRepeats} music function.  This function changes all
3331 repeats to unfold repeats.
3332
3333 @lilypond[quote,verbatim,fragment,line-width=8.0\cm]
3334 \unfoldRepeats {
3335   \repeat tremolo 8 {c'32 e' }
3336   \repeat percent 2 { c''8 d'' }
3337   \repeat volta 2 {c'4 d' e' f'}
3338   \alternative {
3339     { g' a' a' g' }
3340     {f' e' d' c' }
3341   }
3342 }
3343 \bar "|."
3344 @end lilypond
3345
3346 When creating a score file using @code{\unfoldRepeats} for MIDI,
3347 it is necessary to make two @code{\score} blocks: one for MIDI (with
3348 unfolded repeats) and one for notation (with volta, tremolo, and
3349 percent repeats).  For example,
3350
3351 @example
3352 \score @{
3353   @var{..music..}
3354   \layout @{ .. @}
3355 @}
3356 \score @{
3357   \unfoldRepeats @var{..music..}
3358   \midi @{ .. @}
3359 @}
3360 @end example
3361
3362
3363 @node Manual repeat commands
3364 @subsection Manual repeat commands
3365
3366 @funindex repeatCommands
3367
3368 The property @code{repeatCommands} can be used to control the layout of
3369 repeats.  Its value is a Scheme list of repeat commands.
3370
3371 @table @asis
3372 @item @code{start-repeat}
3373 Print a @code{|:} bar line.
3374
3375 @item @code{end-repeat}
3376 Print a @code{:|} bar line.
3377
3378 @item @code{(volta @var{text})}
3379 Print a volta bracket saying @var{text}: The text can be specified as
3380 a text string or as a markup text, see @ref{Text markup}.  Do not
3381 forget to change the font, as the default number font does not contain
3382 alphabetic characters;
3383
3384 @item @code{(volta #f)}
3385 Stop a running volta bracket.
3386 @end table
3387
3388 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
3389 c4
3390   \set Score.repeatCommands = #'((volta "93") end-repeat)
3391 c4 c4
3392   \set Score.repeatCommands = #'((volta #f))
3393 c4 c4
3394 @end lilypond
3395
3396
3397 @seealso
3398
3399 Program reference: @internalsref{VoltaBracket},
3400 @internalsref{RepeatedMusic},
3401 @internalsref{VoltaRepeatedMusic}, and
3402 @internalsref{UnfoldedRepeatedMusic}.
3403
3404
3405 @node Tremolo repeats
3406 @subsection Tremolo repeats
3407
3408 @cindex tremolo beams
3409
3410 To place tremolo marks between notes, use @code{\repeat} with tremolo
3411 style
3412 @lilypond[quote,verbatim,ragged-right]
3413 \new Voice \relative c' {
3414   \repeat tremolo 8 { c16 d16 }
3415   \repeat tremolo 4 { c16 d16 }
3416   \repeat tremolo 2 { c16 d16 }
3417 }
3418 @end lilypond
3419
3420 Tremolo marks can also be put on a single note.  In this case, the
3421 note should not be surrounded by braces.
3422 @lilypond[quote,verbatim,ragged-right]
3423 \repeat tremolo 4 c'16
3424 @end lilypond
3425
3426 Similar output is obtained using the tremolo subdivision, described in
3427 @ref{Tremolo subdivisions}.
3428
3429
3430 @seealso
3431
3432 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
3433
3434 Program reference: @internalsref{Beam}, @internalsref{StemTremolo}.
3435
3436
3437 @node Tremolo subdivisions
3438 @subsection Tremolo subdivisions
3439
3440 @cindex tremolo marks
3441 @funindex tremoloFlags
3442
3443 Tremolo marks can be printed on a single note by adding
3444 @q{@code{:}[@var{number}]} after the note.  The number indicates the
3445 duration of the subdivision, and it must be at least 8.  A
3446 @var{length} value of 8 gives one line across the note stem.  If the
3447 length is omitted, the last value (stored in @code{tremoloFlags}) is
3448 used
3449
3450 @lilypond[quote,ragged-right,verbatim,fragment]
3451 c'2:8 c':32 | c': c': |
3452 @end lilypond
3453
3454
3455 @refbugs
3456
3457 Tremolos entered in this way do not carry over into the MIDI output.
3458
3459
3460 @seealso
3461
3462 In this manual: @ref{Tremolo repeats}.
3463
3464 Elsewhere: @internalsref{StemTremolo}.
3465
3466
3467 @node Measure repeats
3468 @subsection Measure repeats
3469
3470 @cindex percent repeats
3471 @cindex measure repeats
3472
3473 In the @code{percent} style, a note pattern can be repeated.  It is
3474 printed once, and then the pattern is replaced with a special sign.
3475 Patterns of one and two measures are replaced by percent-like signs,
3476 patterns that divide the measure length are replaced by slashes.
3477 Percent repeats must be declared within a @code{Voice} context.
3478
3479 @lilypond[quote,verbatim,ragged-right]
3480 \new Voice \relative c' {
3481   \repeat percent 4 { c4 }
3482   \repeat percent 2 { c2 es2 f4 fis4 g4 c4 }
3483 }
3484 @end lilypond
3485
3486 Measure repeats of more than 2 measures get a counter, if you switch
3487 on the @code{countPercentRepeats} property,
3488
3489 @lilypond[relative=2,fragment,quote,verbatim,ragged-right]
3490 \new Voice {
3491 \set countPercentRepeats = ##t
3492   \repeat percent 4 { c1 }
3493 }
3494 @end lilypond
3495
3496
3497
3498 Isolated percents can also be printed. This is done by putting a
3499 multi-measure rest with a different print function,
3500
3501 @lilypond[fragment,verbatim,quote]
3502 \override MultiMeasureRest #'stencil
3503   = #ly:multi-measure-rest::percent
3504 R1
3505 @end lilypond
3506
3507
3508
3509
3510 @seealso
3511
3512 Program reference: @internalsref{RepeatSlash},
3513 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
3514 @internalsref{DoublePercentRepeatCounter},
3515 @internalsref{PercentRepeatCounter},
3516 @internalsref{PercentRepeatedMusic}.
3517
3518
3519