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