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