]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/notation/rhythms.itely
Merge remote-tracking branch 'origin/master' into translation
[lilypond.git] / Documentation / notation / rhythms.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @ignore
3     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
4
5     When revising a translation, copy the HEAD committish of the
6     version that you are working on.  For details, see the Contributors'
7     Guide, node Updating translation committishes..
8 @end ignore
9
10 @c \version "2.19.2"
11
12 @node Rhythms
13 @section Rhythms
14
15 @lilypondfile[quote]{rhythms-headword.ly}
16
17 This section discusses rhythms, rests, durations, beaming and bars.
18
19 @menu
20 * Writing rhythms::
21 * Writing rests::
22 * Displaying rhythms::
23 * Beams::
24 * Bars::
25 * Special rhythmic concerns::
26 @end menu
27
28
29 @node Writing rhythms
30 @subsection Writing rhythms
31
32 @menu
33 * Durations::
34 * Tuplets::
35 * Scaling durations::
36 * Ties::
37 @end menu
38
39 @node Durations
40 @unnumberedsubsubsec Durations
41
42 @cindex durations, of notes
43 @cindex note durations
44 @cindex length of notes
45 @cindex note lengths
46
47 @funindex \longa
48 @funindex longa
49 @funindex \breve
50 @funindex breve
51 @funindex \maxima
52 @funindex maxima
53
54 Durations are designated by numbers and dots.  Durations are entered
55 as their reciprocal values.  For example, a quarter note is entered
56 using a @code{4} (since it is a 1/4 note), and a half note is entered
57 using a @code{2} (since it is a 1/2 note).  For notes longer than a
58 whole you must use the @code{\longa} (a double breve) and
59 @code{\breve} commands.  Durations as short as 128th notes may be
60 specified.  Shorter values are possible, but only as beamed notes.
61
62 @c Two 64th notes are needed to obtain beams
63 @lilypond[quote,verbatim,relative=2]
64 \time 8/1
65 c\longa c\breve c1 c2
66 c4 c8 c16 c32 c64 c128 c128
67 @end lilypond
68
69 Here are the same durations with automatic beaming turned off.
70
71 @c not strictly "writing rhythms"; more of a "displaying" thing,
72 @c but it's ok here.  -gp
73 @lilypond[quote,verbatim,relative=2]
74 \time 8/1
75 \autoBeamOff
76 c\longa c\breve c1 c2
77 c4 c8 c16 c32 c64 c128 c128
78 @end lilypond
79
80 A note with the duration of a quadruple breve may be entered with
81 @code{\maxima}, but this is supported only within ancient music
82 notation.  For details, see @ref{Ancient notation}.
83
84 @cindex duration, default
85 @cindex default note duration
86 @cindex note duration, default
87
88 If the duration is omitted, it is set to the previously
89 entered duration.  The default for the first note is a quarter
90 note.
91
92 @lilypond[quote,verbatim,relative=2]
93 a a a2 a a4 a a1 a
94 @end lilypond
95
96 Durations occuring on their own within a music sequence will take
97 their pitches from the preceding note or chord.
98
99 @lilypond[quote,verbatim,relative=2]
100 \time 8/1
101 c \longa \breve 1 2
102 4 8 16 32 64 128 128
103 @end lilypond
104
105 @cindex notes, dotted
106 @cindex dotted notes
107 @cindex notes, double-dotted
108 @cindex double-dotted notes
109
110 @funindex .
111
112 To obtain dotted note lengths, place a dot (@code{.}) after the
113 duration.  Double-dotted notes are specified by appending two
114 dots, and so on.
115
116 @lilypond[quote,verbatim,relative=2]
117 a4 b c4. b8 a4. b4.. c8.
118 @end lilypond
119
120 Some durations cannot be represented with just binary durations
121 and dots; they can be represented only by tying two or more
122 notes together.  For details, see @ref{Ties}.
123
124 For ways of specifying durations for the syllables of lyrics and
125 ways of aligning lyrics to notes, see @ref{Vocal music}.
126
127 Optionally, notes can be spaced strictly proportionately to their
128 duration.  For details of this and other settings which control
129 proportional notation, see @ref{Proportional notation}.
130
131 @funindex \dotsUp
132 @funindex dotsUp
133 @funindex \dotsDown
134 @funindex dotsDown
135 @funindex \dotsNeutral
136 @funindex dotsNeutral
137
138 Dots are normally moved up to avoid staff lines, except in
139 polyphonic situations.  Dots may be manually placed above or below
140 the staff; see @ref{Direction and placement}.
141
142
143 @predefined
144 @code{\autoBeamOn},
145 @code{\autoBeamOff},
146 @code{\dotsUp},
147 @code{\dotsDown},
148 @code{\dotsNeutral}.
149 @endpredefined
150
151
152 @snippets
153
154 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
155 {alternative-breve-notes.ly}
156
157 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
158 {changing-the-number-of-augmentation-dots-per-note.ly}
159
160 @seealso
161 Music Glossary:
162 @rglos{breve},
163 @rglos{longa},
164 @rglos{maxima},
165 @rglos{note value},
166 @rglos{Duration names notes and rests}.
167
168 Notation Reference:
169 @ref{Automatic beams},
170 @ref{Ties},
171 @ref{Stems},
172 @ref{Writing rhythms},
173 @ref{Writing rests},
174 @ref{Vocal music},
175 @ref{Ancient notation},
176 @ref{Proportional notation}.
177
178 Snippets:
179 @rlsr{Rhythms}.
180
181 Internals Reference:
182 @rinternals{Dots},
183 @rinternals{DotColumn}.
184
185 @knownissues
186 @c Deliberately duplicated in Durations and Rests.  -gp
187 There is no fundamental limit to rest durations (both in terms of
188 longest and shortest), but the number of glyphs is limited:
189 rests from 128th to maxima (8 x whole) may be printed.
190
191
192 @node Tuplets
193 @unnumberedsubsubsec Tuplets
194
195 @cindex tuplets
196 @cindex triplets
197
198 @funindex \tuplet
199 @funindex tuplet
200
201 Tuplets are made from a music expression with the @code{\tuplet}
202 command, multiplying the speed of the music expression by a fraction:
203
204 @example
205 \tuplet @var{fraction} @{ @var{music} @}
206 @end example
207
208 @noindent
209 The fraction's numerator will be printed over or under the notes,
210 optionally with a bracket.  The most common tuplets are triplets
211 (3@tie{}notes sound within the duration normally allowed for@tie{}2).
212
213 @lilypond[quote,verbatim,relative=2]
214 a2 \tuplet 3/2 { b4 4 4 }
215 c4 c \tuplet 3/2 { b4 a g }
216 @end lilypond
217
218 @cindex tuplet grouping
219 @noindent
220 When entering long passages of tuplets, having to write a separate
221 @code{\tuplet} command for each group is inconvenient.  It is possible
222 to specify the duration of one tuplet group directly before the music
223 in order to have the tuplets grouped automatically:
224
225 @lilypond[quote,verbatim,relative=2]
226 g2 r8 \tuplet 3/2 8 { cis16 d e e f g g f e }
227 @end lilypond
228
229 @cindex tuplet bracket placement
230
231 @funindex \tupletUp
232 @funindex tupletUp
233 @funindex \tupletDown
234 @funindex tupletDown
235 @funindex \tupletNeutral
236 @funindex tupletNeutral
237
238 Tuplet brackets may be manually placed above or below the staff:
239
240 @lilypond[quote,verbatim,relative=2]
241 \tupletUp \tuplet 3/2 { c8 d e }
242 \tupletNeutral \tuplet 3/2 { c8 d e }
243 \tupletDown \tuplet 3/2 { f,8 g a }
244 \tupletNeutral \tuplet 3/2 { f8 g a }
245 @end lilypond
246
247 Tuplets may be nested:
248
249 @lilypond[quote,verbatim,relative=2]
250 \autoBeamOff
251 c4 \tuplet 5/4 { f8 e f \tuplet 3/2 { e[ f g] } } f4
252 @end lilypond
253
254 Modifying nested tuplets which begin at the same musical moment must be
255 done with @code{\tweak}.
256
257 To modify the duration of notes without printing a tuplet bracket, see
258 @ref{Scaling durations}.
259
260 @predefined
261 @code{\tupletUp},
262 @code{\tupletDown},
263 @code{\tupletNeutral}.
264 @endpredefined
265
266
267 @snippets
268
269 @cindex tuplet formatting
270 @cindex triplet formatting
271
272 @funindex tupletNumberFormatFunction
273 @funindex tupletSpannerDuration
274
275 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
276 {entering-several-tuplets-using-only-one--times-command.ly}
277
278 @cindex Tuplet number changes
279
280 @funindex TupletNumber
281
282 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
283 {changing-the-tuplet-number.ly}
284
285 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
286 {non-default-tuplet-numbers.ly}
287
288 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
289 {controlling-tuplet-bracket-visibility.ly}
290
291 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
292 {permitting-line-breaks-within-beamed-tuplets.ly}
293
294 @seealso
295 Music Glossary:
296 @rglos{triplet},
297 @rglos{tuplet},
298 @rglos{polymetric}.
299
300 Learning Manual:
301 @rlearning{Tweaking methods}.
302
303 Notation Reference:
304 @ref{Direction and placement},
305 @ref{Time administration},
306 @ref{Scaling durations},
307 @ref{The tweak command},
308 @ref{Polymetric notation}.
309
310 Snippets:
311 @rlsr{Rhythms}.
312
313 Internals Reference:
314 @rinternals{TupletBracket},
315 @rinternals{TupletNumber},
316 @rinternals{TimeScaledMusic}.
317
318
319 @node Scaling durations
320 @unnumberedsubsubsec Scaling durations
321
322 @cindex scaling durations
323 @cindex durations, scaling
324
325 The duration of single notes, rests or chords may be multiplied by a
326 fraction @code{N/M} by appending @code{*N/M} (or @code{*N} if @code{M}
327 is 1) to the duration.  This will not affect the appearance of the
328 notes or rests produced, but the altered duration will be used in
329 calculating the position within the measure and setting the duration
330 in the MIDI output.  Multiplying factors may be combined like
331 @code{*L*M/N}.  Factors are part of the duration: if a duration is
332 not specified for subsequent notes, the default duration taken from
333 the preceding note will include any scaling factor.
334
335 In the following example, the first three notes take up exactly
336 two beats, but no triplet bracket is printed.
337
338 @lilypond[quote,relative=2,verbatim]
339 \time 2/4
340 % Alter durations to triplets
341 a4*2/3 gis a
342 % Normal durations
343 a4 a
344 % Double the duration of chord
345 <a d>4*2
346 % Duration of quarter, appears like sixteenth
347 b16*4 c4
348 @end lilypond
349
350 The duration of spacer rests may also be modified by
351 a multiplier.  This is useful for skipping many measures, e.g.,
352 @code{s1*23}.
353
354 @cindex compressing music
355 @cindex expanding music
356
357 @funindex \scaleDurations
358 @funindex scaleDurations
359
360 Longer stretches of music may be compressed by a fraction in the
361 same way, as if every note, chord or rest had the fraction as a
362 multiplier.  This leaves the appearance of the music unchanged but
363 the internal duration of the notes will be multiplied by the
364 fraction @emph{num}/@emph{den}.  Here is an example showing how music
365 can be compressed and expanded:
366
367 @lilypond[quote,relative=2,verbatim]
368 \time 2/4
369 % Normal durations
370 <c a>4 c8 a
371 % Scale music by *2/3
372 \scaleDurations 2/3 {
373   <c a f>4. c8 a f
374 }
375 % Scale music by *2
376 \scaleDurations 2/1 {
377   <c' a>4 c8 b
378 }
379 @end lilypond
380
381 One application of this command is in polymetric
382 notation, see @ref{Polymetric notation}.
383
384 @seealso
385 Notation Reference:
386 @ref{Tuplets},
387 @ref{Invisible rests},
388 @ref{Polymetric notation}.
389
390 Snippets:
391 @rlsr{Rhythms}.
392
393 @knownissues
394 The calculation of the position within a measure must take into
395 account all the scaling factors applied to the notes within that
396 measure and any fractional carry-out from earlier measures.  This
397 calculation is carried out using rational numbers.  If an intermediate
398 numerator or denominator in that calculation exceeds 2^30 the
399 execution and typesetting will stop at that point without indicating
400 an error.
401
402
403 @node Ties
404 @unnumberedsubsubsec Ties
405
406 @cindex tie
407
408 @funindex ~
409
410 A tie connects two adjacent note heads of the same pitch.  The tie
411 in effect extends the duration of a note.
412
413 @warning{Ties should not be confused with @emph{slurs}, which
414 indicate articulation, or @emph{phrasing slurs}, which indicate
415 musical phrasing.  A tie is just a way of extending a note
416 duration, similar to the augmentation dot.}
417
418 A tie is entered by appending a tilde symbol (@code{~}) to the first
419 of each pair of notes being tied.  This indicates that the note
420 should be tied to the following note, which must be at the same pitch.
421
422 @lilypond[quote,verbatim,relative=2]
423 a2~ 4~ 16 r r8
424 @end lilypond
425
426 Ties can make use of the @q{last explicit pitch} interpretation of
427 isolated durations:
428
429 @lilypond[quote,verbatim,relative=2]
430 a2~ 4~ 16 r r8
431 @end lilypond
432
433 Ties are used either when the note crosses a bar line, or when
434 dots cannot be used to denote the rhythm.  Ties should also be
435 used when note values cross larger subdivisions of the measure:
436
437 @lilypond[verbatim,quote]
438 \relative c' {
439   r8 c~ 2 r4 |
440   r8^"not" c2~ 8 r4
441 }
442 @end lilypond
443
444 If you need to tie many notes across bar lines, it may be
445 easier to use automatic note splitting, see @ref{Automatic note
446 splitting}.  This mechanism automatically splits long notes, and
447 ties them across bar lines.
448
449 @cindex ties and chords
450 @cindex chords and ties
451
452 When a tie is applied to a chord, all note heads whose pitches
453 match are connected.  When no note heads match, no ties will be
454 created.  Chords may be partially tied by placing the ties inside
455 the chord.
456
457 @lilypond[quote,verbatim,relative=1]
458 <c e g>2 ~ 2
459 <c e g>4~ <c e g c>
460 <c~ e g~ b> <c e g b>
461 @end lilypond
462
463 @cindex repeating ties
464 @cindex ties, repeating
465 @cindex volta brackets and ties
466 @cindex ties and volta brackets
467
468 @funindex \repeatTie
469 @funindex repeatTie
470
471 When a second alternative of a repeat starts with a tied note, you
472 have to specify the repeated tie as follows:
473
474 @lilypond[quote,relative=2,verbatim]
475 \repeat volta 2 { c g <c e>2~ }
476 \alternative {
477   % First alternative: following note is tied normally
478   { <c e>2. r4 }
479   % Second alternative: following note has a repeated tie
480   { <c e>2\repeatTie d4 c } }
481 @end lilypond
482
483 @cindex laissez vibrer
484 @cindex ties, laissez vibrer
485
486 @funindex \laissezVibrer
487 @funindex laissezVibrer
488
489 @notation{L.v.}@: ties (@notation{laissez vibrer}) indicate that
490 notes must not be damped at the end.  It is used in notation for
491 piano, harp and other string and percussion instruments.  They can
492 be entered as follows:
493
494 @lilypond[quote,verbatim,relative=1]
495 <c f g>1\laissezVibrer
496 @end lilypond
497
498 @cindex ties, placement
499
500 @funindex \tieUp
501 @funindex tieUp
502 @funindex \tieDown
503 @funindex tieDown
504 @funindex \tieNeutral
505 @funindex tieNeutral
506
507 Ties may be made to curve up or down manually; see
508 @ref{Direction and placement}.
509
510 @cindex ties, appearance
511 @cindex ties, dotted
512 @cindex ties, dashed
513 @cindex dashed ties
514 @cindex dotted ties
515
516 @funindex \tieDotted
517 @funindex tieDotted
518 @funindex \tieDashed
519 @funindex tieDashed
520 @funindex \tieSolid
521 @funindex tieSolid
522
523 Ties may be made dashed, dotted, or a combination of solid and
524 dashed.
525
526 @lilypond[quote, verbatim, relative=1]
527 \tieDotted
528 c2~ 2
529 \tieDashed
530 c2~ 2
531 \tieHalfDashed
532 c2~ 2
533 \tieHalfSolid
534 c2~ 2
535 \tieSolid
536 c2~ 2
537 @end lilypond
538
539 Custom dash patterns can be specified:
540
541 @lilypond[quote, verbatim, relative=1]
542 \tieDashPattern #0.3 #0.75
543 c2~ 2
544 \tieDashPattern #0.7 #1.5
545 c2~ 2
546 \tieSolid
547 c2~ 2
548 @end lilypond
549
550 Dash pattern definitions for ties have the same structure as dash
551 pattern definitions for slurs. For more information about complex dash
552 patterns, see @ref{Slurs}.
553
554 Override @var{whiteout} and @var{layer} layout properties for ties that
555 collide with other objects in a staff.
556
557 @lilypond[verbatim,quote,ragged-right,relative=2]
558 \override Tie.layer = #-2
559 \override Staff.TimeSignature.layer = #-1
560 \override Staff.KeySignature.layer = #-1
561 \override Staff.TimeSignature.whiteout = ##t
562 \override Staff.KeySignature.whiteout = ##t
563 b2 b~
564 \time 3/4
565 \key a \major
566 b r4
567 @end lilypond
568
569 @predefined
570 @code{\tieUp},
571 @code{\tieDown},
572 @code{\tieNeutral},
573 @code{\tieDotted},
574 @code{\tieDashed},
575 @code{\tieDashPattern},
576 @code{\tieHalfDashed},
577 @code{\tieHalfSolid},
578 @code{\tieSolid}.
579 @endpredefined
580
581 @snippets
582
583 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
584 {using-ties-with-arpeggios.ly}
585
586 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
587 {engraving-ties-manually.ly}
588
589 @seealso
590 Music Glossary:
591 @rglos{tie},
592 @rglos{laissez vibrer}.
593
594 Notation Reference:
595 @ref{Slurs},
596 @ref{Automatic note splitting}.
597
598 Snippets:
599 @rlsr{Expressive marks},
600 @rlsr{Rhythms}.
601
602 Internals Reference:
603 @rinternals{LaissezVibrerTie},
604 @rinternals{LaissezVibrerTieColumn},
605 @rinternals{TieColumn},
606 @rinternals{Tie}.
607
608 @knownissues
609 Switching staves when a tie is active will not produce a slanted tie.
610
611 Changing clefs or ottavations during a tie is not really well-defined.
612 In these cases, a slur may be preferable.
613
614
615 @node Writing rests
616 @subsection Writing rests
617
618 Rests are entered as part of the music in music expressions.
619
620 @menu
621 * Rests::
622 * Invisible rests::
623 * Full measure rests::
624 @end menu
625
626 @node Rests
627 @unnumberedsubsubsec Rests
628
629 @cindex rest
630 @cindex rest, entering durations
631 @cindex maxima rest
632 @cindex longa rest
633 @cindex breve rest
634
635 @funindex \rest
636 @funindex rest
637 @funindex r
638 @funindex \maxima
639 @funindex maxima
640 @funindex \longa
641 @funindex longa
642 @funindex \breve
643 @funindex breve
644
645 Rests are entered like notes with the note name @code{r}.
646 Durations longer than a whole rest use the following predefined
647 commands:
648
649 @c \time 16/1 is used to avoid spurious bar lines
650 @c and long tracts of empty measures
651 @lilypond[quote,verbatim,relative=2]
652 \new Staff {
653   % These two lines are just to prettify this example
654   \time 16/1
655   \omit Staff.TimeSignature
656   % Print a maxima rest, equal to four breves
657   r\maxima
658   % Print a longa rest, equal to two breves
659   r\longa
660   % Print a breve rest
661   r\breve
662   r1 r2 r4 r8 r16 r32 r64 r128
663 }
664 @end lilypond
665
666 @cindex rest, multi-measure
667 @cindex rest, whole-measure
668
669 Whole measure rests, centered in the middle of the measure, must be
670 entered as multi-measure rests.  They can be used for a single
671 measure as well as many measures and are discussed in
672 @ref{Full measure rests}.
673
674 @cindex rest, specifying vertical position
675
676 To explicitly specify a rest's vertical position, write a note
677 followed by @code{\rest}.  A rest of the duration of the note will
678 be placed at the staff position where the note would appear.  This
679 allows for precise manual formatting of polyphonic music, since the
680 automatic rest collision formatter will not move these rests.
681
682 @lilypond[quote,verbatim,relative=2]
683 a4\rest d4\rest
684 @end lilypond
685
686 @snippets
687
688 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
689 {rest-styles.ly}
690
691 @seealso
692 Music Glossary:
693 @rglos{breve},
694 @rglos{longa},
695 @rglos{maxima}.
696
697 Notation Reference:
698 @ref{Full measure rests}.
699
700 Snippets:
701 @rlsr{Rhythms}.
702
703 Internals Reference:
704 @rinternals{Rest}.
705
706 @knownissues
707 @c Deliberately duplicated in Durations and Rests.  -gp
708 There is no fundamental limit to rest durations (both in terms of
709 longest and shortest), but the number of glyphs is limited: there
710 are rests from 128th to maxima (8 x whole).
711
712
713 @node Invisible rests
714 @unnumberedsubsubsec Invisible rests
715
716 @cindex skip
717 @cindex invisible rest
718 @cindex rest, invisible
719 @cindex spacer note
720 @cindex spacer rest
721
722 @funindex s
723 @funindex \skip
724 @funindex skip
725
726 An invisible rest (also called a @q{spacer rest}) can be entered
727 like a note with the note name@tie{}@code{s}:
728
729 @lilypond[verbatim,quote,relative=2]
730 c4 c s c
731 s2 c
732 @end lilypond
733
734 @cindex lyrics, skip
735
736 Spacer rests are available only in note mode and chord mode.  In
737 other situations, for example, when entering lyrics, the
738 command @code{\skip} is used to skip a musical moment.
739 @code{\skip} requires an explicit duration, but this is ignored if
740 the lyrics derive their durations from the notes in an associated
741 melody through @code{\addlyrics} or @code{\lyricsto}.
742
743 @lilypond[quote,verbatim,relative=2]
744 <<
745   {
746     a2 \skip2 a2 a2
747   }
748   \new Lyrics {
749     \lyricmode {
750       foo2 \skip 1 bla2
751     }
752   }
753 >>
754 @end lilypond
755
756 Because @code{\skip} is a command, it does not affect the default
757 durations of following notes, unlike@tie{}@code{s}.
758
759 @lilypond[quote,verbatim,relative=2]
760 <<
761   {
762     \repeat unfold 8 { a4 }
763   }
764   {
765     a4 \skip 2 a |
766     s2 a
767   }
768 >>
769 @end lilypond
770
771
772 A spacer rest implicitly causes @code{Staff} and @code{Voice}
773 contexts to be created if none exist, just like notes and rests
774 do:
775
776 @lilypond[quote,verbatim,relative=2]
777 s1 s s
778 @end lilypond
779
780 @code{\skip} simply skips musical time; it creates no output of
781 any kind.
782
783 @lilypond[quote,verbatim,relative=2]
784 % This is valid input, but does nothing
785 \skip 1 \skip1 \skip 1
786 @end lilypond
787
788 @seealso
789 Learning Manual:
790 @rlearning{Visibility and color of objects}.
791
792 Notation Reference:
793 @ref{Hidden notes},
794 @ref{Visibility of objects}.
795
796 Snippets:
797 @rlsr{Rhythms}.
798
799 Internals Reference:
800 @rinternals{SkipMusic}.
801
802
803 @node Full measure rests
804 @unnumberedsubsubsec Full measure rests
805
806 @cindex multi-measure rests
807 @cindex full-measure rests
808 @cindex rest, multi-measure
809 @cindex rest, full-measure
810 @cindex whole rest for a full measure
811 @cindex rest, whole for a full measure
812
813 @funindex R
814
815 Rests for one or more full measures are entered like notes with
816 the note name uppercase @code{R}:
817
818 @lilypond[quote,verbatim,relative=2]
819 % Rest measures contracted to single measure
820 \compressFullBarRests
821 R1*4
822 R1*24
823 R1*4
824 b2^"Tutti" b4 a4
825 @end lilypond
826
827 The duration of full-measure rests is identical to the duration
828 notation used for notes.  The duration in a multi-measure rest must
829 always be an integral number of measure-lengths, so augmentation dots
830 or fractions must often be used:
831
832 @lilypond[quote,verbatim,relative=2]
833 \compressFullBarRests
834 \time 2/4
835 R1 | R2 |
836 \time 3/4
837 R2. | R2.*2 |
838 \time 13/8
839 R1*13/8 | R1*13/8*12 |
840 \time 10/8
841 R4*5*4 |
842 @end lilypond
843
844 A full-measure rest is printed as either a whole or breve rest,
845 centered in the measure, depending on the time signature.
846
847 @lilypond[quote,verbatim,relative=2]
848 \time 4/4
849 R1 |
850 \time 6/4
851 R1*3/2 |
852 \time 8/4
853 R1*2 |
854 @end lilypond
855
856 @cindex multi-measure rest, expanding
857 @cindex multi-measure rest, contracting
858
859 @funindex \expandFullBarRests
860 @funindex expandFullBarRests
861 @funindex \compressFullBarRests
862 @funindex compressFullBarRests
863
864 By default a multi-measure rest is expanded in the printed score to
865 show all the rest measures explicitly.  Alternatively, a multi-measure
866 rest can be shown as a single measure containing a multi-measure rest
867 symbol, with the number of measures of rest printed above the measure:
868
869 @lilypond[quote,verbatim,relative=2]
870 % Default behavior
871 \time 3/4 r2. | R2.*2 |
872 \time 2/4 R2 |
873 \time 4/4
874 % Rest measures contracted to single measure
875 \compressFullBarRests
876 r1 | R1*17 | R1*4 |
877 % Rest measures expanded
878 \expandFullBarRests
879 \time 3/4
880 R2.*2 |
881 @end lilypond
882
883
884 @cindex text on multi-measure rest
885 @cindex multi-measure rest, attaching text
886 @cindex script on multi-measure rest
887 @cindex multi-measure rest, script
888 @cindex fermata on multi-measure rest
889 @cindex multi-measure rest, attaching fermata
890 @cindex markup on multi-measure rest
891 @cindex multi-measure rest with markup
892
893 @funindex \fermataMarkup
894 @funindex fermataMarkup
895 @funindex MultiMeasureRestText
896
897 Markups can be added to multi-measure rests.
898 The predefined command @code{\fermataMarkup}
899 is provided for adding fermatas.
900
901 @lilypond[quote,verbatim,relative=2]
902 \compressFullBarRests
903 \time 3/4
904 R2.*10^\markup { \italic "ad lib." }
905 R2.^\fermataMarkup
906 @end lilypond
907
908 @warning{Markups attached to a multi-measure rest are objects of type
909 @code{MultiMeasureRestText}, not @code{TextScript}.  Overrides must
910 be directed to the correct object, or they will be ignored.  See the
911 following example:}
912
913 @lilypond[quote,verbatim,relative=2]
914 % This fails, as the wrong object name is specified
915 \override TextScript.padding = #5
916 R1^"wrong"
917 % This is the correct object name to be specified
918 \override MultiMeasureRestText.padding = #5
919 R1^"right"
920 @end lilypond
921
922 When a multi-measure rest immediately follows a @code{\partial}
923 setting, resulting bar-check warnings may not be displayed.
924
925
926 @funindex \textLengthOn
927 @funindex textLengthOn
928 @funindex \textLengthOff
929 @funindex textLengthOff
930 @funindex \fermataMarkup
931 @funindex fermataMarkup
932 @funindex \compressFullBarRests
933 @funindex compressFullBarRests
934 @funindex \expandFullBarRests
935 @funindex expandFullBarRests
936
937 @predefined
938 @code{\textLengthOn},
939 @code{\textLengthOff},
940 @code{\fermataMarkup},
941 @code{\compressFullBarRests},
942 @code{\expandFullBarRests}.
943 @endpredefined
944
945
946 @snippets
947
948 @cindex church rest
949 @cindex rest, church
950 @cindex kirchenpausen
951
952 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
953 {changing-form-of-multi-measure-rests.ly}
954
955 @cindex multi-measure rests, positioning
956 @cindex positioning multi-measure rests
957
958 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
959 {positioning-multi-measure-rests.ly}
960
961 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
962 {multi-measure-rest-markup.ly}
963
964 @seealso
965 Music Glossary:
966 @rglos{multi-measure rest}.
967
968 Notation Reference:
969 @ref{Durations},
970 @ref{Text},
971 @ref{Formatting text},
972 @ref{Text scripts}.
973
974 Snippets:
975 @rlsr{Rhythms}.
976
977 Internals Reference:
978 @rinternals{MultiMeasureRest},
979 @rinternals{MultiMeasureRestNumber},
980 @rinternals{MultiMeasureRestText}.
981
982 @cindex fingerings and multi-measure rests
983 @cindex multi-measure rests and fingerings
984
985 @knownissues
986 Fingerings over multi-measure rests (e.g. @code{R1*10-4}) may result
987 in the fingering numeral colliding with the bar counter
988 numeral.
989
990 @cindex condensing rests
991 @cindex rest, condensing ordinary
992
993 There is no way to automatically condense multiple ordinary rests
994 into a single multi-measure rest.
995
996 @cindex rest, collisions of
997
998 Multi-measure rests do not take part in rest collisions.
999
1000
1001 @node Displaying rhythms
1002 @subsection Displaying rhythms
1003
1004 @menu
1005 * Time signature::
1006 * Metronome marks::
1007 * Upbeats::
1008 * Unmetered music::
1009 * Polymetric notation::
1010 * Automatic note splitting::
1011 * Showing melody rhythms::
1012 @end menu
1013
1014 @node Time signature
1015 @unnumberedsubsubsec Time signature
1016
1017 @cindex time signature
1018 @cindex meter
1019
1020 @funindex \time
1021 @funindex time
1022
1023 The time signature is set as follows:
1024
1025 @lilypond[quote,verbatim,relative=2]
1026 \time 2/4 c2
1027 \time 3/4 c2.
1028 @end lilypond
1029
1030 @cindex time signature, visibility of
1031
1032 Time signatures are printed at the beginning of a piece
1033 and whenever the time signature changes.  If a change takes place
1034 at the end of a line a warning time signature sign is printed
1035 there.  This default behavior may be changed, see
1036 @ref{Visibility of objects}.
1037
1038 @lilypond[quote,verbatim,relative=2]
1039 \time 2/4
1040 c2 c
1041 \break
1042 c c
1043 \break
1044 \time 4/4
1045 c c c c
1046 @end lilypond
1047
1048 @cindex time signature style
1049 @cindex meter style
1050
1051 @funindex \numericTimeSignature
1052 @funindex numericTimeSignature
1053 @funindex \defaultTimeSignature
1054 @funindex defaultTimeSignature
1055
1056 The time signature symbol that is used in 2/2 and 4/4 time can be
1057 changed to a numeric style:
1058
1059 @lilypond[quote,verbatim,relative=2]
1060 % Default style
1061 \time 4/4 c1
1062 \time 2/2 c1
1063 % Change to numeric style
1064 \numericTimeSignature
1065 \time 4/4 c1
1066 \time 2/2 c1
1067 % Revert to default style
1068 \defaultTimeSignature
1069 \time 4/4 c1
1070 \time 2/2 c1
1071 @end lilypond
1072
1073
1074 Mensural time signatures are covered in
1075 @ref{Mensural time signatures}.
1076
1077 @cindex time signature default settings
1078 @cindex autobeaming properties for time signatures
1079 @cindex beaming, time signature default properties
1080 @funindex \overrideTimeSignatureSettings
1081
1082 In addition to setting the printed time signature, the @code{\time}
1083 command also sets the values of the time-signature-based properties
1084 @code{baseMoment}, @code{beatStructure}, and @code{beamExceptions}.
1085 The predefined default values for these properties can be found in
1086 @file{scm/time-signature-settings.scm}.
1087
1088 The default value of @code{beatStructure} can be overridden in the
1089 @code{\time} command itself by supplying it as the optional first
1090 argument:
1091
1092 @lilypond[quote,verbatim]
1093 \score {
1094   \new Staff {
1095     \relative c' {
1096       \time #'(2 2 3) 7/8
1097       \repeat unfold 7 { c8 } |
1098       \time #'(3 2 2) 7/8
1099       \repeat unfold 7 { c8 } |
1100     }
1101   }
1102 }
1103 @end lilypond
1104
1105 Alternatively, the default values of all these time-signature-based
1106 variables, including @code{baseMoment} and @code{beamExceptions},
1107 can be set together.  The values can be set independently for several
1108 different time signatures.  The new values take effect when a
1109 subsequent @code{\time} command with the same value of the time
1110 signature is executed:
1111
1112 @lilypond[quote,verbatim]
1113 \score {
1114   \new Staff {
1115     \relative c' {
1116       \overrideTimeSignatureSettings
1117         4/4        % timeSignatureFraction
1118         1/4        % baseMomentFraction
1119         #'(3 1)    % beatStructure
1120         #'()       % beamExceptions
1121       \time 4/4
1122       \repeat unfold 8 { c8 } |
1123     }
1124   }
1125 }
1126 @end lilypond
1127
1128 @code{\overrideTimeSignatureSettings} takes four arguments:
1129
1130 @enumerate
1131
1132 @item
1133 @code{@var{timeSignatureFraction}}, a fraction describing the
1134 time signature to which these values apply.
1135
1136 @item
1137 @code{@var{baseMomentFraction}}, a fraction containing the numerator
1138 and denominator of the basic timing unit for the time signature.
1139
1140 @item
1141 @code{@var{beatStructure}}, a Scheme list indicating the structure
1142 of the beats in the measure, in units of the base moment.
1143
1144 @item
1145 @code{@var{beamExceptions}}, an alist containing any beaming rules
1146 for the time signature that go beyond ending at every beat, as
1147 described in @ref{Setting automatic beam behavior}.
1148 @end enumerate
1149
1150
1151 @cindex time signature properties, restoring default values
1152 @cindex restoring default properties for time signatures
1153 @funindex \revertTimeSignatureSettings
1154
1155 Changed values of default time signature properties can be restored
1156 to the original values:
1157
1158 @lilypond[quote,verbatim]
1159 \score{
1160   \relative c' {
1161     \repeat unfold 8 { c8 } |
1162     \overrideTimeSignatureSettings
1163       4/4        % timeSignatureFraction
1164       1/4        % baseMomentFraction
1165       #'(3 1)    % beatStructure
1166       #'()       % beamExceptions
1167     \time 4/4
1168     \repeat unfold 8 { c8 } |
1169     \revertTimeSignatureSettings 4/4
1170     \time 4/4
1171     \repeat unfold 8 { c8 } |
1172   }
1173 }
1174 @end lilypond
1175
1176 Different values of default time signature properties can be established
1177 for different staves by moving the @code{Timing_translator} and the
1178 @code{Default_bar_line_engraver} from the @code{Score} context to the
1179 @code{Staff} context.
1180
1181 @lilypond[quote, verbatim]
1182 \score {
1183   \new StaffGroup <<
1184      \new Staff {
1185         \overrideTimeSignatureSettings
1186           4/4        % timeSignatureFraction
1187           1/4        % baseMomentFraction
1188           #'(3 1)    % beatStructure
1189           #'()       % beamExceptions
1190         \time 4/4
1191         \repeat unfold 8 {c''8}
1192      }
1193      \new Staff {
1194         \overrideTimeSignatureSettings
1195           4/4        % timeSignatureFraction
1196           1/4        % baseMomentFraction
1197           #'(1 3)    % beatStructure
1198           #'()       % beamExceptions
1199         \time 4/4
1200         \repeat unfold 8 {c''8}
1201      }
1202   >>
1203   \layout {
1204     \context {
1205       \Score
1206       \remove "Timing_translator"
1207       \remove "Default_bar_line_engraver"
1208     }
1209     \context {
1210       \Staff
1211       \consists "Timing_translator"
1212       \consists "Default_bar_line_engraver"
1213     }
1214   }
1215 }
1216 @end lilypond
1217
1218 A further method of changing these time-signature-related variables,
1219 which avoids reprinting the time signature at the time of the change,
1220 is shown in @ref{Setting automatic beam behavior}.
1221
1222 @predefined
1223 @code{\numericTimeSignature},
1224 @code{\defaultTimeSignature}.
1225 @endpredefined
1226
1227
1228 @snippets
1229 @lilypondfile[verbatim,quote,texidoc,doctitle]
1230 {time-signature-printing-only-the-numerator-as-a-number-instead-of-the-fraction.ly}
1231
1232 @seealso
1233 Music Glossary:
1234 @rglos{time signature}
1235
1236 Notation Reference:
1237 @ref{Mensural time signatures},
1238 @ref{Setting automatic beam behavior},
1239 @ref{Time administration}.
1240
1241 Installed Files:
1242 @file{scm/time-signature-settings.scm}.
1243
1244 Snippets:
1245 @rlsr{Rhythms}.
1246
1247 Internals Reference:
1248 @rinternals{TimeSignature},
1249 @rinternals{Timing_translator}.
1250
1251
1252 @node Metronome marks
1253 @unnumberedsubsubsec Metronome marks
1254
1255 @cindex tempo
1256 @cindex beats per minute
1257 @cindex metronome mark
1258 @cindex metronome marking with text
1259
1260 @funindex \tempo
1261 @funindex tempo
1262
1263 A basic metronome mark is simple to write:
1264
1265 @lilypond[verbatim,quote,relative=1]
1266 \tempo 4 = 120
1267 c2 d
1268 e4. d8 c2
1269 @end lilypond
1270
1271 Metronome marks may also be printed as a range of two numbers:
1272
1273 @lilypond[verbatim,quote,relative=1]
1274 \tempo 4 = 40 - 46
1275 c4. e8 a4 g
1276 b,2 d4 r
1277 @end lilypond
1278
1279 Tempo indications with text can be used instead:
1280
1281 @lilypond[verbatim,quote,relative=2]
1282 \tempo "Allegretto"
1283 c4 e d c
1284 b4. a16 b c4 r4
1285 @end lilypond
1286
1287 Combining a metronome mark and text will automatically place the
1288 metronome mark within parentheses:
1289
1290 @lilypond[verbatim,quote,relative=2]
1291 \tempo "Allegro" 4 = 160
1292 g4 c d e
1293 d4 b g2
1294 @end lilypond
1295
1296 In general, the text can be any markup object:
1297
1298 @lilypond[verbatim,quote,relative=2]
1299 \tempo \markup { \italic Faster } 4 = 132
1300 a8-. r8 b-. r gis-. r a-. r
1301 @end lilypond
1302
1303 A parenthesized metronome mark with no textual indication may be
1304 written by including an empty string in the input:
1305
1306 @lilypond[verbatim,quote,relative=2]
1307 \tempo "" 8 = 96
1308 d4 g e c
1309 @end lilypond
1310
1311 @funindex \markLengthOn
1312 @funindex markLengthOn
1313 @funindex \markLengthOff
1314 @funindex markLengthOff
1315
1316 In a part for an instrument with long periods of rests,
1317 tempo indications sometimes follow each other closely.
1318 The command @code{\markLengthOn} provides extra horizontal space
1319 to prevent tempo indications from overlapping, and @code{\markLengthOff}
1320 restores the default behavior of ignoring tempo marks
1321 for horizontal spacing.
1322
1323 @lilypond[verbatim,quote,relative=0]
1324 \compressFullBarRests
1325 \markLengthOn
1326 \tempo "Molto vivace"
1327 R1*12
1328 \tempo "Meno mosso"
1329 R1*16
1330 \markLengthOff
1331 \tempo "Tranquillo"
1332 R1*20
1333 @end lilypond
1334
1335 @snippets
1336
1337 @lilypondfile[verbatim,quote,texidoc,doctitle]
1338 {printing-metronome-and-rehearsal-marks-below-the-staff.ly}
1339
1340 @c perhaps also an example of how to move it horizontally?
1341
1342 @lilypondfile[verbatim,quote,texidoc,doctitle]
1343 {changing-the-tempo-without-a-metronome-mark.ly}
1344
1345 @lilypondfile[verbatim,quote,texidoc,doctitle]
1346 {creating-metronome-marks-in-markup-mode.ly}
1347
1348 For more details, see @ref{Formatting text}.
1349
1350 @seealso
1351 Music Glossary:
1352 @rglos{metronome},
1353 @rglos{metronomic indication},
1354 @rglos{tempo indication},
1355 @rglos{metronome mark}.
1356
1357 Notation Reference:
1358 @ref{Formatting text},
1359 @ref{MIDI output}.
1360
1361 Snippets:
1362 @rlsr{Staff notation}.
1363
1364 Internals Reference:
1365 @rinternals{MetronomeMark}.
1366
1367
1368 @node Upbeats
1369 @unnumberedsubsubsec Upbeats
1370
1371 @cindex anacrusis
1372 @cindex upbeat
1373 @cindex partial measure
1374 @cindex measure, partial
1375 @cindex measure, pickup
1376 @cindex pickup measure
1377
1378 @funindex measurePosition
1379 @funindex \partial
1380 @funindex partial
1381
1382 Partial or pick-up measures, such as an @emph{anacrusis} or an
1383 @emph{upbeat}, are entered using the @code{\partial} command,
1384
1385 @example
1386 \partial @var{duration}
1387 @end example
1388
1389 @noindent
1390 where @code{@var{duration}} is the @emph{remaining} length of the
1391 partial measure @emph{before} the start of the next full measure.
1392
1393 @lilypond[quote,verbatim,relative=1]
1394 \time 3/4
1395 \partial 8
1396 e8 | a4 c8 b c4 |
1397 @end lilypond
1398
1399 The @var{duration} can be any value less than a full measure:
1400
1401 @lilypond[quote,verbatim,relative=1]
1402 \time 3/4
1403 \partial 4.
1404 r4 e8 | a4 c8 b c4 |
1405 @end lilypond
1406
1407 @code{\partial @var{duration}} can also be written as:
1408
1409 @example
1410 \set Timing.measurePosition -@var{duration}
1411 @end example
1412
1413 So the first example above could be written:
1414
1415 @lilypond[quote,verbatim,relative=1]
1416 \time 3/4
1417 \set Timing.measurePosition = #(ly:make-moment -1/8)
1418 e8 | a4 c8 b c4 |
1419 @end lilypond
1420
1421 The property @code{measurePosition} contains a rational number,
1422 which is usually positive and indicates how much of the measure
1423 has passed at this point.  @code{\partial @var{duration}} is
1424 defined such that no numbered bar gets created: when used at the
1425 beginning of a score, @code{measurePosition} is set to a
1426 negative number, implying that the current bar will be
1427 @emph{preceded} by additional material.  When used elsewhere, it
1428 moves the requested distance before the @emph{end} of the bar.
1429
1430 @lilypond[quote,verbatim,relative=1]
1431 \set Score.barNumberVisibility = #all-bar-numbers-visible
1432 \override Score.BarNumber.break-visibility =
1433           #end-of-line-invisible
1434 \time 6/8
1435 \partial 8
1436 e8 | a4 c8 b[ c b] |
1437 \partial 4
1438 r8 e,8 | a4 \bar "||"
1439 \partial 4
1440 r8 e8 | a4
1441 c8 b[ c b] |
1442 @end lilypond
1443
1444
1445 @seealso
1446 Music Glossary:
1447 @rglos{anacrusis}.
1448
1449 Notation Reference:
1450 @ref{Grace notes}.
1451
1452 Snippets:
1453 @rlsr{Rhythms}.
1454
1455 Internal Reference:
1456 @rinternals{Timing_translator}.
1457
1458
1459 @node Unmetered music
1460 @unnumberedsubsubsec Unmetered music
1461
1462 @cindex cadenza
1463 @cindex cadenza, beams
1464 @cindex cadenza, accidentals
1465 @cindex cadenza, bar lines
1466 @cindex cadenza, bar numbers
1467 @cindex unmetered music
1468 @cindex unmetered music, beams
1469 @cindex unmetered music, accidentals
1470 @cindex unmetered music, bar lines
1471 @cindex unmetered music, bar numbers
1472 @cindex accidentals, cadenzas
1473 @cindex accidentals, unmetered music
1474 @cindex bar lines, cadenzas
1475 @cindex bar lines, unmetered music
1476 @cindex bar numbers, cadenzas
1477 @cindex bar numbers, unmetered music
1478 @cindex beams, cadenzas
1479 @cindex beams, unmetered music
1480
1481 @funindex \cadenzaOn
1482 @funindex cadenzaOn
1483 @funindex \cadenzaOff
1484 @funindex cadenzaOff
1485
1486 In metered music bar lines are inserted and bar numbers are calculated
1487 automatically. In unmetered music (i.e. cadenzas), this is not
1488 desirable and can be @q{switched off} using the command
1489 @code{\cadenzaOn}, then @q{switched back on} at the appropriate place
1490 using @code{\cadenzaOff}.
1491
1492 @lilypond[verbatim,relative=2,quote]
1493 c4 d e d
1494 \cadenzaOn
1495 c4 c d8[ d d] f4 g4.
1496 \cadenzaOff
1497 \bar "|"
1498 d4 e d c
1499 @end lilypond
1500
1501 Bar numbering is resumed at the end of the cadenza.
1502
1503 @lilypond[verbatim,relative=2,quote]
1504 % Show all bar numbers
1505 \override Score.BarNumber.break-visibility = #all-visible
1506 c4 d e d
1507 \cadenzaOn
1508 c4 c d8[ d d] f4 g4.
1509 \cadenzaOff
1510 \bar "|"
1511 d4 e d c
1512 @end lilypond
1513
1514 Inserting a @code{\bar} command within a cadenza does not start a new
1515 measure, even if a bar line is printed.  So any accidentals -- which
1516 are usually assumed to remain in force until the end of the measure --
1517 will still be valid after the bar line printed by @code{\bar}.  If
1518 subsequent accidentals should be printed, forced accidentals or
1519 reminder accidentals need to be inserted manually, see
1520 @ref{Accidentals}.
1521
1522 @lilypond[verbatim,relative=2,quote]
1523 c4 d e d
1524 \cadenzaOn
1525 cis4 d cis d
1526 \bar "|"
1527 % First cis is printed without alteration even if it's after a \bar
1528 cis4 d cis! d
1529 \cadenzaOff
1530 \bar "|"
1531 @end lilypond
1532
1533 Automatic beaming is disabled by @code{\cadenzaOn}. Therefore, all
1534 beaming in cadenzas must be entered manually. See @ref{Manual beams}.
1535
1536 @lilypond[verbatim,relative=2,quote]
1537 \repeat unfold 8 { c8 }
1538 \cadenzaOn
1539 cis8 c c c c
1540 \bar"|"
1541 c8 c c
1542 \cadenzaOff
1543 \repeat unfold 8 { c8 }
1544 @end lilypond
1545
1546 These predefined commands affect all staves in the score, even when
1547 placed in just one @code{Voice} context.  To change this, move the
1548 @code{Timing_translator} from the @code{Score} context to the
1549 @code{Staff} context.  See @ref{Polymetric notation}.
1550
1551 @predefined
1552 @code{\cadenzaOn},
1553 @code{\cadenzaOff}.
1554 @endpredefined
1555
1556 @seealso
1557 Music Glossary:
1558 @rglos{cadenza}.
1559
1560 Notation Reference:
1561 @ref{Visibility of objects},
1562 @ref{Polymetric notation},
1563 @ref{Manual beams},
1564 @ref{Accidentals}.
1565
1566 Snippets:
1567 @rlsr{Rhythms}.
1568
1569 @cindex cadenza, line breaks
1570 @cindex cadenza, page breaks
1571 @cindex unmetered music, line breaks
1572 @cindex unmetered music, page breaks
1573 @cindex breaks in unmetered music
1574 @cindex line breaks, cadenzas
1575 @cindex page breaks, cadenzas
1576 @cindex line breaks, unmetered music
1577 @cindex page breaks, unmetered music
1578
1579 @knownissues
1580 Automatic line and page breaks are inserted only at bar lines, so
1581 @q{invisible} bar lines will need to be inserted manually in long
1582 stretches of unmetered music to permit breaking:
1583
1584 @example
1585 \bar ""
1586 @end example
1587
1588
1589 @node Polymetric notation
1590 @unnumberedsubsubsec Polymetric notation
1591
1592 @c This section necessarily uses \set
1593 @c This is acceptable  -td
1594
1595 @cindex double time signatures
1596 @cindex signatures, polymetric
1597 @cindex time signatures, polymetric
1598 @cindex time signatures, double
1599 @cindex polymetric signatures
1600 @cindex meter, polymetric
1601
1602 @funindex timeSignatureFraction
1603 @funindex \scaleDurations
1604 @funindex scaleDurations
1605 @funindex \tuplet
1606 @funindex tuplet
1607
1608 Polymetric notation is supported explicitly or by manually modifying the
1609 visible time signature symbol and/or scaling note durations.
1610
1611 @subsubsubheading Different time signatures with equal-length measures
1612
1613 Set a common time signature for each staff, and set the
1614 @code{timeSignatureFraction} to the desired fraction.  Then use the
1615 @code{\scaleDurations} function to scale the durations of the notes in
1616 each staff to the common time signature.
1617
1618 @cindex beams, with polymetric meters
1619 @cindex polymetric meters, with beams
1620
1621 In the following example, music with the time signatures of 3/4, 9/8 and
1622 10/8 are used in parallel.  In the second staff, shown durations are
1623 multiplied by 2/3 (because 2/3 * 9/8 = 3/4) and in the third staff, the
1624 shown durations are multiplied by 3/5 (because 3/5 * 10/8 = 3/4).  It
1625 may be necessary to insert beams manually, as the duration scaling will
1626 affect the autobeaming rules.
1627
1628 @lilypond[quote,verbatim]
1629 \relative c' <<
1630   \new Staff {
1631     \time 3/4
1632     c4 c c |
1633     c4 c c |
1634   }
1635   \new Staff {
1636     \time 3/4
1637     \set Staff.timeSignatureFraction = 9/8
1638     \scaleDurations 2/3
1639       \repeat unfold 6 { c8[ c c] }
1640   }
1641   \new Staff {
1642     \time 3/4
1643     \set Staff.timeSignatureFraction = 10/8
1644     \scaleDurations 3/5 {
1645       \repeat unfold 2 { c8[ c c] }
1646       \repeat unfold 2 { c8[ c] } |
1647       c4. c \tuplet 3/2 { c8[ c c] } c4
1648     }
1649   }
1650 >>
1651 @end lilypond
1652
1653 @subsubsubheading Different time signatures with unequal-length measures
1654
1655 Each staff can be given its own independent time signature by
1656 moving the @code{Timing_translator} and the
1657 @code{Default_bar_line_engraver} to the @code{Staff} context.
1658
1659 @lilypond[quote,verbatim]
1660 \layout {
1661   \context {
1662     \Score
1663     \remove "Timing_translator"
1664     \remove "Default_bar_line_engraver"
1665   }
1666   \context {
1667     \Staff
1668     \consists "Timing_translator"
1669     \consists "Default_bar_line_engraver"
1670   }
1671 }
1672
1673 % Now each staff has its own time signature.
1674
1675 \relative c' <<
1676   \new Staff {
1677     \time 3/4
1678     c4 c c |
1679     c4 c c |
1680   }
1681   \new Staff {
1682     \time 2/4
1683     c4 c |
1684     c4 c |
1685     c4 c |
1686   }
1687   \new Staff {
1688     \time 3/8
1689     c4. |
1690     c8 c c |
1691     c4. |
1692     c8 c c |
1693   }
1694 >>
1695 @end lilypond
1696
1697 @funindex \compoundMeter
1698 @cindex compound time signatures
1699 @cindex time signature, compound
1700
1701 @subsubsubheading Compound time signatures
1702
1703 These are created using the @code{\compoundMeter} function.  The syntax
1704 for this is:
1705
1706 @example
1707 \compoundMeter #'@code{(list of lists)}
1708 @end example
1709
1710 The simplest construction is a single list, where the @emph{last} number
1711 indicates the bottom number of the time signature and those that come
1712 before it, the top numbers.
1713
1714 @lilypond[quote,verbatim]
1715 \relative c' {
1716   \compoundMeter #'((2 2 2 8))
1717   \repeat unfold 6 c8 \repeat unfold 12 c16
1718 }
1719 @end lilypond
1720
1721 More complex meters can be constructed using additional lists.  Also,
1722 automatic beaming settings will be adjusted depending on the values.
1723
1724 @lilypond[quote,verbatim]
1725 \relative c' {
1726   \compoundMeter #'((1 4) (3 8))
1727   \repeat unfold 5 c8 \repeat unfold 10 c16
1728 }
1729
1730 \relative c' {
1731   \compoundMeter #'((1 2 3 8) (3 4))
1732   \repeat unfold 12 c8
1733 }
1734 @end lilypond
1735
1736 @seealso
1737 Music Glossary:
1738 @rglos{polymetric},
1739 @rglos{polymetric time signature},
1740 @rglos{meter}.
1741
1742 Notation Reference:
1743 @ref{Automatic beams},
1744 @ref{Manual beams},
1745 @ref{Time signature},
1746 @ref{Scaling durations}.
1747
1748 Snippets:
1749 @rlsr{Rhythms}.
1750
1751 Internals Reference:
1752 @rinternals{TimeSignature},
1753 @rinternals{Timing_translator},
1754 @rinternals{Default_bar_line_engraver},
1755 @rinternals{Staff}.
1756
1757 @knownissues
1758 When using different time signatures in parallel, notes at the same
1759 moment will be placed at the same horizontal location.  However, the bar
1760 lines in the different staves will cause the note spacing to be less
1761 regular in each of the individual staves than would be normal without
1762 the different time signatures.
1763
1764
1765 @node Automatic note splitting
1766 @unnumberedsubsubsec Automatic note splitting
1767
1768 @cindex notes, splitting
1769 @cindex splitting notes
1770 @cindex rests, splitting
1771 @cindex splitting rests
1772
1773 @funindex Note_heads_engraver
1774 @funindex Completion_heads_engraver
1775 @funindex Completion_rest_engraver
1776
1777 Long notes which overrun bar lines can be converted automatically to
1778 tied notes.  This is done by replacing the @code{Note_heads_engraver}
1779 with the @code{Completion_heads_engraver}.  Similarly, long rests which
1780 overrun bar lines are split automatically by replacing the
1781 @code{Rest_engraver} with the @code{Completion_rest_engraver}.  In the
1782 following example, notes and rests crossing the bar lines are split,
1783 notes are also tied.
1784
1785 @lilypond[quote,verbatim,relative=1]
1786 \new Voice \with {
1787   \remove "Note_heads_engraver"
1788   \consists "Completion_heads_engraver"
1789   \remove "Rest_engraver"
1790   \consists "Completion_rest_engraver"
1791 }
1792
1793 { c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 r1*2 }
1794 @end lilypond
1795
1796 These engravers split all running notes and rests at the bar line, and
1797 inserts ties for notes.  One of its uses is to debug complex scores: if
1798 the measures are not entirely filled, then the ties show exactly how
1799 much each measure is off.
1800
1801 The property @code{completionUnit} sets a preferred duration for
1802 the split notes.
1803
1804 @lilypond[quote,verbatim,relative=2]
1805 \new Voice \with {
1806   \remove "Note_heads_engraver"
1807   \consists "Completion_heads_engraver"
1808 } {
1809   \time 9/8 g\breve. d4. \bar "||"
1810   \set completionUnit = #(ly:make-moment 3 8)
1811   g\breve. d4.
1812 }
1813 @end lilypond
1814
1815 These engravers split notes with scaled duration, such as those in tuplets,
1816 into notes with the same scale-factor as in the input note.
1817
1818 @lilypond[quote,verbatim,relative=2]
1819 \new Voice \with {
1820   \remove "Note_heads_engraver"
1821   \consists "Completion_heads_engraver"
1822 } {
1823   \time 2/4 r4
1824   \tuplet 3/2 {g4 a b}
1825   \scaleDurations 2/3 {g a b}
1826   g4*2/3 a b
1827   \tuplet 3/2 {g4 a b}
1828   r4
1829 }
1830 @end lilypond
1831
1832 @seealso
1833 Music Glossary:
1834 @rglos{tie}
1835
1836 Learning Manual:
1837 @rlearning{Engravers explained},
1838 @rlearning{Adding and removing engravers}.
1839
1840 Snippets:
1841 @rlsr{Rhythms}.
1842
1843 Internals Reference:
1844 @rinternals{Note_heads_engraver},
1845 @rinternals{Completion_heads_engraver},
1846 @rinternals{Rest_engraver},
1847 @rinternals{Completion_rest_engraver},
1848 @rinternals{Forbid_line_break_engraver}.
1849
1850 @knownissues
1851 For consistency with previous behavior, notes and rests with
1852 duration longer than a measure, such as @code{c1*2}, are split into
1853 notes without any scale factor, @code{@{ c1 c1 @}}.  The property
1854 @code{completionFactor} controls this behavior, and setting it to
1855 @code{#f} cause split notes and rest to have the scale factor
1856 of the input durations.
1857
1858
1859 @node Showing melody rhythms
1860 @unnumberedsubsubsec Showing melody rhythms
1861
1862 @cindex melody rhythms, showing
1863 @cindex rhythms, showing melody
1864
1865 Sometimes you might want to show only the rhythm of a melody.  This
1866 can be done with the rhythmic staff.  All pitches of notes on such a
1867 staff are squashed, and the staff itself has a single line
1868
1869 @lilypond[quote,relative=1,verbatim]
1870 <<
1871   \new RhythmicStaff {
1872     \new Voice = "myRhythm" {
1873       \time 4/4
1874       c4 e8 f g2
1875       r4 g g f
1876       g1
1877     }
1878   }
1879   \new Lyrics {
1880     \lyricsto "myRhythm" {
1881       This is my song
1882       I like to sing
1883     }
1884   }
1885 >>
1886 @end lilypond
1887
1888 @cindex guitar chord charts
1889 @cindex strumming rhythms, showing
1890 @cindex guitar strumming rhythms, showing
1891
1892 @funindex Pitch_squash_engraver
1893 @funindex \improvisationOn
1894 @funindex improvisationOn
1895 @funindex \improvisationOff
1896 @funindex improvisationOff
1897
1898 Guitar chord charts often show the strumming rhythms.  This can
1899 be done with the @code{Pitch_squash_engraver} and
1900 @code{\improvisationOn}.
1901
1902
1903 @lilypond[quote,verbatim]
1904 <<
1905   \new ChordNames {
1906     \chordmode {
1907       c1 f g c
1908     }
1909   }
1910   \new Voice \with {
1911     \consists "Pitch_squash_engraver"
1912   } \relative c'' {
1913     \improvisationOn
1914     c4 c8 c c4 c8 c
1915     f4 f8 f f4 f8 f
1916     g4 g8 g g4 g8 g
1917     c4 c8 c c4 c8 c
1918   }
1919 >>
1920 @end lilypond
1921
1922
1923 @predefined
1924 @code{\improvisationOn},
1925 @code{\improvisationOff}.
1926 @endpredefined
1927
1928
1929 @snippets
1930
1931 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
1932 {guitar-strum-rhythms.ly}
1933
1934 @seealso
1935 Snippets:
1936 @rlsr{Rhythms}.
1937
1938 Internals Reference:
1939 @rinternals{RhythmicStaff},
1940 @rinternals{Pitch_squash_engraver}.
1941
1942
1943 @node Beams
1944 @subsection Beams
1945
1946 @menu
1947 * Automatic beams::
1948 * Setting automatic beam behavior::
1949 * Manual beams::
1950 * Feathered beams::
1951 @end menu
1952
1953 @node Automatic beams
1954 @unnumberedsubsubsec Automatic beams
1955
1956 By default, beams are inserted automatically:
1957
1958 @cindex beams, manual
1959 @cindex manual beams
1960 @cindex beams, customizing rules
1961
1962 @funindex \autoBeamOn
1963 @funindex autoBeamOn
1964 @funindex \autoBeamOff
1965 @funindex autoBeamOff
1966
1967 @lilypond[quote,verbatim,relative=2]
1968 \time 2/4 c8 c c c
1969 \time 6/8 c8 c c c8. c16 c8
1970 @end lilypond
1971
1972 If these automatic decisions are not satisfactory, beaming can be
1973 entered explicitly; see @ref{Manual beams}.  Beams @emph{must} be
1974 entered manually if beams are to be extended over rests.
1975
1976 If automatic beaming is not required, it may be turned off with
1977 @code{\autoBeamOff} and on with @code{\autoBeamOn}:
1978
1979 @lilypond[quote,relative=1,verbatim]
1980 c4 c8 c8. c16 c8. c16 c8
1981 \autoBeamOff
1982 c4 c8 c8. c16 c8.
1983 \autoBeamOn
1984 c16 c8
1985 @end lilypond
1986
1987 @cindex melismata, with beams
1988 @cindex beams, with melismata
1989
1990 @warning{If beams are used to indicate melismata in songs, then
1991 automatic beaming should be switched off with @code{@bs{}autoBeamOff}
1992 and the beams indicated manually.  Using @code{@bs{}partcombine} with
1993 @code{@bs{}autoBeamOff} can produce unintended results.  See the
1994 snippets for more information.}
1995
1996 Beaming patterns that differ from the automatic defaults can be
1997 created; see @ref{Setting automatic beam behavior}.
1998
1999 @predefined
2000 @code{\autoBeamOff},
2001 @code{\autoBeamOn}.
2002 @endpredefined
2003
2004 @cindex beams, line breaks
2005 @cindex line breaks, beams
2006 @cindex beams, with knee gap
2007 @cindex knee gap, with beams
2008 @funindex breakable
2009
2010 @snippets
2011 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
2012 {beams-across-line-breaks.ly}
2013
2014 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
2015 {changing-beam-knee-gap.ly}
2016
2017 @cindex beams, \partcombine with \autoBeamOff
2018 @cindex voices, \partcombine with \autoBeamOff
2019
2020 @lilypondfile [verbatim, quote, ragged-right, texidoc, doctitle]
2021 {partcombine-and-autobeamoff.ly}
2022
2023 @seealso
2024 Notation Reference:
2025 @ref{Manual beams},
2026 @ref{Setting automatic beam behavior}.
2027
2028 Installed Files:
2029 @file{scm/auto-beam.scm}.
2030
2031 Snippets:
2032 @rlsr{Rhythms}.
2033
2034 Internals Reference:
2035 @rinternals{Auto_beam_engraver},
2036 @rinternals{Beam_engraver},
2037 @rinternals{Beam},
2038 @rinternals{BeamEvent},
2039 @rinternals{BeamForbidEvent},
2040 @rinternals{beam-interface},
2041 @rinternals{unbreakable-spanner-interface}.
2042
2043 @knownissues
2044 The properties of a beam are determined at the @emph{start} of its
2045 construction and any additional beam-property changes that occur before
2046 the beam has been completed will not take effect until the @emph{next},
2047 new beam starts.
2048
2049
2050 @node Setting automatic beam behavior
2051 @unnumberedsubsubsec Setting automatic beam behavior
2052
2053 @cindex beams, with lyrics
2054 @cindex lyrics, with beams
2055
2056 @funindex autoBeaming
2057 @funindex baseMoment
2058 @funindex beamExceptions
2059 @funindex \beamExceptions
2060 @funindex beatStructure
2061 @funindex measureLength
2062 @funindex \time
2063 @funindex time
2064 @funindex \set
2065 @funindex set
2066
2067 When automatic beaming is enabled, the placement of automatic beams
2068 is determined by three context properties:
2069 @code{baseMoment}, @code{beatStructure}, and @code{beamExceptions}.
2070 The default values of these variables may be overridden as described
2071 below, or alternatively the default values themselves may be changed
2072 as explained in @ref{Time signature}.
2073
2074 If a @code{beamExceptions} rule is defined for the time signature in
2075 force, that rule alone is used to determine the beam placement; the
2076 values of @code{baseMoment} and @code{beatStructure} are ignored.
2077
2078 If no @code{beamExceptions} rule is defined for the time signature
2079 in force, the beam placement is determined by the values of
2080 @code{baseMoment} and @code{beatStructure}.
2081
2082
2083 @subsubsubheading Beaming based on @code{baseMoment} and @code{beatStructure}
2084
2085 By default, @code{beamExceptions} rules are defined for most common
2086 time signatures, so the @code{beamExceptions} rules must be disabled
2087 if automatic beaming is to be based on @code{baseMoment} and
2088 @code{beatStructure}.  The @code{beamExceptions} rules are disabled
2089 by
2090
2091 @example
2092 \set Timing.beamExceptions = #'()
2093 @end example
2094
2095 When @code{beamExceptions} is set to @code{#'()}, either due to an
2096 explicit setting or because no @code{beamExceptions} rules are defined
2097 internally for the time signature in force, the ending points for
2098 beams are on beats as specified by the context properties
2099 @code{baseMoment} and @code{beatStructure}.  @code{beatStructure} is
2100 a scheme list that defines the length of each beat in the measure in
2101 units of @code{baseMoment}.  By default, @code{baseMoment} is one
2102 over the denominator of the time signature.  By default, each unit of
2103 length @code{baseMoment} is a single beat.
2104
2105 @lilypond[quote,relative=2,verbatim]
2106 \time 5/16
2107 c16^"default" c c c c |
2108 % beamExceptions are unlikely to be defined for 5/16 time,
2109 % but let's disable them anyway to be sure
2110 \set Timing.beamExceptions = #'()
2111 \set Timing.beatStructure = #'(2 3)
2112 c16^"(2+3)" c c c c |
2113 \set Timing.beatStructure = #'(3 2)
2114 c16^"(3+2)" c c c c |
2115 @end lilypond
2116
2117 @lilypond[quote,relative=2,verbatim]
2118 \time 4/4
2119 a8^"default" a a a a a a a
2120 % Disable beamExceptions because they are definitely
2121 % defined for 4/4 time
2122 \set Timing.beamExceptions = #'()
2123 \set Timing.baseMoment = #(ly:make-moment 1/4)
2124 \set Timing.beatStructure = #'(1 1 1 1)
2125 a8^"changed" a a a a a a a
2126 @end lilypond
2127
2128 Beam setting changes can be limited to specific contexts.  If no
2129 setting is included in a lower-level context, the setting of the
2130 enclosing context will apply.
2131
2132 @lilypond[quote, verbatim,relative=1]
2133 \new Staff {
2134   \time 7/8
2135   % No need to disable beamExceptions
2136   % as they are not defined for 7/8 time
2137   \set Staff.beatStructure = #'(2 3 2)
2138   <<
2139     \new Voice = one {
2140       \relative c'' {
2141         a8 a a a a a a
2142       }
2143     }
2144     \new Voice = two {
2145       \relative c' {
2146         \voiceTwo
2147         \set Voice.beatStructure = #'(1 3 3)
2148         f8 f f f f f f
2149       }
2150     }
2151   >>
2152 }
2153 @end lilypond
2154
2155 When multiple voices are used the @code{Staff} context must be
2156 specified if the beaming is to be applied to all voices in the
2157 staff:
2158
2159 @lilypond[quote,verbatim,relative=2]
2160 \time 7/8
2161 % rhythm 3-1-1-2
2162 % Change applied to Voice by default --  does not work correctly
2163 % Because of autogenerated voices, all beating will
2164 % be at baseMoment (1 . 8)
2165 \set beatStructure = #'(3 1 1 2)
2166 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
2167
2168 % Works correctly with context Staff specified
2169 \set Staff.beatStructure = #'(3 1 1 2)
2170 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
2171 @end lilypond
2172
2173 The value of @code{baseMoment} can be adjusted to change
2174 the beaming behavior, if desired. When this is done,
2175 the value of @code{beatStructure} must be set to be
2176 compatible with the new value of @code{baseMoment}.
2177
2178 @lilypond[quote,verbatim,relative=2]
2179 \time 5/8
2180 % No need to disable beamExceptions
2181 % as they are not defined for 5/8 time
2182 \set Timing.baseMoment = #(ly:make-moment 1/16)
2183 \set Timing.beatStructure = #'(7 3)
2184 \repeat unfold 10 { a16 }
2185 @end lilypond
2186
2187 @code{baseMoment} is a @i{moment}; a unit of musical duration.  A
2188 quantity of type @i{moment} is created by the scheme function
2189 @code{ly:make-moment}.  For more information about this function,
2190 see @ref{Time administration}.
2191
2192 By default @code{baseMoment} is set to one over the denominator of
2193 the time signature. Any exceptions to this default can be found in
2194 @file{scm/time-signature-settings.scm}.
2195
2196 @subsubsubheading Beaming based on @code{beamExceptions}
2197
2198 Special autobeaming rules (other than ending a beam on a beat)
2199 are defined in the @code{beamExceptions} property.
2200
2201 The value for @code{beamExceptions}, a somewhat complex Scheme
2202 data structure, is easiest generated with the
2203 @code{\beamExceptions} function.  This function is given one or
2204 more manually beamed measure-length rhythmic patterns (measures
2205 have to be separated by a bar check@tie{}@code{|} since the
2206 function has no other way to discern the measure length).  Here is
2207 a simple example:
2208
2209 @lilypond[quote,relative=2,verbatim]
2210 \time 3/16
2211 \set Timing.beatStructure = #'(2 1)
2212 \set Timing.beamExceptions =
2213   \beamExceptions { 32[ 32] 32[ 32] 32[ 32] }
2214 c16 c c |
2215 \repeat unfold 6 { c32 } |
2216 @end lilypond
2217
2218 @warning{A @code{beamExceptions} value must be @emph{complete}
2219 exceptions list.  That is, every exception that should be applied
2220 must be included in the setting.  It is not possible to add, remove,
2221 or change only one of the exceptions. While this may seem cumbersome,
2222 it means that the current beaming settings need not be known in order
2223 to specify a new beaming pattern.}
2224
2225 When the time signature is changed, default values of
2226 @code{Timing.baseMoment}, @code{Timing.beatStructure},
2227 and @code{Timing.beamExceptions} are set.  Setting the time signature
2228 will reset the automatic beaming settings for the @code{Timing}
2229 context to the default behavior.
2230
2231 @lilypond[quote,verbatim,relative=2]
2232 \time 6/8
2233 \repeat unfold 6 { a8 }
2234 % group (4 + 2)
2235 \set Timing.beatStructure = #'(4 2)
2236 \repeat unfold 6 { a8 }
2237 % go back to default behavior
2238 \time 6/8
2239 \repeat unfold 6 { a8 }
2240 @end lilypond
2241
2242 The default automatic beaming settings for a time signature
2243 are determined in @file{scm/time-signature-settings.scm}.
2244 Changing the default automatic beaming settings
2245 for a time signature is described in @ref{Time signature}.
2246
2247 Many automatic beaming settings for a time signature contain an
2248 entry for @code{beamExceptions}.  For example, 4/4 time tries to
2249 beam the measure in two if there are only eighth notes.  The
2250 @code{beamExceptions} rule can override the @code{beatStructure} setting
2251 if @code{beamExceptions} is not reset.
2252
2253 @lilypond[quote,verbatim,relative=2]
2254 \time 4/4
2255 \set Timing.baseMoment = #(ly:make-moment 1/8)
2256 \set Timing.beatStructure = #'(3 3 2)
2257 % This won't beam (3 3 2) because of beamExceptions
2258 \repeat unfold 8 {c8} |
2259 % This will beam (3 3 2) because we clear beamExceptions
2260 \set Timing.beamExceptions = #'()
2261 \repeat unfold 8 {c8}
2262 @end lilypond
2263
2264 In a similar fashion, eighth notes in 3/4 time are beamed as a full
2265 measure by default.  To beam eighth notes in 3/4 time on the beat,
2266 reset @code{beamExceptions}.
2267
2268 @lilypond[quote,verbatim,relative=2]
2269 \time 3/4
2270 % by default we beam in (6) due to beamExceptions
2271 \repeat unfold 6 {a8} |
2272 % This will beam (1 1 1) due to default baseMoment and beatStructure
2273 \set Timing.beamExceptions = #'()
2274 \repeat unfold 6 {a8}
2275 @end lilypond
2276
2277 In engraving from the Romantic and Classical periods,
2278 beams often begin midway through the measure in 3/4 time,
2279 but modern practice is to avoid the false impression of 6/8 time
2280 (see Gould, p. 153).  Similar situations arise in 3/8 time.
2281 This behavior is controlled by the context property @code{beamHalfMeasure},
2282 which has effect only in time signatures with 3 in the numerator:
2283
2284 @lilypond[quote,verbatim,relative=2]
2285 \time 3/4
2286 r4. a8 a a |
2287 \set Timing.beamHalfMeasure = ##f
2288 r4. a8 a a |
2289 @end lilypond
2290
2291 @subsubsubheading How automatic beaming works
2292
2293 When automatic beaming is enabled, the placement of automatic beams
2294 is determined by the context properties
2295 @code{baseMoment}, @code{beatStructure}, and @code{beamExceptions}.
2296
2297 The following rules, in order of priority, apply when determining
2298 the appearance of beams:
2299
2300 @itemize
2301 @item
2302 If a manual beam is specified with @code{[@dots{}]} set the beam
2303 as specified, otherwise
2304
2305 @item
2306 if a beam-ending rule is defined in @code{beamExceptions}
2307 for the beam-type, use it to determine the valid places where
2308 beams may end, otherwise
2309
2310 @item
2311 if a beam-ending rule is defined in @code{beamExceptions}
2312 for a longer beam-type, use it to determine the valid places
2313 where beams may end, otherwise
2314
2315 @item
2316 use the values of @code{baseMoment} and @code{beatStructure} to
2317 determine the ends of the beats in the measure, and
2318 end beams at the end of beats.
2319
2320 @end itemize
2321
2322 In the rules above, the @emph{beam-type} is the duration of the
2323 shortest note in the beamed group.
2324
2325 The default beaming rules can be found in
2326 @file{scm/time-signature-settings.scm}.
2327
2328 @snippets
2329
2330 @cindex beams, subdividing
2331
2332 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
2333 {subdividing-beams.ly}
2334
2335 @cindex beamlets, orienting
2336
2337 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
2338 {strict-beat-beaming.ly}
2339
2340 @cindex measure groupings
2341 @cindex beats, grouping
2342 @cindex grouping beats
2343 @cindex measure sub-grouping
2344
2345 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
2346 {conducting-signs,-measure-grouping-signs.ly}
2347
2348 @cindex beam, endings in a score
2349 @cindex beam, endings with multiple voices
2350
2351 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
2352 {beam-endings-in-score-context.ly}
2353
2354 @seealso
2355 Notation Reference:
2356 @ref{Time signature}.
2357
2358 Installed Files:
2359 @file{scm/time-signature-settings.scm}.
2360
2361 Snippets:
2362 @rlsr{Rhythms}.
2363
2364 Internals Reference:
2365 @rinternals{Auto_beam_engraver},
2366 @rinternals{Beam},
2367 @rinternals{BeamForbidEvent},
2368 @rinternals{beam-interface}.
2369
2370 @knownissues
2371 If a score ends while an automatic beam has not been ended and is
2372 still accepting notes, this last beam will not be typeset at all.
2373 The same holds for polyphonic voices, entered with
2374 @code{<< @dots{} \\ @dots{} >>}.  If a polyphonic voice ends while an
2375 automatic beam is still accepting notes, it is not typeset.
2376 The workaround for these problems is to manually beam the last
2377 beam in the voice or score.
2378
2379 By default, the @code{Timing} translator is aliased to the
2380 @code{Score} context.  This means that setting the time signature
2381 in one staff will affect the beaming of the other staves as well.
2382 Thus, a time signature setting in a later staff will reset custom
2383 beaming that was set in an earlier staff.
2384 One way to avoid this problem is to set the time signature
2385 in only one staff.
2386
2387 @lilypond[quote,verbatim,relative=2]
2388 <<
2389   \new Staff {
2390     \time 3/4
2391     \set Timing.baseMoment = #(ly:make-moment 1/8)
2392     \set Timing.beatStructure = #'(1 5)
2393     \set Timing.beamExceptions = #'()
2394     \repeat unfold 6 { a8 }
2395   }
2396   \new Staff {
2397     \repeat unfold 6 { a8 }
2398   }
2399 >>
2400 @end lilypond
2401
2402 The default beam settings for the time signature can also be changed, so
2403 that the desired beaming will always be used.  Changes in automatic
2404 beaming settings for a time signature are described in
2405 @ref{Time signature}.
2406
2407 @lilypond[quote,verbatim,relative=2]
2408 <<
2409   \new Staff {
2410     \overrideTimeSignatureSettings
2411       3/4               % timeSignatureFraction
2412       1/8               % baseMomentFraction
2413       #'(1 5)           % beatStructure
2414       #'()              % beamExceptions
2415     \time 3/4
2416     \repeat unfold 6 { a8 }
2417   }
2418   \new Staff {
2419     \time 3/4
2420     \repeat unfold 6 { a8 }
2421   }
2422 >>
2423 @end lilypond
2424
2425
2426 @node Manual beams
2427 @unnumberedsubsubsec Manual beams
2428
2429 @cindex beams, manual
2430 @cindex manual beams
2431
2432 @funindex ]
2433 @funindex [
2434
2435 In some cases it may be necessary to override the automatic
2436 beaming algorithm.  For example, the autobeamer will not put beams
2437 over rests or bar lines, and in choral scores the beaming is
2438 often set to follow the meter of the lyrics rather than the
2439 notes.  Such beams can be specified manually by
2440 marking the begin and end point with @code{[} and @code{]}.
2441
2442 @lilypond[quote,relative=1,verbatim]
2443 r4 r8[ g' a r] r g[ | a] r
2444 @end lilypond
2445
2446 @cindex manual beams, direction shorthand for
2447 @cindex manual beams, grace notes
2448
2449 Beaming direction can be set manually using direction indicators:
2450
2451 @lilypond[quote,relative=2,verbatim]
2452 c8^[ d e] c,_[ d e f g]
2453 @end lilypond
2454
2455 @funindex \noBeam
2456 @funindex noBeam
2457
2458 Individual notes may be marked with @code{\noBeam} to prevent them
2459 from being beamed:
2460
2461 @lilypond[quote,verbatim,relative=2]
2462 \time 2/4
2463 c8 c\noBeam c c
2464 @end lilypond
2465
2466 Grace note beams and normal note beams can occur simultaneously.
2467 Unbeamed grace notes are not put into normal note beams.
2468
2469 @lilypond[quote,verbatim,relative=2]
2470 c4 d8[
2471 \grace { e32 d c d }
2472 e8] e[ e
2473 \grace { f16 }
2474 e8 e]
2475 @end lilypond
2476
2477 @funindex stemLeftBeamCount
2478 @funindex stemRightBeamCount
2479
2480 Even more strict manual control with the beams can be achieved by
2481 setting the properties @code{stemLeftBeamCount} and
2482 @code{stemRightBeamCount}.  They specify the number of beams to
2483 draw on the left and right side, respectively, of the next note.
2484 If either property is set, its value will be used only once, and
2485 then it is erased.  In this example, the last @code{f} is printed
2486 with only one beam on the left side, i.e., the eighth-note beam of
2487 the group as a whole.
2488
2489 @lilypond[quote,relative=2,verbatim]
2490 a8[ r16 f g a]
2491 a8[ r16
2492 \set stemLeftBeamCount = #2
2493 \set stemRightBeamCount = #1
2494 f16
2495 \set stemLeftBeamCount = #1
2496 g16 a]
2497 @end lilypond
2498
2499
2500 @predefined
2501 @code{\noBeam}.
2502 @endpredefined
2503
2504
2505 @snippets
2506
2507 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
2508 {flat-flags-and-beam-nibs.ly}
2509
2510 @seealso
2511 Notation Reference:
2512 @ref{Direction and placement},
2513 @ref{Grace notes}.
2514
2515 Snippets:
2516 @rlsr{Rhythms}.
2517
2518 Internals Reference:
2519 @rinternals{Beam},
2520 @rinternals{BeamEvent},
2521 @rinternals{Beam_engraver},
2522 @rinternals{beam-interface},
2523 @rinternals{Stem_engraver}.
2524
2525
2526 @node Feathered beams
2527 @unnumberedsubsubsec Feathered beams
2528
2529 @cindex beams, feathered
2530 @cindex feathered beams
2531
2532 @funindex \featherDurations
2533 @funindex featherDurations
2534 @funindex grow-direction
2535
2536 Feathered beams are used to indicate that a small group of notes
2537 should be played at an increasing (or decreasing) tempo, without
2538 changing the overall tempo of the piece.  The extent of the
2539 feathered beam must be indicated manually using @code{[} and
2540 @code{]}, and the beam feathering is turned on by specifying a
2541 direction to the @code{Beam} property @code{grow-direction}.
2542
2543 If the placement of the notes and the sound in the MIDI output is to
2544 reflect the @emph{ritardando} or @emph{accelerando} indicated by the
2545 feathered beam the notes must be grouped as a music expression delimited
2546 by braces and preceded by a @code{featherDurations} command which specifies
2547 the ratio between the durations of the first and last notes in the
2548 group.
2549
2550 The square brackets show the extent of the beam and the braces show
2551 which notes are to have their durations modified.  Normally these
2552 would delimit the same group of notes, but this is not required: the
2553 two commands are independent.
2554
2555 In the following example the eight 16th notes occupy exactly the
2556 same time as a half note, but the first note is one half as long
2557 as the last one, with the intermediate notes gradually
2558 lengthening.  The first four 32nd notes gradually speed up, while
2559 the last four 32nd notes are at a constant tempo.
2560
2561 @lilypond[relative=1,verbatim,quote]
2562 \override Beam.grow-direction = #LEFT
2563 \featherDurations #(ly:make-moment 2/1)
2564 { c16[ c c c c c c c] }
2565 \override Beam.grow-direction = #RIGHT
2566 \featherDurations #(ly:make-moment 2/3)
2567 { c32[ d e f] }
2568 % revert to non-feathered beams
2569 \override Beam.grow-direction = #'()
2570 { g32[ a b c] }
2571 @end lilypond
2572
2573 @noindent
2574 The spacing in the printed output represents the
2575 note durations only approximately, but the MIDI output is exact.
2576
2577 @predefined
2578 @code{\featherDurations}.
2579 @endpredefined
2580
2581 @seealso
2582 Snippets:
2583 @rlsr{Rhythms}.
2584
2585 @knownissues
2586 The @code{\featherDurations} command only works with very short
2587 music snippets, and when numbers in the fraction are small.
2588
2589
2590 @node Bars
2591 @subsection Bars
2592
2593 @menu
2594 * Bar lines::
2595 * Bar numbers::
2596 * Bar and bar number checks::
2597 * Rehearsal marks::
2598 @end menu
2599
2600 @node Bar lines
2601 @unnumberedsubsubsec Bar lines
2602
2603 @cindex bar lines
2604 @cindex measure lines
2605 @cindex closing bar lines
2606 @cindex bar lines, closing
2607 @cindex double bar lines
2608 @cindex bar lines, double
2609 @cindex repeat bars
2610
2611 @funindex \bar
2612 @funindex bar
2613
2614 Bar lines delimit measures, and are also used to indicate
2615 repeats.  Normally, simple bar lines are automatically inserted
2616 into the printed output at places based on the current time
2617 signature.
2618
2619 The simple bar lines inserted automatically can be changed to
2620 other types with the @code{\bar} command.  For example, a closing
2621 double bar line is usually placed at the end of a piece:
2622
2623 @lilypond[quote,relative=1,verbatim]
2624 e4 d c2 \bar "|."
2625 @end lilypond
2626
2627 It is not invalid if the final note in a measure does not
2628 end on the automatically entered bar line: the note is assumed
2629 to carry over into the next measure.  But if a long sequence
2630 of such carry-over measures appears the music can appear compressed
2631 or even flowing off the page.  This is because automatic line
2632 breaks happen only at the end of complete measures, i.e., where
2633 all notes end before the end of a measure.
2634
2635 @warning{An incorrect duration can cause line breaks to be
2636 inhibited, leading to a line of highly compressed music or
2637 music which flows off the page.}
2638
2639 @cindex line breaks
2640 @cindex bar lines, invisible
2641 @cindex measure lines, invisible
2642
2643 Line breaks are also permitted at manually inserted bar lines
2644 even within incomplete measures.  To allow a line break without
2645 printing a bar line, use the following:
2646
2647 @example
2648 \bar ""
2649 @end example
2650
2651 @noindent
2652 This will insert an invisible bar line and allow (but not
2653 force) a line break to occur at this point.  The bar number
2654 counter is not increased.  To force a line break see
2655 @ref{Line breaking}.
2656
2657 @cindex manual bar lines
2658 @cindex manual measure lines
2659 @cindex bar lines, manual
2660 @cindex measure lines, manual
2661
2662 This and other special bar lines may be inserted manually at any
2663 point.  When they coincide with the end of a measure they replace
2664 the simple bar line which would have been inserted there
2665 automatically.  When they do not coincide with the end of a measure
2666 the specified bar line is inserted at that point in the printed
2667 output.
2668
2669 Note that manual bar lines are purely visual.  They do not affect
2670 any of the properties that a normal bar line would affect, such as
2671 measure numbers, accidentals, line breaks, etc.  They do not affect
2672 the calculation and placement of subsequent automatic bar lines.
2673 When a manual bar line is placed where a normal bar line already
2674 exists, the effects of the original bar line are not altered.
2675
2676 Two types of simple bar lines and five types of double bar lines are
2677 available for manual insertion:
2678
2679 @lilypond[quote,relative=1,verbatim]
2680 f1 \bar "|"
2681 f1 \bar "."
2682 g1 \bar "||"
2683 a1 \bar ".|"
2684 b1 \bar ".."
2685 c1 \bar "|.|"
2686 d1 \bar "|."
2687 e1
2688 @end lilypond
2689
2690 @noindent
2691 together with dotted and dashed bar lines:
2692
2693 @lilypond[quote,relative=1,verbatim]
2694 f1 \bar ";"
2695 g1 \bar "!"
2696 a1
2697 @end lilypond
2698
2699 @noindent
2700 and nine types of repeat bar lines:
2701
2702 @lilypond[quote,relative=1,verbatim]
2703 f1 \bar ".|:"
2704 g1 \bar ":..:"
2705 a1 \bar ":|.|:"
2706 b1 \bar ":|.:"
2707 c1 \bar ":.|.:"
2708 d1 \bar "[|:"
2709 e1 \bar ":|][|:"
2710 f1 \bar ":|]"
2711 g1 \bar ":|."
2712 a1
2713 @end lilypond
2714
2715 Additionally, a bar line can be printed as a simple tick:
2716 @lilypond[quote,relative=1,verbatim]
2717 f1 \bar "'" g1
2718 @end lilypond
2719 However, as such ticks are typically used in Gregorian chant, it is
2720 preferable to use @code{\divisioMinima} there instead, described in
2721 the section @ref{Divisiones} in Gregorian chant.
2722
2723 Lilypond supports kievan notation and provides a special kievan
2724 bar line:
2725 @lilypond[quote,relative=1,verbatim]
2726 f1 \bar "k"
2727 @end lilypond
2728 Further details of this notation are explained in
2729 @ref{Typesetting Kievan square notation}.
2730
2731 @cindex segno
2732
2733 For in-line segno signs, there are three types of bar lines which
2734 differ in their behavior at line breaks:
2735
2736 @lilypond[quote,relative=2,verbatim]
2737 c4 c c c
2738 \bar "S"
2739 c4 c c c \break
2740 \bar "S"
2741 c4 c c c
2742 \bar "S-|"
2743 c4 c c c \break
2744 \bar "S-|"
2745 c4 c c c
2746 \bar "S-S"
2747 c4 c c c \break
2748 \bar "S-S"
2749 c1
2750 @end lilypond
2751
2752 @cindex repeats
2753
2754 Although the bar line types signifying repeats may be inserted
2755 manually they do not in themselves cause LilyPond to recognize
2756 a repeated section.  Such repeated sections are better entered
2757 using the various repeat commands (see @ref{Repeats}), which
2758 automatically print the appropriate bar lines.
2759
2760 In addition, you can specify @code{".|:-||"}, which is equivalent to
2761 @code{".|:"} except at line breaks, where it gives a double bar
2762 line at the end of the line and a start repeat at the beginning of
2763 the next line.
2764
2765 @lilypond[quote,relative=2,verbatim]
2766 c4 c c c
2767 \bar ".|:-||"
2768 c4 c c c \break
2769 \bar ".|:-||"
2770 c4 c c c
2771 @end lilypond
2772
2773 For combinations of repeats with the segno sign, there are six different
2774 variations:
2775
2776 @lilypond[quote,relative=2,verbatim]
2777 c4 c c c
2778 \bar ":|.S"
2779 c4 c c c \break
2780 \bar ":|.S"
2781 c4 c c c
2782 \bar ":|.S-S"
2783 c4 c c c \break
2784 \bar ":|.S-S"
2785 c4 c c c
2786 \bar "S.|:-S"
2787 c4 c c c \break
2788 \bar "S.|:-S"
2789 c4 c c c
2790 \bar "S.|:"
2791 c4 c c c \break
2792 \bar "S.|:"
2793 c4 c c c
2794 \bar ":|.S.|:"
2795 c4 c c c \break
2796 \bar ":|.S.|:"
2797 c4 c c c
2798 \bar ":|.S.|:-S"
2799 c4 c c c \break
2800 \bar ":|.S.|:-S"
2801 c1
2802 @end lilypond
2803
2804 Additionally there is an @code{\inStaffSegno} command which creates
2805 a segno bar line in conjunction with an appropriate repeat bar line
2806 when used with a @code{\repeat volta} command, see
2807 @ref{Normal repeats}.
2808
2809 @funindex \defineBarLine
2810 @funindex defineBarLine
2811 @cindex bar lines, defining
2812 @cindex defining bar lines
2813
2814 New bar line types can be defined with @code{\defineBarLine}:
2815
2816 @example
2817 \defineBarLine @var{bartype} #'(@var{end} @var{begin} @var{span})
2818 @end example
2819
2820 The @code{\defineBarline} variables can include the
2821 @q{empty} string @code{""}, which is equivalent to an invisible
2822 bar line being printed.  Or they can be set to @code{#f} which
2823 prints no bar line at all.
2824
2825 After the definiton, the new bar line can be used by
2826 @code{\bar} @var{bartype}.
2827
2828 There are currently ten bar line elements available:
2829
2830 @lilypond[quote,verbatim]
2831 \defineBarLine ":" #'("" ":" "")
2832 \defineBarLine "=" #'("=" "" "")
2833 \defineBarLine "[" #'("" "[" "")
2834 \defineBarLine "]" #'("]" "" "")
2835
2836 \new Staff {
2837   s1 \bar "|"
2838   s1 \bar "."
2839   s1 \bar "!"
2840   s1 \bar ";"
2841   s1 \bar ":"
2842   s1 \bar "k"
2843   s1 \bar "S"
2844   s1 \bar "="
2845   s1 \bar "["
2846   s1 \bar "]"
2847   s1 \bar ""
2848 }
2849 @end lilypond
2850
2851 The @code{"="} bar line provides the double span bar line, used
2852 in combination with the segno sign.  Do not use it as a standalone
2853 double thin bar line; here, @code{\bar} @var{"||"} is
2854 preferred.
2855
2856 The @code{"-"} sign starts annotations to bar lines which
2857 are useful to distinguish those with identical appearance
2858 but different behavior at line breaks and/or different span bars.
2859 The part following the @code{"-"} sign is not used for building up
2860 the bar line.
2861
2862 @lilypond[quote,relative=2,verbatim]
2863 \defineBarLine "||-dashedSpan" #'("||" "" "!!")
2864
2865 \new StaffGroup <<
2866   \new Staff {
2867     c1 \bar "||"
2868     c1 \bar "||-dashedSpan"
2869     c1
2870   }
2871   \new Staff {
2872     c1
2873     c1
2874     c1
2875   }
2876 >>
2877 @end lilypond
2878
2879 Furthermore, the space character @code{" "} serves as a placeholder
2880 for defining span bars correctly aligned to the main bar lines:
2881
2882 @lilypond[quote,relative=2,verbatim]
2883 \defineBarLine ":|.-wrong" #'(":|." "" "|.")
2884 \defineBarLine ":|.-right" #'(":|." "" " |.")
2885
2886 \new StaffGroup <<
2887   \new Staff {
2888     c1 \bar ":|.-wrong"
2889     c1 \bar ":|.-right"
2890     c1
2891   }
2892   \new Staff {
2893     c1
2894     c1
2895     c1
2896   }
2897 >>
2898 @end lilypond
2899
2900 If additional elements are needed, LilyPond provides a simple
2901 way to define them.  For more informations on modifying or adding
2902 bar lines, see file @file{scm/bar-line.scm}.
2903
2904 In scores with many staves, a @code{\bar} command in one staff is
2905 automatically applied to all staves.  The resulting bar lines are
2906 connected between different staves of a @code{StaffGroup},
2907 @code{PianoStaff}, or @code{GrandStaff}.
2908
2909 @lilypond[quote,relative=1,verbatim]
2910 <<
2911   \new StaffGroup <<
2912     \new Staff {
2913       e4 d
2914       \bar "||"
2915       f4 e
2916     }
2917     \new Staff { \clef bass c4 g e g }
2918   >>
2919   \new Staff { \clef bass c2 c2 }
2920 >>
2921 @end lilypond
2922
2923
2924 @cindex default bar lines, changing
2925 @cindex bar lines, default, changing
2926
2927 @funindex whichBar
2928 @funindex defaultBarType
2929 @funindex \bar
2930 @funindex bar
2931 @funindex bartype
2932
2933 The command @samp{\bar @var{bartype}} is a shortcut for
2934 @samp{\set Timing.whichBar = @var{bartype}}.  A bar line is
2935 created whenever the @code{whichBar} property is set.
2936
2937 The default bar type used for automatically inserted bar lines is
2938 @code{"|"}.  This may be changed at any time with
2939 @samp{\set Timing.defaultBarType = @var{bartype}}.
2940
2941 @seealso
2942 Notation Reference:
2943 @ref{Line breaking},
2944 @ref{Repeats},
2945 @ref{Grouping staves}.
2946
2947 Installed Files:
2948 @file{scm/bar-line.scm}.
2949
2950 Snippets:
2951 @rlsr{Rhythms}.
2952
2953 Internals Reference:
2954 @rinternals{BarLine} (created at @code{Staff} level),
2955 @rinternals{SpanBar} (across staves),
2956 @rinternals{Timing_translator} (for Timing properties).
2957
2958
2959 @node Bar numbers
2960 @unnumberedsubsubsec Bar numbers
2961
2962 @cindex bar numbers
2963 @cindex measure numbers
2964 @cindex numbers, bar
2965 @cindex numbers, measure
2966
2967 @funindex currentBarNumber
2968
2969 Bar numbers are typeset by default at the start of every line except
2970 the first line.  The number itself is stored in the
2971 @code{currentBarNumber} property, which is normally updated
2972 automatically for every measure.  It may also be set manually:
2973
2974 @lilypond[verbatim,quote,relative=1]
2975 c1 c c c
2976 \break
2977 \set Score.currentBarNumber = #50
2978 c1 c c c
2979 @end lilypond
2980
2981 @cindex bar numbers, regular spacing
2982
2983 @funindex barNumberVisibility
2984 @funindex BarNumber
2985
2986 Bar numbers can be typeset at regular intervals instead of just at
2987 the beginning of every line.  To do this the default behavior
2988 must be overridden to permit bar numbers to be printed at places
2989 other than the start of a line.  This is controlled by the
2990 @code{break-visibility} property of @code{BarNumber}.  This takes
2991 three values which may be set to @code{#t} or @code{#f} to specify
2992 whether the corresponding bar number is visible or not.  The order
2993 of the three values is @code{end of line visible}, @code{middle of
2994 line visible}, @code{beginning of line visible}.  In the following
2995 example bar numbers are printed at all possible places:
2996
2997 @lilypond[verbatim,quote,relative=1]
2998 \override Score.BarNumber.break-visibility = ##(#t #t #t)
2999 \set Score.currentBarNumber = #11
3000 % Permit first bar number to be printed
3001 \bar ""
3002 c1 | c | c | c
3003 \break
3004 c1 | c | c | c
3005 @end lilypond
3006
3007 @snippets
3008 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
3009 {printing-the-bar-number-for-the-first-measure.ly}
3010
3011 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
3012 {printing-bar-numbers-at-regular-intervals.ly}
3013
3014 @cindex measure number, format
3015 @cindex bar number, format
3016
3017 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
3018 {printing-bar-numbers-inside-boxes-or-circles.ly}
3019
3020 @cindex bar numbers, with letters
3021 @cindex bar numbers, with repeats
3022
3023 @lilypondfile[verbatim,quote,texidoc,doctitle]
3024 {alternative-bar-numbering.ly}
3025
3026 @cindex bar number alignment
3027
3028 @lilypondfile[verbatim,quote,texidoc,doctitle]
3029 {aligning-bar-numbers.ly}
3030
3031 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
3032 {removing-bar-numbers-from-a-score.ly}
3033
3034 @seealso
3035 Snippets:
3036 @rlsr{Rhythms}.
3037
3038 Internals Reference:
3039 @rinternals{BarNumber},
3040 @rinternals{Bar_number_engraver}.
3041
3042 @cindex bar number collision
3043 @cindex collision, bar number
3044
3045 @knownissues
3046 Bar numbers may collide with the top of the @code{StaffGroup} bracket,
3047 if there is one.  To solve this, the @code{padding} property of
3048 @code{BarNumber} can be used to position the number correctly.  See
3049 @rinternals{StaffGroup} and @rinternals{BarNumber} for more.
3050
3051
3052 @node Bar and bar number checks
3053 @unnumberedsubsubsec Bar and bar number checks
3054
3055 @cindex bar check
3056 @cindex bar number check
3057 @cindex measure check
3058 @cindex measure number check
3059
3060 @funindex barCheckSynchronize
3061 @funindex |
3062
3063 Bar checks help detect errors in the entered durations.  A bar check
3064 may be entered using the bar symbol, @code{|}, at any place where a
3065 bar line is expected to fall.  If bar check lines are encountered at
3066 other places, a list of warnings is printed in the log file, showing
3067 the line numbers and lines in which the bar checks failed.  In the
3068 next example, the second bar check will signal an error.
3069
3070 @example
3071 \time 3/4 c2 e4 | g2 |
3072 @end example
3073
3074 Bar checks can also be used in lyrics:
3075
3076 @example
3077 \lyricmode @{
3078   \time 2/4
3079   Twin -- kle | Twin -- kle |
3080 @}
3081 @end example
3082
3083 An incorrect duration can result in a completely garbled score,
3084 especially if the score is polyphonic, so a good place to start
3085 correcting input is by scanning for failed bar checks and
3086 incorrect durations.
3087
3088 If successive bar checks are off by the same musical interval,
3089 only the first warning message is displayed.  This allows the
3090 warning to focus on the source of the timing error.
3091
3092
3093 @funindex |
3094 @funindex "|"
3095
3096 It is also possible to redefine the action taken when a bar check
3097 or pipe symbol, @code{|}, is encountered in the input, so that
3098 it does something other than a bar check.  This is done by
3099 assigning a music expression to @code{"|"}.
3100 In the following example @code{|} is set to insert a double bar
3101 line wherever it appears in the input, rather than checking
3102 for end of bar.
3103
3104 @lilypond[quote,verbatim]
3105 "|" = \bar "||"
3106 {
3107   c'2 c' |
3108   c'2 c'
3109   c'2 | c'
3110   c'2 c'
3111 }
3112 @end lilypond
3113
3114 @funindex \barNumberCheck
3115 @funindex barNumberCheck
3116
3117 When copying large pieces of music, it can be helpful to check that
3118 the LilyPond bar number corresponds to the original that you are
3119 entering from.  This can be checked with @code{\barNumberCheck}, for
3120 example,
3121
3122 @verbatim
3123 \barNumberCheck #123
3124 @end verbatim
3125
3126 @noindent
3127 will print a warning if the @code{currentBarNumber} is not 123
3128 when it is processed.
3129
3130 @seealso
3131 Snippets:
3132 @rlsr{Rhythms}.
3133
3134
3135 @node Rehearsal marks
3136 @unnumberedsubsubsec Rehearsal marks
3137
3138 @cindex rehearsal marks
3139 @cindex mark, rehearsal
3140
3141 @funindex \mark
3142 @funindex mark
3143
3144 To print a rehearsal mark, use the @code{\mark} command.
3145
3146 @lilypond[quote,verbatim,relative=2]
3147 c1 \mark \default
3148 c1 \mark \default
3149 c1 \mark \default
3150 c1 \mark \default
3151 @end lilypond
3152
3153 @noindent
3154 The mark is incremented automatically if you use @code{\mark
3155 \default}, but you can also use an integer argument to set the
3156 mark manually.  The value to use is stored in the property
3157 @code{rehearsalMark}.
3158
3159 @lilypond[quote,verbatim,relative=2]
3160 c1 \mark \default
3161 c1 \mark \default
3162 c1 \mark #8
3163 c1 \mark \default
3164 c1 \mark \default
3165 @end lilypond
3166
3167 @noindent
3168 The letter@tie{}@q{I} is skipped in accordance with engraving
3169 traditions.  If you wish to include the letter @q{I}, then use one
3170 of the following commands, depending on which style of rehearsal mark
3171 you want (letters only, letters in a hollow box, or letters in a
3172 hollow circle).
3173
3174 @example
3175 \set Score.markFormatter = #format-mark-alphabet
3176 \set Score.markFormatter = #format-mark-box-alphabet
3177 \set Score.markFormatter = #format-mark-circle-alphabet
3178 @end example
3179
3180 @lilypond[quote,verbatim,relative=2]
3181 \set Score.markFormatter = #format-mark-box-alphabet
3182 c1 \mark \default
3183 c1 \mark \default
3184 c1 \mark #8
3185 c1 \mark \default
3186 c1 \mark \default
3187 @end lilypond
3188
3189 @cindex rehearsal mark format
3190 @cindex rehearsal mark style
3191 @cindex style, rehearsal mark
3192 @cindex format, rehearsal mark
3193 @cindex mark, rehearsal, style
3194 @cindex mark, rehearsal, format
3195 @cindex rehearsal mark, manual
3196 @cindex mark, rehearsal, manual
3197 @cindex custom rehearsal mark
3198 @cindex manual rehearsal mark
3199
3200 The style is defined by the property @code{markFormatter}.  It is
3201 a function taking the current mark (an integer) and the current
3202 context as argument.  It should return a markup object.  In the
3203 following example, @code{markFormatter} is set to a pre-defined
3204 procedure.  After a few measures, it is set to a procedure that
3205 produces a boxed number.
3206
3207 @lilypond[quote,verbatim,relative=2]
3208 \set Score.markFormatter = #format-mark-numbers
3209 c1 \mark \default
3210 c1 \mark \default
3211 \set Score.markFormatter = #format-mark-box-numbers
3212 c1 \mark \default
3213 \set Score.markFormatter = #format-mark-circle-numbers
3214 c1 \mark \default
3215 \set Score.markFormatter = #format-mark-circle-letters
3216 c1
3217 @end lilypond
3218
3219 The file @file{scm/translation-functions.scm} contains the
3220 definitions of @code{format-mark-numbers} (the default format),
3221 @code{format-mark-box-numbers}, @code{format-mark-letters} and
3222 @code{format-mark-box-letters}.  These can be used as inspiration
3223 for other formatting functions.
3224
3225 You may use @code{format-mark-barnumbers},
3226 @code{format-mark-box-barnumbers}, and
3227 @code{format-mark-circle-barnumbers} to get bar numbers instead of
3228 incremented numbers or letters.
3229
3230 Other styles of rehearsal mark can be specified manually:
3231
3232 @example
3233 \mark "A1"
3234 @end example
3235
3236 @noindent
3237 Note that @code{Score.markFormatter} does not affect marks specified
3238 in this manner.  However, it is possible to apply a @code{\markup} to the
3239 string.
3240
3241 @example
3242 \mark \markup@{ \box A1 @}
3243 @end example
3244
3245 @cindex segno
3246 @cindex coda
3247 @cindex D.S. al Fine
3248 @cindex fermata
3249 @cindex music glyphs
3250 @cindex glyphs, music
3251
3252 @funindex \musicglyph
3253 @funindex musicglyph
3254
3255 Music glyphs (such as the segno sign) may be printed inside a
3256 @code{\mark}
3257
3258 @lilypond[quote,verbatim,relative=1]
3259 c1 \mark \markup { \musicglyph #"scripts.segno" }
3260 c1 \mark \markup { \musicglyph #"scripts.coda" }
3261 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
3262 c1
3263 @end lilypond
3264
3265 @noindent
3266 See @ref{The Feta font}, for a list of symbols which may be
3267 printed with @code{\musicglyph}.
3268
3269 For common tweaks to the positioning of rehearsal marks, see
3270 @ref{Formatting text}.  For more precise control, see
3271 @code{break-alignable-interface} in @ref{Aligning objects}.
3272
3273 The file @file{scm/translation-functions.scm} contains
3274 the definitions of @code{format-mark-numbers} and
3275 @code{format-mark-letters}.  They can be used as inspiration for
3276 other formatting functions.
3277
3278 @seealso
3279 Notation Reference:
3280 @ref{The Feta font},
3281 @ref{Formatting text},
3282 @ref{Aligning objects}.
3283
3284 Installed Files:
3285 @file{scm/translation-functions.scm}.
3286
3287 Snippets:
3288 @rlsr{Rhythms}.
3289
3290 Internals Reference:
3291 @rinternals{MarkEvent},
3292 @rinternals{Mark_engraver},
3293 @rinternals{RehearsalMark}.
3294
3295
3296 @node Special rhythmic concerns
3297 @subsection Special rhythmic concerns
3298
3299
3300 @menu
3301 * Grace notes::
3302 * Aligning to cadenzas::
3303 * Time administration::
3304 @end menu
3305
3306 @node Grace notes
3307 @unnumberedsubsubsec Grace notes
3308
3309 @cindex ornaments
3310 @cindex grace notes
3311 @cindex appoggiatura
3312 @cindex acciaccatura
3313
3314 @funindex \grace
3315 @funindex \slashedGrace
3316 @funindex \acciaccatura
3317 @funindex \appoggiatura
3318
3319 Grace notes are musical ornaments, printed in a smaller font, that take
3320 up no additional logical time in a measure.
3321
3322 @lilypond[quote,relative=2,verbatim]
3323 c4 \grace b16 a4(
3324 \grace { b16 c16 } a2)
3325 @end lilypond
3326
3327 There are three other types of grace notes possible; the
3328 @emph{acciaccatura} -- an unmeasured grace note indicated by a slurred
3329 note with a slashed stem -- and the @emph{appoggiatura}, which takes a
3330 fixed fraction of the main note it is attached to and prints without the
3331 slash.  It is also possible to write a grace note with a slashed stem,
3332 like the @emph{acciaccatura} but without the slur, so as to place it
3333 between notes that are slurred themselves, using the
3334 @code{\slashedGrace} function.
3335
3336 @lilypond[quote,relative=2,verbatim]
3337 \acciaccatura d8 c4
3338 \appoggiatura e8 d4
3339 \acciaccatura { g16 f } e2
3340 \slashedGrace a,8 g4
3341 \slashedGrace b16 a4(
3342 \slashedGrace b8 a2)
3343 @end lilypond
3344
3345 The placement of grace notes is synchronized between different staves.
3346 In the following example, there are two sixteenth grace notes for every
3347 eighth grace note
3348
3349 @lilypond[quote,relative=2,verbatim]
3350 <<
3351   \new Staff { e2 \grace { c16 d e f } e2 }
3352   \new Staff { c2 \grace { g8 b } c2 }
3353 >>
3354 @end lilypond
3355
3356 @cindex grace notes, following
3357
3358 @funindex \afterGrace
3359 @funindex afterGrace
3360
3361 If you want to end a note with a grace, use the @code{\afterGrace}
3362 command.  It takes two arguments: the main note, and the grace
3363 notes following the main note.
3364
3365 @lilypond[quote,verbatim,relative=2]
3366 c1 \afterGrace d1 { c16[ d] } c1
3367 @end lilypond
3368
3369 This will put the grace notes after a space lasting 3/4 of the
3370 length of the main note.  The default fraction 3/4 can be changed by
3371 setting @code{afterGraceFraction}.  The following example shows
3372 the results from setting the space at the default,  at 15/16, and
3373 finally at 1/2 of the main note.
3374
3375 @lilypond[quote,verbatim,relative=2]
3376 <<
3377   \new Staff {
3378     c1 \afterGrace d1 { c16[ d] } c1
3379   }
3380   \new Staff {
3381     #(define afterGraceFraction (cons 15 16))
3382     c1 \afterGrace d1 { c16[ d] } c1
3383   }
3384   \new Staff {
3385     #(define afterGraceFraction (cons 1 2))
3386     c1 \afterGrace d1 { c16[ d] } c1
3387   }
3388 >>
3389 @end lilypond
3390
3391 The space between the main note and the grace note may also be
3392 specified using spacers.  The following example places the grace
3393 note after a space lasting 7/8 of the main note.
3394
3395 @lilypond[quote,verbatim,relative=2]
3396 \new Voice {
3397   <<
3398     { d1^\trill_( }
3399     { s2 s4. \grace { c16 d } }
3400   >>
3401   c1)
3402 }
3403 @end lilypond
3404
3405 @cindex tweaking grace notes
3406 @cindex grace notes, tweaking
3407 @cindex grace notes, changing layout settings
3408
3409 A @code{\grace} music expression will introduce special
3410 typesetting settings, for example, to produce smaller type, and
3411 set directions.  Hence, when introducing layout tweaks to
3412 override the special settings, they should be placed inside
3413 the grace expression.  The overrides should also be reverted
3414 inside the grace expression.  Here, the grace note's default stem
3415 direction is overridden and then reverted.
3416
3417 @lilypond[quote,verbatim,relative=2]
3418 \new Voice {
3419   \acciaccatura {
3420     \stemDown
3421     f16->
3422     \stemNeutral
3423   }
3424   g4 e c2
3425 }
3426 @end lilypond
3427
3428
3429 @cindex stem, with slash
3430
3431
3432 @snippets
3433
3434 @lilypondfile[verbatim,quote,texidoc,doctitle]
3435 {using-grace-note-slashes-with-normal-heads.ly}
3436
3437 @lilypondfile[verbatim,quote,texidoc,doctitle]
3438 {tweaking-grace-layout-within-music.ly}
3439
3440 @lilypondfile[verbatim,quote,texidoc,doctitle]
3441 {redefining-grace-note-global-defaults.ly}
3442
3443 @lilypondfile[verbatim,quote,texidoc,doctitle]
3444 {positioning-grace-notes-with-floating-space.ly}
3445
3446 @seealso
3447 Music Glossary:
3448 @rglos{grace notes},
3449 @rglos{acciaccatura},
3450 @rglos{appoggiatura}.
3451
3452 Notation Reference:
3453 @ref{Scaling durations},
3454 @ref{Manual beams}.
3455
3456 Installed Files:
3457 @file{ly/grace-init.ly}.
3458
3459 Snippets:
3460 @rlsr{Rhythms}.
3461
3462 Internals Reference:
3463 @rinternals{GraceMusic},
3464 @rinternals{Grace_beam_engraver},
3465 @rinternals{Grace_auto_beam_engraver},
3466 @rinternals{Grace_engraver},
3467 @rinternals{Grace_spacing_engraver}.
3468
3469
3470 @knownissues
3471 @cindex acciaccatura, multi-note
3472 @cindex multi-note acciaccatura
3473 @cindex grace-note synchronization
3474
3475 A multi-note beamed @i{acciaccatura} is printed without a slash,
3476 and looks exactly the same as a multi-note beamed
3477 @i{appoggiatura}.
3478
3479 @c TODO Add link to LSR snippet to add slash when available
3480
3481 Grace note synchronization can also lead to surprises.  Staff
3482 notation, such as key signatures, bar lines, etc., are also
3483 synchronized.  Take care when you mix staves with grace notes and
3484 staves without, for example,
3485
3486 @lilypond[quote,relative=2,verbatim]
3487 <<
3488   \new Staff { e4 \bar ".|:" \grace c16 d2. }
3489   \new Staff { c4 \bar ".|:" d2. }
3490 >>
3491 @end lilypond
3492
3493 @noindent
3494 This can be remedied by inserting grace skips of the corresponding
3495 durations in the other staves.  For the above example
3496
3497 @lilypond[quote,relative=2,verbatim]
3498 <<
3499   \new Staff { e4 \bar ".|:" \grace c16 d2. }
3500   \new Staff { c4 \bar ".|:" \grace s16 d2. }
3501 >>
3502 @end lilypond
3503
3504 Please make sure that you use the @code{\grace} command for the
3505 spacer part, even if the visual part uses @code{\acciaccatura} or
3506 @code{\appoggiatura} because otherwise an ugly slur fragment will
3507 be printed, connecting the invisible grace note with the following
3508 note.
3509
3510 The use of grace notes within voice contexts confuses the way the voice
3511 is typeset. This can be overcome by inserting a rest or note between the
3512 voice command and the grace note.
3513
3514 @lilypond[quote,verbatim]
3515 accMusic = {
3516   \acciaccatura { f8 } e8 r8 \acciaccatura { f8 } e8 r4
3517 }
3518
3519 \new Staff {
3520   <<
3521     \new Voice {
3522       \relative c'' {
3523         r8 r8 \voiceOne \accMusic \oneVoice r8 |
3524         r8 \voiceOne r8 \accMusic \oneVoice r8 |
3525       }
3526     }
3527     \new Voice {
3528       \relative c' {
3529         s8 s8 \voiceTwo \accMusic \oneVoice s8 |
3530         s8 \voiceTwo r8 \accMusic \oneVoice s8 |
3531       }
3532     }
3533   >>
3534 }
3535 @end lilypond
3536
3537 Grace sections should only be used within sequential music expressions.
3538 Nesting or juxtaposing grace sections is not supported, and might
3539 produce crashes or other errors.
3540
3541 Each grace note in MIDI output has a length of 1/4 of its actual
3542 duration.  If the combined length of the grace notes is greater than the
3543 length of the preceding note a @qq{@code{Going back in MIDI time}}
3544 error will be generated.  Either make the grace notes shorter in
3545 duration, for example:
3546
3547 @example
3548 c'8 \acciaccatura @{ c'8[ d' e' f' g'] @}
3549 @end example
3550
3551 becomes:
3552
3553 @example
3554 c'8 \acciaccatura @{ c'16[ d' e' f' g'] @}
3555 @end example
3556
3557 Or explicitly change the musical duration:
3558
3559 @example
3560 c'8 \acciaccatura @{ \scaleDurations 1/2 @{ c'8[ d' e' f' g'] @} @}
3561 @end example
3562
3563 See @ref{Scaling durations}.
3564
3565
3566 @node Aligning to cadenzas
3567 @unnumberedsubsubsec Aligning to cadenzas
3568
3569 @cindex cadenza
3570 @cindex cadenza, aligning to
3571 @cindex aligning to cadenza
3572
3573 In an orchestral context, cadenzas present a special problem: when
3574 constructing a score that includes a measured cadenza or other solo
3575 passage, all other instruments should skip just as many notes as the
3576 length of the cadenza, otherwise they will start too soon or too late.
3577
3578 One solution to this problem is to use the functions
3579 @code{mmrest-of-length} and @code{skip-of-length}.  These Scheme
3580 functions take a defined piece of music as an argument and generate a
3581 multi-measure rest or @code{\skip} exactly as long as the piece.
3582
3583 @lilypond[verbatim,quote]
3584 MyCadenza = \relative c' {
3585   c4 d8 e f g g4
3586   f2 g4 g
3587 }
3588
3589 \new GrandStaff <<
3590   \new Staff {
3591     \MyCadenza c'1
3592     \MyCadenza c'1
3593   }
3594   \new Staff {
3595     #(mmrest-of-length MyCadenza)
3596     c'1
3597     #(skip-of-length MyCadenza)
3598     c'1
3599   }
3600 >>
3601 @end lilypond
3602
3603 @seealso
3604 Music Glossary:
3605 @rglos{cadenza}.
3606
3607 Snippets:
3608 @rlsr{Rhythms}.
3609
3610
3611 @node Time administration
3612 @unnumberedsubsubsec Time administration
3613
3614 @cindex time administration
3615 @cindex timing (within the score)
3616 @cindex music, unmetered
3617 @cindex unmetered music
3618
3619 @funindex currentBarNumber
3620 @funindex measurePosition
3621 @funindex measureLength
3622
3623 Time is administered by the @code{Timing_translator}, which by
3624 default is to be found in the @code{Score} context.  An alias,
3625 @code{Timing}, is added to the context in which the
3626 @code{Timing_translator} is placed.  To ensure that the
3627 @code{Timing} alias is available, you may need to explicitly
3628 instantiate the containing context (such as @code{Voice} or
3629 @code{Staff}).
3630
3631 The following properties of @code{Timing} are used
3632 to keep track of timing within the score.
3633
3634 @cindex bar number
3635 @cindex measure number
3636
3637 @table @code
3638 @item currentBarNumber
3639 The current measure number.  For an example showing the
3640 use of this property see @ref{Bar numbers}.
3641
3642 @item measureLength
3643 The length of the measures in the current time signature.  For a
3644 4/4 time this is@tie{}1, and for 6/8 it is 3/4.  Its value
3645 determines when bar lines are inserted and how automatic beams
3646 should be generated.
3647
3648 @item measurePosition
3649 The point within the measure where we currently are.  This
3650 quantity is reset by subtracting @code{measureLength} whenever
3651 @code{measureLength} is reached or exceeded.  When that happens,
3652 @code{currentBarNumber} is incremented.
3653
3654 @item timing
3655 If set to true, the above variables are updated for every time
3656 step.  When set to false, the engraver stays in the current
3657 measure indefinitely.
3658
3659 @end table
3660
3661 Timing can be changed by setting any of these variables
3662 explicitly.  In the next example, the default 4/4 time
3663 signature is printed, but @code{measureLength} is set to 5/4.
3664 At 4/8 through the third measure, the @code{measurePosition} is
3665 advanced by 1/8 to 5/8, shortening that bar by 1/8.
3666 The next bar line then falls at 9/8 rather than 5/4.
3667
3668 @lilypond[quote,verbatim]
3669 \new Voice \relative c' {
3670   \set Timing.measureLength = #(ly:make-moment 5/4)
3671   c1 c4 |
3672   c1 c4 |
3673   c4 c
3674   \set Timing.measurePosition = #(ly:make-moment 5/8)
3675   b4 b b8 |
3676   c4 c1 |
3677 }
3678 @end lilypond
3679
3680 @noindent
3681 As the example illustrates, @code{ly:make-moment n m} constructs a
3682 duration of n/m of a whole note.  For example,
3683 @code{ly:make-moment 1 8} is an eighth note duration and
3684 @code{ly:make-moment 7 16} is the duration of seven sixteenths
3685 notes.
3686
3687 @seealso
3688 Notation Reference:
3689 @ref{Bar numbers},
3690 @ref{Unmetered music}.
3691
3692 Snippets:
3693 @rlsr{Rhythms}.
3694
3695 Internals Reference:
3696 @rinternals{Timing_translator},
3697 @rinternals{Score}.