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