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