]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/notation/rhythms.itely
Merge branch 'lilypond/translation' of ssh://git.sv.gnu.org/srv/git/lilypond into...
[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.  See TRANSLATION for details.
7 @end ignore
8
9 @c \version "2.12.0"
10
11 @node Rhythms
12 @section Rhythms
13
14 @lilypondfile[quote]{rhythms-headword.ly}
15
16 This section discusses rhythms, rests, durations, beaming and bars.
17
18 @menu
19 * Writing rhythms::
20 * Writing rests::
21 * Displaying rhythms::
22 * Beams::
23 * Bars::
24 * Special rhythmic concerns::
25 @end menu
26
27
28 @node Writing rhythms
29 @subsection Writing rhythms
30
31 @menu
32 * Durations::
33 * Tuplets::
34 * Scaling durations::
35 * Ties::
36 @end menu
37
38 @node Durations
39 @unnumberedsubsubsec Durations
40
41 @cindex durations, of notes
42 @cindex note durations
43 @cindex length of notes
44 @cindex note lengths
45
46 @funindex \longa
47 @funindex longa
48 @funindex \breve
49 @funindex breve
50 @funindex \maxima
51 @funindex maxima
52
53 Durations are designated by numbers and dots.  Durations are entered
54 as their reciprocal values.  For example, a quarter note is entered
55 using a @code{4} (since it is a 1/4 note), and a half note is entered
56 using a @code{2} (since it is a 1/2 note).  For notes longer than a
57 whole you must use the @code{\longa} (a double breve) and
58 @code{\breve} commands.  Durations as short as 128th notes may be
59 specified.  Shorter values are possible, but only as beamed notes.
60
61 @c Two 64th notes are needed to obtain beams
62 @lilypond[quote,verbatim,relative=2]
63 \time 8/1
64 c\longa c\breve c1 c2
65 c4 c8 c16 c32 c64 c128 c128
66 @end lilypond
67
68 Here are the same durations with automatic beaming turned off.
69
70 @c not strictly "writing rhythms"; more of a "displaying" thing,
71 @c but it's ok here.  -gp
72 @lilypond[quote,verbatim,relative=2]
73 \time 8/1
74 \autoBeamOff
75 c\longa c\breve c1 c2
76 c4 c8 c16 c32 c64 c128 c128
77 @end lilypond
78
79 A note with the duration of a quadruple breve may be entered with
80 @code{\maxima}, but this is supported only within ancient music
81 notation.  For details, see @ref{Ancient notation}.
82
83 @cindex duration, default
84 @cindex default note duration
85 @cindex note duration, default
86
87 If the duration is omitted, it is set to the previously
88 entered duration.  The default for the first note is a quarter
89 note.
90
91 @lilypond[quote,verbatim,relative=2]
92 a a a2 a a4 a a1 a
93 @end lilypond
94
95 @cindex notes, dotted
96 @cindex dotted notes
97 @cindex notes, double-dotted
98 @cindex double-dotted notes
99
100 @funindex .
101
102 To obtain dotted note lengths, place a dot (@code{.}) after the
103 duration.  Double-dotted notes are specified by appending two
104 dots, and so on.
105
106 @lilypond[quote,verbatim,relative=2]
107 a4 b c4. b8 a4. b4.. c8.
108 @end lilypond
109
110 Some durations cannot be represented with just binary durations
111 and dots; they can be represented only by tying two or more
112 notes together.  For details, see @ref{Ties}.
113
114 For ways of specifying durations for the syllables of lyrics and
115 ways of aligning lyrics to notes, see @ref{Vocal music}.
116
117 Optionally, notes can be spaced strictly proportionately to their
118 duration.  For details of this and other settings which control
119 proportional notation, see @ref{Proportional notation}.
120
121 @funindex \dotsUp
122 @funindex dotsUp
123 @funindex \dotsDown
124 @funindex dotsDown
125 @funindex \dotsNeutral
126 @funindex dotsNeutral
127
128 Dots are normally moved up to avoid staff lines, except in
129 polyphonic situations.  Dots may be manually placed above or below
130 the staff; see @ref{Direction and placement}.
131
132
133 @predefined
134 @code{\autoBeamOn},
135 @code{\autoBeamOff},
136 @code{\dotsUp},
137 @code{\dotsDown},
138 @code{\dotsNeutral}.
139 @endpredefined
140
141
142 @seealso
143 Music Glossary:
144 @rglos{breve},
145 @rglos{longa},
146 @rglos{maxima},
147 @rglos{note value},
148 @rglos{Duration names notes and rests}.
149
150 Notation Reference:
151 @ref{Automatic beams},
152 @ref{Ties},
153 @ref{Stems},
154 @ref{Writing rhythms},
155 @ref{Writing rests},
156 @ref{Vocal music},
157 @ref{Ancient notation},
158 @ref{Proportional notation}.
159
160 Snippets:
161 @rlsr{Rhythms}.
162
163 Internals Reference:
164 @rinternals{Dots},
165 @rinternals{DotColumn}.
166
167
168 @knownissues
169
170 @c Deliberately duplicated in Durations and Rests.  -gp
171 There is no fundamental limit to rest durations (both in terms of
172 longest and shortest), but the number of glyphs is limited:
173 rests from 128th to maxima (8 x whole) may be printed.
174
175
176 @node Tuplets
177 @unnumberedsubsubsec Tuplets
178
179 @cindex tuplets
180 @cindex triplets
181
182 @funindex \times
183 @funindex times
184
185 Tuplets are made from a music expression by multiplying all the
186 durations with a fraction:
187
188 @example
189 \times @var{fraction} @{ @var{music} @}
190 @end example
191
192 @noindent
193 The duration of @var{music} will be multiplied by the
194 fraction.  The fraction's denominator will be printed over or
195 under the notes, optionally with a bracket.  The most common
196 tuplet is the triplet in which 3 notes have the duration of 2, so
197 the notes are 2/3 of their written length.
198
199 @lilypond[quote,verbatim,relative=2]
200 a2 \times 2/3 { b4 b b }
201 c4 c \times 2/3 { b4 a g }
202 @end lilypond
203
204 @cindex tuplet bracket placement
205
206 @funindex \tupletUp
207 @funindex tupletUp
208 @funindex \tupletDown
209 @funindex tupletDown
210 @funindex \tupletNeutral
211 @funindex tupletNeutral
212
213 Tuplet brackets may be manually placed above or below the staff;
214 see @ref{Direction and placement}.
215
216 Tuplets may be nested:
217
218 @lilypond[quote,verbatim,relative=2]
219 \autoBeamOff
220 c4 \times 4/5 { f8 e f \times 2/3 { e[ f g] } } f4 |
221 @end lilypond
222
223 Modifying nested tuplets which begin at the same musical moment
224 must be done with @code{\tweak}.
225
226 To modify the duration of notes without printing a tuplet bracket,
227 see @ref{Scaling durations}.
228
229
230 @predefined
231 @code{\tupletUp},
232 @code{\tupletDown},
233 @code{\tupletNeutral}.
234 @endpredefined
235
236
237 @snippets
238
239 @cindex tuplet formatting
240 @cindex triplet formatting
241
242 @funindex tupletNumberFormatFunction
243 @funindex tupletSpannerDuration
244
245 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
246 {entering-several-tuplets-using-only-one--times-command.ly}
247
248 @cindex Tuplet number changes
249
250 @funindex TupletNumber
251
252 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
253 {changing-the-tuplet-number.ly}
254
255 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
256 {non-default-tuplet-numbers.ly}
257
258 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
259 {permitting-line-breaks-within-beamed-tuplets.ly}
260
261
262 @seealso
263 Music Glossary:
264 @rglos{triplet},
265 @rglos{tuplet},
266 @rglos{polymetric}.
267
268 Learning Manual: @rlearning{Tweaking methods}.
269
270 Notation Reference:
271 @ref{Time administration},
272 @ref{Scaling durations},
273 @ref{The tweak command},
274 @ref{Polymetric notation}.
275
276 Snippets:
277 @rlsr{Rhythms}.
278
279 Internals Reference:
280 @rinternals{TupletBracket},
281 @rinternals{TupletNumber},
282 @rinternals{TimeScaledMusic}.
283
284 @cindex grace notes within tuplet brackets
285
286 @knownissues
287 When the first note on a staff is a grace note followed by a
288 tuplet the grace note must be placed before the @code{\times}
289 command to avoid errors.  Anywhere else, grace notes may be
290 placed within tuplet brackets.
291
292
293 @node Scaling durations
294 @unnumberedsubsubsec Scaling durations
295
296 @cindex scaling durations
297 @cindex durations, scaling
298
299 You can alter the duration of single notes, rests or chords by a
300 fraction @code{N/M} by appending @code{*N/M} (or @code{*N} if @code{M}
301 is 1) to the duration.  This will not affect the appearance of the
302 notes or rests produced, but the altered duration will be used in
303 calculating the position within the measure and setting the duration
304 in the MIDI output.  Multiplying factors may be combined such as
305 @code{*L*M/N}.
306
307 In the following example, the first three notes take up exactly
308 two beats, but no triplet bracket is printed.
309
310 @lilypond[quote,relative=2,verbatim]
311 \time 2/4
312 % Alter durations to triplets
313 a4*2/3 gis4*2/3 a4*2/3
314 % Normal durations
315 a4 a4
316 % Double the duration of chord
317 <a d>4*2
318 % Duration of quarter, appears like sixteenth
319 b16*4 c4
320 @end lilypond
321
322 The duration of skip or spacing notes may also be modified by
323 a multiplier.  This is useful for skipping many measures, e.g.,
324 @code{s1*23}.
325
326 @cindex compressing music
327 @cindex expanding music
328
329 @funindex \scaleDurations
330 @funindex scaleDurations
331
332 Longer stretches of music may be compressed by a fraction in the
333 same way, as if every note, chord or rest had the fraction as a
334 multiplier.  This leaves the appearance of the music unchanged but
335 the internal duration of the notes will be multiplied by the
336 fraction @emph{num}/@emph{den}.  The spaces around the dot are
337 required.  Here is an example showing how music can be compressed
338 and expanded:
339
340 @lilypond[quote,relative=2,verbatim]
341 \time 2/4
342 % Normal durations
343 <c a>4 c8 a
344 % Scale music by *2/3
345 \scaleDurations #'(2 . 3) {
346   <c a f>4. c8 a f
347 }
348 % Scale music by *2
349 \scaleDurations #'(2 . 1) {
350   <c' a>4 c8 b
351 }
352 @end lilypond
353
354 One application of this command is in polymetric
355 notation, see @ref{Polymetric notation}.
356
357
358 @seealso
359 Notation Reference:
360 @ref{Tuplets},
361 @ref{Invisible rests},
362 @ref{Polymetric notation}.
363
364 Snippets:
365 @rlsr{Rhythms}.
366
367
368 @node Ties
369 @unnumberedsubsubsec Ties
370
371 @cindex tie
372
373 @funindex ~
374
375 A tie connects two adjacent note heads of the same pitch.  The tie
376 in effect extends the duration of a note.
377
378 @warning{Ties should not be confused with @emph{slurs}, which
379 indicate articulation, or @emph{phrasing slurs}, which indicate
380 musical phrasing.  A tie is just a way of extending a note
381 duration, similar to the augmentation dot.}
382
383 A tie is entered using the tilde symbol (@code{~}).
384
385 @lilypond[quote,verbatim,relative=2]
386 a2 ~ a
387 @end lilypond
388
389 Ties are used either when the note crosses a bar line, or when
390 dots cannot be used to denote the rhythm.  Ties should also be
391 used when note values cross larger subdivisions of the measure:
392
393 @lilypond[verbatim,quote]
394 \relative c' {
395   r8 c8 ~ c2 r4 |
396   r8^"not" c2 ~ c8 r4
397 }
398 @end lilypond
399
400 If you need to tie many notes across bar lines, it may be
401 easier to use automatic note splitting, see @ref{Automatic note
402 splitting}.  This mechanism automatically splits long notes, and
403 ties them across bar lines.
404
405 @cindex ties and chords
406 @cindex chords and ties
407
408 When a tie is applied to a chord, all note heads whose pitches
409 match are connected.  When no note heads match, no ties will be
410 created.  Chords may be partially tied by placing the tie inside
411 the chord.
412
413 @lilypond[quote,verbatim,relative=1]
414 <c e g> ~ <c e g>
415 <c~ e g~ b> <c e g b>
416 @end lilypond
417
418 @cindex repeating ties
419 @cindex ties, repeating
420 @cindex volta brackets and ties
421 @cindex ties and volta brackets
422
423 @funindex \repeatTie
424 @funindex repeatTie
425
426 When a second alternative of a repeat starts with a tied note, you
427 have to specify the repeated tie as follows:
428
429 @lilypond[quote,relative=2,verbatim]
430 \repeat volta 2 { c g <c e>2 ~ }
431 \alternative {
432   % First alternative: following note is tied normally
433   { <c e>2. r4 }
434   % Second alternative: following note has a repeated tie
435   { <c e>2\repeatTie d4 c } }
436 @end lilypond
437
438 @cindex laissez vibrer
439 @cindex ties, laissez vibrer
440
441 @funindex \laissezVibrer
442 @funindex laissezVibrer
443
444 @notation{L.v.}@: ties (@notation{laissez vibrer}) indicate that
445 notes must not be damped at the end.  It is used in notation for
446 piano, harp and other string and percussion instruments.  They can
447 be entered as follows:
448
449 @lilypond[quote,verbatim,relative=1]
450 <c f g>1\laissezVibrer
451 @end lilypond
452
453 @cindex ties, placement
454
455 @funindex \tieUp
456 @funindex tieUp
457 @funindex \tieDown
458 @funindex tieDown
459 @funindex \tieNeutral
460 @funindex tieNeutral
461
462 Ties may be manually placed above or below the staff; see
463 @ref{Direction and placement}.
464
465 @cindex ties, appearance
466 @cindex ties, dotted
467 @cindex ties, dashed
468 @cindex dashed ties
469 @cindex dotted ties
470
471 @funindex \tieDotted
472 @funindex tieDotted
473 @funindex \tieDashed
474 @funindex tieDashed
475 @funindex \tieSolid
476 @funindex tieSolid
477
478 Ties may be made dashed, dotted, or a combination of solid and
479 dashed.
480
481 @lilypond[quote, verbatim, relative=1]
482 \tieDotted
483 c2 ~ c
484 \tieDashed
485 c2 ~ c
486 \tieHalfDashed
487 c2 ~ c
488 \tieHalfSolid
489 c2 ~ c
490 \tieSolid
491 c2 ~ c
492 @end lilypond
493
494 Custom dash patterns can be specified:
495
496 @lilypond[quote, verbatim, relative=1]
497 \tieDashPattern #0.3 #0.75
498 c2 ~ c
499 \tieDashPattern #0.7 #1.5
500 c2 ~ c
501 \tieSolid
502 c2 ~ c
503 @end lilypond
504
505 Dash pattern definitions for ties have the same structure as
506 dash pattern definitions for slurs.
507 For more information about complex dash patterns,
508 see the snippets under @ref{Slurs}.
509
510 @predefined
511 @code{\tieUp},
512 @code{\tieDown},
513 @code{\tieNeutral},
514 @code{\tieDotted},
515 @code{\tieDashed},
516 @code{\tieDashPattern},
517 @code{\tieHalfDashed},
518 @code{\tieHalfSolid},
519 @code{\tieSolid}.
520 @endpredefined
521
522
523 @snippets
524
525 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
526 {using-ties-with-arpeggios.ly}
527
528 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
529 {engraving-ties-manually.ly}
530
531
532 @seealso
533 Music Glossary:
534 @rglos{tie},
535 @rglos{laissez vibrer}.
536
537 Notation Reference:
538 @ref{Slurs},
539 @ref{Automatic note splitting}.
540
541 Snippets:
542 @rlsr{Rhythms}.
543
544 Internals Reference:
545 @rinternals{LaissezVibrerTie},
546 @rinternals{LaissezVibrerTieColumn},
547 @rinternals{TieColumn},
548 @rinternals{Tie}.
549
550
551 @knownissues
552
553 Switching staves when a tie is active will not produce a slanted
554 tie.
555
556 Changing clefs or octavations during a tie is not really
557 well-defined.  In these cases, a slur may be preferable.
558
559
560
561 @node Writing rests
562 @subsection Writing rests
563
564 Rests are entered as part of the music in music expressions.
565
566 @menu
567 * Rests::
568 * Invisible rests::
569 * Full measure rests::
570 @end menu
571
572 @node Rests
573 @unnumberedsubsubsec Rests
574
575 @cindex rest
576 @cindex rest, entering durations
577 @cindex maxima rest
578 @cindex longa rest
579 @cindex breve rest
580
581 @funindex \rest
582 @funindex rest
583 @funindex r
584 @funindex \maxima
585 @funindex maxima
586 @funindex \longa
587 @funindex longa
588 @funindex \breve
589 @funindex breve
590
591 Rests are entered like notes with the note name @code{r}.
592 Durations longer than a whole rest use the predefined
593 commands shown:
594
595 @c \time 16/1 is used to avoid spurious bar lines
596 @c and long tracts of empty measures
597 @lilypond[fragment,quote,verbatim]
598 \new Staff {
599   % These two lines are just to prettify this example
600   \time 16/1
601   \override Staff.TimeSignature #'stencil = ##f
602   % Print a maxima rest, equal to four breves
603   r\maxima
604   % Print a longa rest, equal to two breves
605   r\longa
606   % Print a breve rest
607   r\breve
608   r1 r2 r4 r8 r16 r32 r64 r128
609 }
610 @end lilypond
611
612 @cindex rest, multi-measure
613 @cindex rest, whole-measure
614
615 Whole measure rests, centered in the middle of the measure, must be
616 entered as multi-measure rests.  They can be used for a single
617 measure as well as many measures and are discussed in @ref{Full
618 measure rests}.
619
620 @cindex rest, specifying vertical position
621
622 To explicitly specify a rest's vertical position, write a note
623 followed by @code{\rest}.  A rest of the duration of the note will
624 be placed at the staff position where the note would appear.  This
625 allows for precise manual formatting of polyphonic music, since the
626 automatic rest collision formatter will not move these rests.
627
628 @lilypond[quote,verbatim,relative=2]
629 a4\rest d4\rest
630 @end lilypond
631
632 @snippets
633
634 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
635 {rest-styles.ly}
636
637
638 @seealso
639 Music Glossary:
640 @rglos{breve},
641 @rglos{longa},
642 @rglos{maxima}.
643
644 Notation Reference:
645 @ref{Full measure rests}.
646
647 Snippets:
648 @rlsr{Rhythms}.
649
650 Internals Reference:
651 @rinternals{Rest}.
652
653
654 @knownissues
655
656 @c Deliberately duplicated in Durations and Rests.  -gp
657 There is no fundamental limit to rest durations (both in terms of
658 longest and shortest), but the number of glyphs is limited: there
659 are rests from 128th to maxima (8 x whole).
660
661
662 @node Invisible rests
663 @unnumberedsubsubsec Invisible rests
664
665 @cindex skip
666 @cindex invisible rest
667 @cindex rest, invisible
668 @cindex spacer note
669 @cindex spacer rest
670
671 @funindex s
672 @funindex \skip
673 @funindex skip
674
675 An invisible rest (also called a @q{spacer rest}) can be entered
676 like a note with the note name@tie{}@code{s}:
677
678 @lilypond[verbatim,quote,relative=2]
679 c4 c s c
680 s2 c
681 @end lilypond
682
683 @cindex lyrics, skip
684
685 Spacer rests are available only in note mode and chord mode.  In
686 other situations, for example, when entering lyrics, @code{\skip}
687 is used to skip a musical moment.  @code{\skip} requires an
688 explicit duration.
689
690 @lilypond[quote,verbatim,relative=2]
691 <<
692   {
693     a2 \skip2 a2 a2
694   }
695   \new Lyrics {
696     \lyricmode {
697       foo2 \skip 1 bla2
698     }
699   }
700 >>
701 @end lilypond
702
703 A spacer rest implicitly causes @code{Staff} and @code{Voice}
704 contexts to be created if none exist, just like notes and rests
705 do:
706
707 @lilypond[quote,verbatim,fragment]
708 s1 s s
709 @end lilypond
710
711 @code{\skip} simply skips musical time; it creates no output of
712 any kind.
713
714 @lilypond[quote,verbatim,fragment]
715 % This is valid input, but does nothing
716 \skip 1 \skip1 \skip 1
717 @end lilypond
718
719
720 @seealso
721 Learning Manual:
722 @rlearning{Visibility and color of objects}.
723
724 Notation Reference:
725 @ref{Hidden notes},
726 @ref{Visibility of objects}.
727
728 Snippets:
729 @rlsr{Rhythms}.
730
731 Internals Reference: 
732 @rinternals{SkipMusic}.
733
734
735 @node Full measure rests
736 @unnumberedsubsubsec Full measure rests
737
738 @cindex multi-measure rests
739 @cindex full-measure rests
740 @cindex rest, multi-measure
741 @cindex rest, full-measure
742 @cindex whole rest for a full measure
743 @cindex rest, whole for a full measure
744
745 @funindex R
746
747 Rests for one or more full measures are entered like notes with
748 the note name uppercase @code{R}:
749
750 @lilypond[quote,verbatim,relative=2]
751 % Rest measures contracted to single measure
752 \compressFullBarRests
753 R1*4
754 R1*24
755 R1*4
756 b2^"Tutti" b4 a4
757 @end lilypond
758
759 The duration of full-measure rests is identical to the duration
760 notation used for notes.  The duration in a multi-measure rest must
761 always be an integral number of measure-lengths, so augmentation dots
762 or fractions must often be used:
763
764 @lilypond[quote,fragment,verbatim]
765 \compressFullBarRests
766 \time 2/4
767 R1 | R2 |
768 \time 3/4
769 R2. | R2.*2 |
770 \time 13/8
771 R1*13/8 | R1*13/8*12 |
772 \time 10/8
773 R4*5*4 |
774 @end lilypond
775
776 A full-measure rest is printed as either a whole or breve rest,
777 centered in the measure, depending on the time signature.
778
779 @lilypond[quote,verbatim,fragment]
780 \time 4/4
781 R1 |
782 \time 6/4
783 R1*3/2 |
784 \time 8/4
785 R1*2 |
786 @end lilypond
787
788 @cindex multi-measure rest, expanding
789 @cindex multi-measure rest, contracting
790
791 @funindex \expandFullBarRests
792 @funindex expandFullBarRests
793 @funindex \compressFullBarRests
794 @funindex compressFullBarRests
795
796 By default a multi-measure rest is expanded in the printed score to
797 show all the rest measures explicitly.  Alternatively, a multi-measure
798 rest can be shown as a single measure containing a multi-measure rest
799 symbol, with the number of measures of rest printed above the measure:
800
801 @lilypond[quote,fragment,verbatim]
802 % Default behavior
803 \time 3/4 r2. | R2.*2 |
804 \time 2/4 R2 |
805 \time 4/4
806 % Rest measures contracted to single measure
807 \compressFullBarRests
808 r1 | R1*17 | R1*4 |
809 % Rest measures expanded
810 \expandFullBarRests
811 \time 3/4
812 R2.*2 |
813 @end lilypond
814
815
816 @cindex text on multi-measure rest
817 @cindex multi-measure rest, attaching text
818 @cindex script on multi-measure rest
819 @cindex multi-measure rest, script
820 @cindex fermata on multi-measure rest
821 @cindex multi-measure rest, attaching fermata
822 @cindex markup on multi-measure rest
823 @cindex multi-measure rest with markup
824
825 @funindex \fermataMarkup
826 @funindex fermataMarkup
827 @funindex MultiMeasureRestText
828
829 Markups can be added to multi-measure rests.
830 The predefined command @code{\fermataMarkup}
831 is provided for adding fermatas.
832
833 @lilypond[quote,verbatim,fragment]
834 \compressFullBarRests
835 \time 3/4
836 R2.*10^\markup { \italic "ad lib." }
837 R2.^\fermataMarkup
838 @end lilypond
839
840 @warning{
841 Markups attached to a multi-measure rest are
842 objects of type @code{MultiMeasureRestText}, not
843 @code{TextScript}.  Overrides must be directed to the correct
844 object, or they will be ignored.  See the following example.
845 }
846
847 @lilypond[quote,verbatim,fragment]
848 % This fails, as the wrong object name is specified
849 \override TextScript #'padding = #5
850 R1^"wrong"
851 % This is correct and works
852 \override MultiMeasureRestText #'padding = #5
853 R1^"right"
854 @end lilypond
855
856 When a multi-measure rest immediately follows a @code{\partial}
857 setting, resulting bar-check warnings may not be displayed.
858
859
860 @funindex \textLengthOn
861 @funindex textLengthOn
862 @funindex \textLengthOff
863 @funindex textLenthOff
864 @funindex \fermataMarkup
865 @funindex fermataMarkup
866 @funindex \compressFullBarRests
867 @funindex compressFullBarRests
868 @funindex \expandFullBarRests
869 @funindex expandFullBarRests
870
871 @predefined
872 @code{\textLengthOn},
873 @code{\textLengthOff},
874 @code{\fermataMarkup},
875 @code{\compressFullBarRests},
876 @code{\expandFullBarRests}.
877 @endpredefined
878
879
880 @snippets
881
882 @cindex church rest
883 @cindex rest, church
884 @cindex kirchenpausen
885
886 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
887 {changing-form-of-multi-measure-rests.ly}
888
889 @cindex multi-measure rests, positioning
890 @cindex positioning multi-measure rests
891
892 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
893 {positioning-multi-measure-rests.ly}
894
895 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
896 {multi-measure-rest-markup.ly}
897
898
899 @seealso
900 Music Glossary:
901 @rglos{multi-measure rest}.
902
903 Notation Reference:
904 @ref{Durations},
905 @ref{Text},
906 @ref{Formatting text},
907 @ref{Text scripts}.
908
909 Snippets:
910 @rlsr{Rhythms}.
911
912 Internals Reference:
913 @rinternals{MultiMeasureRest},
914 @rinternals{MultiMeasureRestNumber},
915 @rinternals{MultiMeasureRestText}.
916
917
918 @cindex fingerings and multi-measure rests
919 @cindex multi-measure rests and fingerings
920
921 @knownissues
922
923 If an attempt is made to use fingerings (e.g.,
924 @code{R1*10-4}) to put numbers over multi-measure rests, the
925 fingering numeral (4) may collide with the bar counter
926 numeral (10).
927
928 @cindex condensing rests
929 @cindex rest, condensing ordinary
930
931 There is no way to automatically condense multiple ordinary rests
932 into a single multi-measure rest.
933
934 @cindex rest, collisions of
935
936 Multi-measure rests do not take part in rest collisions.
937
938 @node Displaying rhythms
939 @subsection Displaying rhythms
940
941 @menu
942 * Time signature::
943 * Upbeats::
944 * Unmetered music::
945 * Polymetric notation::
946 * Automatic note splitting::
947 * Showing melody rhythms::
948 @end menu
949
950 @node Time signature
951 @unnumberedsubsubsec Time signature
952
953 @cindex time signature
954 @cindex meter
955
956 @funindex \time
957 @funindex time
958
959 The time signature is set as follows:
960
961 @lilypond[quote,verbatim,relative=2]
962 \time 2/4 c2
963 \time 3/4 c2.
964 @end lilypond
965
966 @cindex time signature, visibility of
967
968 Time signatures are printed at the beginning of a piece
969 and whenever the time signature changes.  If a change takes place
970 at the end of a line a warning time signature sign is printed
971 there.  This default behavior may be changed, see
972 @ref{Visibility of objects}.
973
974 @lilypond[quote,verbatim,relative=2]
975 \time 2/4
976 c2 c
977 \break
978 c c
979 \break
980 \time 4/4
981 c c c c
982 @end lilypond
983
984 @cindex time signature style
985 @cindex meter style
986
987 @funindex \numericTimeSignature
988 @funindex numericTimeSignature
989 @funindex \defaultTimeSignature
990 @funindex defaultTimeSignature
991
992 The time signature symbol that is used in 2/2 and 4/4 time can be
993 changed to a numeric style:
994
995 @lilypond[quote,verbatim,relative=2]
996 % Default style
997 \time 4/4 c1
998 \time 2/2 c1
999 % Change to numeric style
1000 \numericTimeSignature
1001 \time 4/4 c1
1002 \time 2/2 c1
1003 % Revert to default style
1004 \defaultTimeSignature
1005 \time 4/4 c1
1006 \time 2/2 c1
1007 @end lilypond
1008
1009
1010 Mensural time signatures are covered in
1011 @ref{Mensural time signatures}.
1012
1013
1014 @predefined
1015 @code{\numericTimeSignature},
1016 @code{\defaultTimeSignature}.
1017 @endpredefined
1018
1019
1020 @snippets
1021
1022 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1023 {changing-the-time-signature-without-affecting-the-beaming.ly}
1024
1025 @cindex compound time signatures
1026 @cindex time signature, compound
1027
1028 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1029 {compound-time-signatures.ly}
1030
1031
1032 @seealso
1033 Music Glossary:
1034 @rglos{time signature}
1035
1036 Notation Reference:
1037 @ref{Mensural time signatures},
1038 @ref{Time administration}.
1039
1040 Snippets:
1041 @rlsr{Rhythms}.
1042
1043 Internals Reference:
1044 @rinternals{TimeSignature},
1045 @rinternals{Timing_translator}.
1046
1047
1048 @node Upbeats
1049 @unnumberedsubsubsec Upbeats
1050
1051 @cindex anacrusis
1052 @cindex upbeat
1053 @cindex partial measure
1054 @cindex measure, partial
1055 @cindex pickup measure
1056 @cindex measure, change length
1057
1058 @funindex measurePosition
1059 @funindex \partial
1060 @funindex partial
1061
1062 Partial or pick-up measures, such as an anacrusis or upbeat, are
1063 entered using the @code{\partial} command, with the syntax
1064
1065 @example
1066 \partial @var{duration}
1067 @end example
1068
1069 @noindent
1070 where @code{duration} is the rhythmic length of the interval
1071 before the start of the first complete measure:
1072
1073 @lilypond[quote,verbatim,relative=2]
1074 \partial 4 e4 |
1075 a2. c,4 |
1076 @end lilypond
1077
1078 The partial measure can be any duration less than a full measure:
1079
1080 @lilypond[quote,verbatim,relative=2]
1081 \partial 8*3 c8 d e |
1082 a2. c,4 |
1083 @end lilypond
1084
1085 Internally, @code{\partial} is translated into
1086
1087 @example
1088 \set Timing.measurePosition = -@var{duration}
1089 @end example
1090
1091 @noindent
1092 The property @code{measurePosition} contains a rational number
1093 indicating how much of the measure has passed at this point.  Note
1094 that this is set to a negative number by the @code{\partial}
1095 command: i.e., @code{\partial 4} is internally translated to
1096 @code{-4}, meaning @qq{there is a quarter note left in the measure.}
1097
1098
1099 @seealso
1100 Music Glossary:
1101 @rglos{anacrusis}.
1102
1103 Notation Reference:
1104 @ref{Grace notes}.
1105
1106 Snippets:
1107 @rlsr{Rhythms}.
1108
1109 Internal Reference:
1110 @rinternals{Timing_translator}.
1111
1112
1113 @knownissues
1114
1115 The @code{\partial} command is intended to be used only at the
1116 beginning of a piece.  If you use it after the beginning, some
1117 odd warnings may occur.
1118
1119 @node Unmetered music
1120 @unnumberedsubsubsec Unmetered music
1121
1122 @cindex bar lines, turning off
1123 @cindex bar numbering, turning off
1124 @cindex cadenza
1125 @cindex unmetered music
1126
1127 @funindex \cadenzaOn
1128 @funindex cadenzaOn
1129 @funindex \cadenzaOff
1130 @funindex cadenzaOff
1131
1132 Bar lines and bar numbers are calculated automatically.  For
1133 unmetered music (some cadenzas, for example), this is not desirable.
1134 To turn off automatic calculation of bar lines and bar numbers,
1135 use the command @code{\cadenzaOn}, and use @code{\cadenzaOff}
1136 to turn them on again.
1137
1138 @lilypond[verbatim,relative=2,fragment]
1139 c4 d e d
1140 \cadenzaOn
1141 c4 c d8 d d f4 g4.
1142 \cadenzaOff
1143 \bar "|"
1144 d4 e d c
1145 @end lilypond
1146
1147 Bar numbering is resumed at the end of the cadenza as if the
1148 cadenza were not there:
1149
1150 @lilypond[verbatim,relative=2,fragment]
1151 % Show all bar numbers
1152 \override Score.BarNumber #'break-visibility = #all-visible
1153 c4 d e d
1154 \cadenzaOn
1155 c4 c d8 d d f4 g4.
1156 \cadenzaOff
1157 \bar "|"
1158 d4 e d c
1159 @end lilypond
1160
1161
1162 @predefined
1163 @code{\cadenzaOn},
1164 @code{\cadenzaOff}.
1165 @endpredefined
1166
1167
1168 @seealso
1169 Music Glossary:
1170 @rglos{cadenza}.
1171
1172 Notation Reference:
1173 @ref{Visibility of objects}.
1174
1175 Snippets:
1176 @rlsr{Rhythms}.
1177
1178
1179 @cindex cadenza line breaks
1180 @cindex cadenza page breaks
1181 @cindex unmetered music, line breaks
1182 @cindex unmetered music, page breaks
1183 @cindex breaks in unmetered music
1184 @cindex line breaks in cadenzas
1185 @cindex page breaks in cadenzas
1186 @cindex line breaks in unmetered music
1187 @cindex page breaks in unmetered music
1188
1189 @knownissues
1190
1191 LilyPond will insert line breaks and page breaks only at a
1192 bar line.  Unless the unmetered music ends before the end of the
1193 staff line, you will need to insert invisible bar lines with
1194
1195 @example
1196 \bar ""
1197 @end example
1198
1199 @noindent
1200 to indicate where breaks can occur.
1201
1202
1203 @node Polymetric notation
1204 @unnumberedsubsubsec Polymetric notation
1205
1206 @c This section necessarily uses \set
1207 @c This is acceptable  -td
1208
1209 @cindex double time signatures
1210 @cindex signatures, polymetric
1211 @cindex time signatures, polymetric
1212 @cindex time signatures, double
1213 @cindex polymetric signatures
1214 @cindex meter, polymetric
1215
1216 @funindex timeSignatureFraction
1217 @funindex \scaleDurations
1218 @funindex scaleDurations
1219 @funindex \times
1220 @funindex times
1221
1222 Polymetric notation is supported, either explicitly or by modifying
1223 the visible time signature symbol and scaling the note durations.
1224
1225 @strong{@i{Staves with different time signatures, equal measure lengths}}
1226
1227 This notation can be created by setting a common time signature
1228 for each staff but replacing the symbol manually by setting
1229 @code{timeSignatureFraction} to the desired fraction and scaling
1230 the printed durations in each staff to the common time
1231 signature; see @ref{Time signature}.  The scaling is done with
1232 @code{\scaleDurations}, which is used in a similar way to
1233 @code{\times}, but does not create a tuplet bracket; see
1234 @ref{Scaling durations}.
1235
1236 @cindex beaming in polymetric music
1237 @cindex beaming in polymetric meter
1238
1239 In this example, music with the time signatures of 3/4, 9/8, and
1240 10/8 are used in parallel.  In the second staff, shown durations
1241 are multiplied by 2/3, as 2/3 * 9/8 = 3/4, and in the third
1242 staff, shown durations are multiplied by 3/5, as 3/5 * 10/8 = 3/4.
1243 It will often be necessary to insert beams manually, as the
1244 duration scaling affects the autobeaming rules.
1245
1246 @lilypond[quote,verbatim,fragment]
1247 \relative c' <<
1248   \new Staff {
1249     \time 3/4
1250     c4 c c |
1251     c c c |
1252   }
1253   \new Staff {
1254     \time 3/4
1255     \set Staff.timeSignatureFraction = #'(9 . 8)
1256     \scaleDurations #'(2 . 3)
1257     \repeat unfold 6 { c8[ c c] }
1258   }
1259   \new Staff {
1260     \time 3/4
1261     \set Staff.timeSignatureFraction = #'(10 . 8)
1262     \scaleDurations #'(3 . 5) {
1263       \repeat unfold 2 { c8[ c c] }
1264       \repeat unfold 2 { c8[ c] } |
1265       c4. c4. \times 2/3 { c8[ c c] } c4
1266     }
1267   }
1268 >>
1269 @end lilypond
1270
1271 @strong{@i{Staves with different time signatures, unequal bar lengths}}
1272
1273 Each staff can be given its own independent time signature by
1274 moving the @code{Timing_translator} and the
1275 @code{Default_bar_line_engraver} to the @code{Staff} context.
1276
1277 @lilypond[quote,verbatim]
1278 \layout {
1279   \context {
1280     \Score
1281     \remove "Timing_translator"
1282     \remove "Default_bar_line_engraver"
1283   }
1284   \context {
1285     \Staff
1286     \consists "Timing_translator"
1287     \consists "Default_bar_line_engraver"
1288   }
1289 }
1290
1291 % Now each staff has its own time signature.
1292
1293 \relative c' <<
1294   \new Staff {
1295     \time 3/4
1296     c4 c c |
1297     c c c |
1298   }
1299   \new Staff {
1300     \time 2/4
1301     c4 c |
1302     c c |
1303     c c |
1304   }
1305   \new Staff {
1306     \time 3/8
1307     c4. |
1308     c8 c c |
1309     c4. |
1310     c8 c c |
1311   }
1312 >>
1313 @end lilypond
1314
1315 @snippets
1316
1317 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1318 {compound-time-signatures.ly}
1319
1320
1321 @seealso
1322 Music Glossary:
1323 @rglos{polymetric},
1324 @rglos{polymetric time signature},
1325 @rglos{meter}.
1326
1327 Notation Reference:
1328 @ref{Time signature},
1329 @ref{Scaling durations}.
1330
1331 Snippets:
1332 @rlsr{Rhythms}.
1333
1334 Internals Reference:
1335 @rinternals{TimeSignature},
1336 @rinternals{Timing_translator},
1337 @rinternals{Default_bar_line_engraver},
1338 @rinternals{Staff}.
1339
1340
1341 @knownissues
1342
1343 When using different time signatures in parallel, notes
1344 at the same moment will be be placed at the same horizontal
1345 location.  However, the bar lines in the different staves
1346 will cause the note spacing to be less regular in each of the
1347 individual staves than would be normal without the different
1348 time signatures.
1349
1350 @node Automatic note splitting
1351 @unnumberedsubsubsec Automatic note splitting
1352
1353 @cindex notes, splitting
1354 @cindex splitting notes
1355
1356 @funindex Note_heads_engraver
1357 @funindex Completion_heads_engraver
1358
1359 Long notes which overrun bar lines can be converted automatically
1360 to tied notes.  This is done by replacing the
1361 @code{Note_heads_engraver} with the
1362 @code{Completion_heads_engraver}.  In the following
1363 example, notes crossing the bar lines are split and tied.
1364
1365 @lilypond[quote,verbatim,relative=1]
1366 \new Voice \with {
1367   \remove "Note_heads_engraver"
1368   \consists "Completion_heads_engraver"
1369 }
1370
1371 { c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 }
1372 @end lilypond
1373
1374 This engraver splits all running notes at the bar line, and
1375 inserts ties.  One of its uses is to debug complex scores: if the
1376 measures are not entirely filled, then the ties show exactly how
1377 much each measure is off.
1378
1379
1380 @seealso
1381 Music Glossary: @rglos{tie}
1382
1383 Learning Manual:
1384 @rlearning{Engravers explained},
1385 @rlearning{Adding and removing engravers}.
1386
1387 Snippets:
1388 @rlsr{Rhythms}.
1389
1390 Internals Reference:
1391 @rinternals{Note_heads_engraver},
1392 @rinternals{Completion_heads_engraver},
1393 @rinternals{Forbid_line_break_engraver}.
1394
1395
1396 @knownissues
1397
1398 Not all durations (especially those containing tuplets) can be
1399 represented exactly with normal notes and dots, but the
1400 @code{Completion_heads_engraver} will not insert tuplets.
1401
1402 The @code{Completion_heads_engraver} only affects notes; it does not
1403 split rests.
1404
1405
1406 @node Showing melody rhythms
1407 @unnumberedsubsubsec Showing melody rhythms
1408
1409 @cindex melody rhythms, showing
1410 @cindex rhythms, showing melody
1411
1412 Sometimes you might want to show only the rhythm of a melody.  This
1413 can be done with the rhythmic staff.  All pitches of notes on such a
1414 staff are squashed, and the staff itself has a single line
1415
1416 @lilypond[quote,relative=1,verbatim]
1417 <<
1418   \new RhythmicStaff {
1419     \new Voice = "myRhythm" {
1420       \time 4/4
1421       c4 e8 f g2
1422       r4 g g f
1423       g1
1424     }
1425   }
1426   \new Lyrics {
1427     \lyricsto "myRhythm" {
1428       This is my song
1429       I like to sing
1430     }
1431   }
1432 >>
1433 @end lilypond
1434
1435 @cindex guitar chord charts
1436 @cindex strumming rhythms, showing
1437 @cindex guitar strumming rhythms, showing
1438
1439 @funindex Pitch_squash_engraver
1440 @funindex \improvisationOn
1441 @funindex improvisationOn
1442 @funindex \improvisationOff
1443 @funindex improvisationOff
1444
1445 Guitar chord charts often show the strumming rhythms.  This can
1446 be done with the @code{Pitch_squash_engraver} and
1447 @code{\improvisationOn}.
1448
1449
1450 @lilypond[quote,verbatim]
1451 <<
1452   \new ChordNames {
1453     \chordmode {
1454       c1 f g c
1455     }
1456   }
1457
1458   \new Voice \with {
1459     \consists Pitch_squash_engraver
1460   } \relative c'' {
1461     \improvisationOn
1462     c4 c8 c c4 c8 c
1463     f4 f8 f f4 f8 f
1464     g4 g8 g g4 g8 g
1465     c4 c8 c c4 c8 c
1466   }
1467 >>
1468 @end lilypond
1469
1470
1471 @predefined
1472 @code{\improvisationOn},
1473 @code{\improvisationOff}.
1474 @endpredefined
1475
1476
1477 @snippets
1478
1479 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1480 {guitar-strum-rhythms.ly}
1481
1482
1483 @seealso
1484 Snippets:
1485 @rlsr{Rhythms}.
1486
1487 Internals Reference:
1488 @rinternals{RhythmicStaff},
1489 @rinternals{Pitch_squash_engraver}.
1490
1491
1492 @node Beams
1493 @subsection Beams
1494
1495 @menu
1496 * Automatic beams::
1497 * Setting automatic beam behavior::
1498 * Manual beams::
1499 * Feathered beams::
1500 @end menu
1501
1502 @node Automatic beams
1503 @unnumberedsubsubsec Automatic beams
1504
1505 By default, beams are inserted automatically:
1506
1507 @cindex beams, manual
1508 @cindex manual beams
1509 @cindex beams, setting rules for
1510 @cindex beams, custom rules for
1511
1512 @funindex \autoBeamOn
1513 @funindex autoBeamOn
1514 @funindex \autoBeamOff
1515 @funindex autoBeamOff
1516
1517 @lilypond[quote,verbatim,relative=2]
1518 \time 2/4 c8 c c c
1519 \time 6/8 c c c c8. c16 c8
1520 @end lilypond
1521
1522 If these automatic decisions are not satisfactory, beaming can be
1523 entered explicitly; see @ref{Manual beams}.  Beams @emph{must} be
1524 entered manually if beams are to be extended over rests.
1525
1526 If automatic beaming is not required, it may be turned off with
1527 @code{\autoBeamOff} and on with @code{\autoBeamOn}:
1528
1529 @lilypond[quote,relative=1,verbatim]
1530 c4 c8 c8. c16 c8. c16 c8
1531 \autoBeamOff
1532 c4 c8 c8. c16 c8.
1533 \autoBeamOn
1534 c16 c8
1535 @end lilypond
1536
1537 @cindex melismata, beams
1538 @cindex beams and melismata
1539
1540 @warning{If beams are used to indicate melismata in songs, then
1541 automatic beaming should be switched off with @code{\autoBeamOff}
1542 and the beams indicated manually.}
1543
1544 Beaming patterns that differ from the automatic defaults can be
1545 created; see @ref{Setting automatic beam behavior}.
1546
1547
1548 @predefined
1549 @code{\autoBeamOff},
1550 @code{\autoBeamOn}.
1551 @endpredefined
1552
1553
1554 @snippets
1555
1556 @cindex line breaks and beams
1557 @cindex beams and line breaks
1558
1559 @funindex breakable
1560
1561 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1562 {beams-across-line-breaks.ly}
1563
1564 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1565 {changing-beam-knee-gap.ly}
1566
1567
1568 @seealso
1569 Notation Reference:
1570 @ref{Manual beams},
1571 @ref{Setting automatic beam behavior}.
1572
1573 Installed Files:
1574 @file{scm/@/auto@/-beam@/.scm}.
1575
1576 Snippets:
1577 @rlsr{Rhythms}.
1578
1579 Internals Reference: @rinternals{Beam}.
1580
1581
1582 @knownissues
1583
1584 Beams can collide with note heads and accidentals in other voices.
1585
1586
1587 @node Setting automatic beam behavior
1588 @unnumberedsubsubsec Setting automatic beam behavior
1589
1590
1591 @cindex automatic beams, tuning
1592 @cindex tuning automatic beaming
1593 @cindex automatic beam generation
1594 @cindex autobeam
1595 @cindex lyrics and beaming
1596
1597 @funindex autoBeaming
1598 @funindex beamSettings
1599 @funindex measureLength
1600 @funindex beatLength
1601 @funindex \time
1602 @funindex time
1603 @funindex \set
1604 @funindex set
1605
1606 The placement of automatic beams is determined by the time signature.
1607 Three types of rules are used for determining the end of automatic
1608 beams: @emph{default} rules
1609 for the time signature, @emph{explicit} rules for the beam in the time
1610 signature, and the @emph{beatLength} for the time signature.
1611
1612 The following rules, in order of priority, apply when determining
1613 the appearance of beams:
1614
1615 @itemize
1616
1617 @item If a manual beam is specified with @code{[..]} set the beam
1618 as specified, otherwise
1619
1620 @item if @code{\autoBeamOff} is in force do not beam, otherwise
1621
1622 @item if an explicit beam-ending rule is defined for the beam type
1623 in the time signature, use it to determine the valid
1624 places where beams may end, otherwise
1625
1626 @item if a default beam-ending rule is defined in the time signature,
1627 use it to group notes with beams, otherwise
1628
1629 @item use the value of @code{beatLength} to group notes with beams
1630
1631 @end itemize
1632
1633 @i{@strong{Modifying the grouping of beats}}
1634
1635 By default @code{beatLength} is
1636 derived from the time signature set by the @code{\time} command.
1637 The @code{beatLength} is set to be one over the denominator
1638 of the time signature.
1639
1640 @code{beatLength} is a @i{moment},
1641 a unit of musical duration.  A quantity of type @i{moment} is
1642 created by the scheme function @code{ly:make-moment}.  For more
1643 information about this function, see @ref{Time administration}.
1644
1645 Autobeam and beam subdivide settings are stored in the
1646 @code{beamSettings} property.  Default values of @code{beamSettings}
1647 are determined in @file{scm/beam-settings.scm}.  Entries in
1648 @code{beamSettings} are indexed by time signature and
1649 rule type.
1650
1651 Time signature should be a scheme pair , e.g. @code{#'(4 . 4)}.
1652
1653 Rule type should be @code{#'end} for beam ending and @code{#'subdivide} for
1654 beam subdivision.
1655
1656 The ending and subdivision rules consist of a scheme alist
1657 (or list of pairs) that
1658 indicates the beam type and the grouping to be applied to that
1659 beam type.
1660
1661 @example
1662 #'((beam-type1 . grouping-1)
1663    (beam-type2 . grouping-2)
1664    (beam-type3 . grouping-3))
1665 @end example
1666
1667 Beam type is either a scheme pair indicating the duration
1668 of the beam, e.g. @code{(1 . 16)}, or @code{*} to indicate a
1669 default rule, which applies to all beams if no explicit rule is
1670 defined.
1671
1672 Grouping is a scheme list indicating the grouping to be applied to
1673 the beam.  For default rules (where beam type is
1674 @code{*}, the grouping is in units of @code{beatLength}.
1675 For explicit rules, the grouping is in units of the beam type.
1676
1677 Beam settings are changed with
1678 @code{\overrideBeamSettings} and @code{\revertBeamSettings}.
1679
1680 @lilypond[quote,relative=2,verbatim]
1681   \time 5/16
1682   c8^"beats" c16 c8 |
1683   \overrideBeamSettings #'Score #'(5 . 16) #'end #'((* . (2 3)))
1684   c8^"(2+3)" c16 c8
1685   \overrideBeamSettings #'Score #'(5 . 16) #'end #'((* . (3 2)))
1686   c8^"(3+2)" c16 c8
1687 @end lilypond
1688
1689 Beam setting changes can be limited to specific contexts.  If no
1690 setting is included in a lower-level context, the setting of the
1691 enclosing context will apply.
1692
1693 @lilypond[quote, verbatim,relative=1]
1694 \new Staff <<
1695   \time 7/8
1696   \new Voice = one {
1697     \relative c'' {
1698       \overrideBeamSettings #'Staff #'(7 . 8) #'end #'((* . (2 3 2)))
1699         a8 a a a a a a
1700     }
1701   }
1702   \new Voice  = two {
1703     \relative c' {
1704       \voiceTwo
1705       \overrideBeamSettings #'Voice #'(7 . 8) #'end #'((* . (1 3 3)))
1706       f8 f f f f f f
1707     }
1708   }
1709 >>
1710 @end lilypond
1711
1712 When multiple voices are used the @code{Staff} context must be
1713 specified if the beaming is to be applied to all voices in the
1714 staff:
1715
1716 @lilypond[quote,verbatim,relative=2]
1717 \time 7/8
1718 % rhythm 3-1-1-2
1719 % Context Voice specified --  does not work correctly
1720 % Because of autogenerated voices, all beating will
1721 % be at beatLength (1 . 8)
1722 \overrideBeamSettings #'Voice #'(7 . 8) #'end #'((* . (3 1 1 2)))
1723 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1724
1725 % Works correctly with context Staff specified
1726 \overrideBeamSettings #'Staff #'(7 . 8) #'end #'((* . (3 1 1 2)))
1727 << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
1728 @end lilypond
1729
1730 @funindex revertBeamSettings
1731
1732 Beam settings can be reverted to get back to default behavior.  This
1733 is accomplished by using @code{\revertBeamSettings}.  The arguments
1734 are the same as for @code{\overrideBeamSettings}, except no value
1735 for @var{grouping} is given:
1736
1737 @example
1738 \revertBeamSettings context time-signature rule-type
1739 @end example
1740
1741
1742 @lilypond[quote,verbatim,relative=2]
1743 \time 4/4
1744 \repeat unfold 16 {a16}
1745 % set default rule for (1 1 1 1) grouping
1746 \overrideBeamSettings #'Score #'(4 . 4) #'end #'((* . (1 1 1 1)))
1747 \repeat unfold 16 {a16}
1748 % revert the new rule
1749 \revertBeamSettings #'Score #'(4 . 4) #'end
1750 \repeat unfold 16 {a16}
1751 @end lilypond
1752
1753 @snippets
1754
1755 @cindex beams, subdividing
1756
1757 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1758 {sub-dividing-beams.ly}
1759
1760 @cindex measure groupings
1761 @cindex beats, grouping
1762 @cindex grouping beats
1763 @cindex measure sub-grouping
1764
1765 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1766 {conducting-signs,-measure-grouping-signs.ly}
1767
1768 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1769 {beam-endings-in-score-context.ly}
1770
1771 @cindex beam, last in score
1772 @cindex beam, last in polyphonic voice
1773
1774 @knownissues
1775
1776 If a score ends while an automatic beam has not been ended and is
1777 still accepting notes, this last beam will not be typeset at all.
1778 The same holds for polyphonic voices, entered with @code{<<
1779 @dots{} \\ @dots{} >>}.  If a polyphonic voice ends while an
1780 automatic beam is still accepting notes, it is not typeset.
1781
1782
1783 @seealso
1784 Snippets:
1785 @rlsr{Rhythms}.
1786
1787
1788 @node Manual beams
1789 @unnumberedsubsubsec Manual beams
1790
1791 @cindex beams, manual
1792 @cindex manual beams
1793
1794 @funindex ]
1795 @funindex [
1796
1797 In some cases it may be necessary to override the automatic
1798 beaming algorithm.  For example, the autobeamer will not put beams
1799 over rests or bar lines, and in choral scores the beaming is
1800 often set to follow the meter of the lyrics rather than the
1801 notes. Such beams can be specified manually by
1802 marking the begin and end point with @code{[} and @code{]}
1803
1804 @lilypond[quote,relative=1,verbatim]
1805 {
1806   r4 r8[ g' a r8] r8 g[ | a] r8
1807 }
1808 @end lilypond
1809
1810
1811 @funindex \noBeam
1812 @funindex noBeam
1813
1814 Individual notes may be marked with @code{\noBeam} to prevent them
1815 from being beamed:
1816
1817 @lilypond[quote,verbatim,relative=2]
1818 \time 2/4 c8 c\noBeam c c
1819 @end lilypond
1820
1821 @funindex stemLeftBeamCount
1822 @funindex stemRightBeamCount
1823
1824 Even more strict manual control with the beams can be achieved by
1825 setting the properties @code{stemLeftBeamCount} and
1826 @code{stemRightBeamCount}.  They specify the number of beams to
1827 draw on the left and right side, respectively, of the next note.
1828 If either property is set, its value will be used only once, and
1829 then it is erased.  In this example, the last @code{f} is printed
1830 with only one beam on the left side, i.e., the eighth-note beam of
1831 the group as a whole.
1832
1833 @lilypond[quote,relative=2,verbatim]
1834 a8[ r16 f g a]
1835 a8[ r16
1836 \set stemLeftBeamCount = #2
1837 \set stemRightBeamCount = #1
1838 f
1839 \set stemLeftBeamCount = #1
1840 g a]
1841 @end lilypond
1842
1843
1844 @snippets
1845
1846 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
1847 {flat-flags-and-beam-nibs.ly}
1848
1849 @node Feathered beams
1850 @unnumberedsubsubsec Feathered beams
1851
1852 @cindex beams, feathered
1853 @cindex feathered beams
1854
1855 @funindex \featherDurations
1856 @funindex featherDurations
1857 @funindex grow-direction
1858
1859 Feathered beams are used to indicate that a small group of notes
1860 should be played at an increasing (or decreasing) tempo, without
1861 changing the overall tempo of the piece.  The extent of the
1862 feathered beam must be indicated manually using @code{[} and
1863 @code{]}, and the beam feathering is turned on by specifying a
1864 direction to the @code{Beam} property @code{grow-direction}.
1865
1866 If the placement of the notes and the sound in the MIDI output is to
1867 reflect the ritardando or accelerando indicated by the feathered beam
1868 the notes must be grouped as a music expression delimited by braces
1869 and preceded by a @code{featherDurations} command which specifies
1870 the ratio between the durations of the first and last notes in the
1871 group.
1872
1873 The square brackets show the extent of the beam and the braces show
1874 which notes are to have their durations modified.  Normally these
1875 would delimit the same group of notes, but this is not required: the
1876 two commands are independent.
1877
1878 In the following example the eight 16th notes occupy exactly the
1879 same time as a half note, but the first note is one half as long
1880 as the last one, with the intermediate notes gradually
1881 lengthening.  The first four 32nd notes gradually speed up, while
1882 the last four 32nd notes are at a constant tempo.
1883
1884 @lilypond[relative=1,verbatim,quote]
1885 \override Beam #'grow-direction = #LEFT
1886 \featherDurations #(ly:make-moment 2 1)
1887 { c16[ c c c c c c c] }
1888 \override Beam #'grow-direction = #RIGHT
1889 \featherDurations #(ly:make-moment 2 3)
1890 { c32[ d e f] }
1891 % revert to non-feathered beams
1892 \override Beam #'grow-direction = #'()
1893 { g32[ a b c] }
1894 @end lilypond
1895
1896 @noindent
1897 The spacing in the printed output represents the
1898 note durations only approximately, but the MIDI output is exact.
1899
1900 @knownissues
1901
1902 The @code{\featherDurations} command only works with very short
1903 music snippets, and when numbers in the fraction are small.
1904
1905
1906 @seealso
1907 Snippets:
1908 @rlsr{Rhythms}.
1909
1910
1911 @node Bars
1912 @subsection Bars
1913
1914
1915 @menu
1916 * Bar lines::
1917 * Bar numbers::
1918 * Bar and bar number checks::
1919 * Rehearsal marks::
1920 @end menu
1921
1922 @node Bar lines
1923 @unnumberedsubsubsec Bar lines
1924
1925 @cindex bar lines
1926 @cindex measure lines
1927 @cindex closing bar lines
1928 @cindex bar lines, closing
1929 @cindex double bar lines
1930 @cindex bar lines, double
1931 @cindex repeat bars
1932
1933 @funindex \bar
1934 @funindex bar
1935
1936 Bar lines delimit measures, and are also used to indicate
1937 repeats.  Normally, simple bar lines are automatically inserted
1938 into the printed output at places based on the current time
1939 signature.
1940
1941 The simple bar lines inserted automatically can be changed to
1942 other types with the @code{\bar} command.  For example, a closing
1943 double bar line is usually placed at the end of a piece:
1944
1945 @lilypond[quote,relative=1,verbatim]
1946 e4 d c2 \bar "|."
1947 @end lilypond
1948
1949 It is not invalid if the final note in a measure does not
1950 end on the automatically entered bar line: the note is assumed
1951 to carry over into the next measure.  But if a long sequence
1952 of such carry-over measures appears the music can appear compressed
1953 or even flowing off the page.  This is because automatic line
1954 breaks happen only at the end of complete measures, i.e., where
1955 all notes end before the end of a measure.
1956
1957 @warning{An incorrect duration can cause line breaks to be
1958 inhibited, leading to a line of highly compressed music or
1959 music which flows off the page.}
1960
1961 @cindex line breaks
1962 @cindex bar lines, invisible
1963 @cindex measure lines, invisible
1964
1965 Line breaks are also permitted at manually inserted bar lines
1966 even within incomplete measures.  To allow a line break without
1967 printing a bar line, use
1968
1969 @example
1970 \bar ""
1971 @end example
1972
1973 @noindent
1974 This will insert an invisible bar line and allow (but not
1975 force) a line break to occur at this point.  The bar number
1976 counter is not increased.  To force a line break see
1977 @ref{Line breaking}.
1978
1979 @cindex manual bar lines
1980 @cindex manual measure lines
1981 @cindex bar lines, manual
1982 @cindex measure lines, manual
1983
1984 This and other special bar lines may be inserted manually at any
1985 point.  When they coincide with the end of a measure they replace the
1986 simple bar line which would have been inserted there automatically.
1987 When they do not coincide with the end of a measure the specified bar
1988 line is inserted at that point in the printed output.  Such insertions
1989 do not affect the calculation and placement of subsequent automatic
1990 bar lines.
1991
1992 Two types of simple bar lines and five types of double bar lines are available
1993 for manual insertion:
1994
1995 @lilypond[quote,relative=1,verbatim]
1996 f1 \bar "|"
1997 f \bar "."
1998 g \bar "||"
1999 a \bar ".|"
2000 b \bar ".|."
2001 c \bar "|.|"
2002 d \bar "|."
2003 e
2004 @end lilypond
2005
2006 @noindent
2007 together with dotted and dashed bar lines:
2008
2009 @lilypond[quote,relative=1,verbatim]
2010 f1 \bar ":"
2011 g \bar "dashed"
2012 a
2013 @end lilypond
2014
2015 @noindent
2016 and five types of repeat bar line:
2017
2018 @lilypond[quote,relative=1,verbatim]
2019 f1 \bar "|:"
2020 g \bar ":|:"
2021 a \bar ":|.|:"
2022 b \bar ":|.:"
2023 c \bar ":|"
2024 d
2025 @end lilypond
2026
2027 Additionally, a bar line can be printed as a simple tick:
2028 @lilypond[quote,relative=1,verbatim]
2029 f1 \bar "'"
2030 @end lilypond
2031 However, as such ticks are typically used in Gregorian chant, it is preferable
2032 to use @code{\divisioMinima} there instead, described in the section
2033 @ref{Divisiones} in Gregorian chant.
2034
2035
2036 @cindex repeats
2037
2038 Although the bar line types signifying repeats may be inserted
2039 manually they do not in themselves cause LilyPond to recognize
2040 a repeated section.  Such repeated sections are better entered
2041 using the various repeat commands (see @ref{Repeats}), which
2042 automatically print the appropriate bar lines.
2043
2044 In addition, you can specify @code{"||:"}, which is equivalent to
2045 @code{"|:"} except at line breaks, where it gives a double bar
2046 line at the end of the line and a start repeat at the beginning of
2047 the next line.
2048
2049 @lilypond[quote,relative=2,verbatim]
2050 c c c c
2051 \bar "||:"
2052 c c c c \break
2053 \bar "||:"
2054 c c c c
2055 @end lilypond
2056
2057 In scores with many staves, a @code{\bar} command in one staff is
2058 automatically applied to all staves.  The resulting bar lines are
2059 connected between different staves of a @code{StaffGroup},
2060 @code{PianoStaff}, or @code{GrandStaff}.
2061
2062 @lilypond[quote,fragment,verbatim]
2063 <<
2064   \new StaffGroup <<
2065     \new Staff {
2066       e'4 d'
2067       \bar "||"
2068       f' e'
2069     }
2070     \new Staff { \clef bass c4 g e g }
2071   >>
2072   \new Staff { \clef bass c2 c2 }
2073 >>
2074 @end lilypond
2075
2076
2077 @cindex default bar lines, changing
2078 @cindex bar lines, default, changing
2079
2080 @snippets
2081
2082 @funindex whichBar
2083 @funindex defaultBarType
2084 @funindex \bar
2085 @funindex bar
2086 @funindex bartype
2087
2088 The command @code{\bar }@var{bartype} is a shortcut for
2089 @code{\set Timing.whichBar = }@var{bartype}.  A bar line is
2090 created whenever the @code{whichBar} property is
2091 set.
2092
2093 The default bar type used for automatically inserted bar lines is
2094 @code{"|"}.  This may be changed at any time
2095 with @code{\set Timing.defaultBarType = }@var{bartype}.
2096
2097
2098 @seealso
2099 Notation Reference:
2100 @ref{Line breaking},
2101 @ref{Repeats},
2102 @ref{Grouping staves}.
2103
2104 Snippets:
2105 @rlsr{Rhythms}.
2106
2107 Internals Reference: @rinternals{BarLine} (created at
2108 @rinternals{Staff} level), @rinternals{SpanBar} (across
2109 staves), @rinternals{Timing_translator} (for Timing
2110 properties).
2111
2112
2113 @node Bar numbers
2114 @unnumberedsubsubsec Bar numbers
2115
2116 @cindex bar numbers
2117 @cindex measure numbers
2118 @cindex numbers, bar
2119 @cindex numbers, measure
2120
2121 @funindex currentBarNumber
2122
2123 Bar numbers are typeset by default at the start of every line except
2124 the first line.  The number itself is stored in the
2125 @code{currentBarNumber} property, which is normally updated
2126 automatically for every measure.  It may also be set manually:
2127
2128 @lilypond[verbatim,quote,fragment,relative=1]
2129 c1 c c c
2130 \break
2131 \set Score.currentBarNumber = #50
2132 c1 c c c
2133 @end lilypond
2134
2135 @cindex bar numbers, regular spacing
2136
2137 @funindex barNumberVisibility
2138 @funindex BarNumber
2139
2140 Bar numbers can be typeset at regular intervals instead of just at
2141 the beginning of every line.  To do this the default behavior
2142 must be overridden to permit bar numbers to be printed at places
2143 other than the start of a line.  This is controlled by the
2144 @code{break-visibility} property of @code{BarNumber}.  This takes
2145 three values which may be set to @code{#t} or @code{#f} to specify
2146 whether the corresponding bar number is visible or not.  The order
2147 of the three values is @code{end of line visible}, @code{middle of
2148 line visible}, @code{beginning of line visible}.  In the following
2149 example bar numbers are printed at all possible places:
2150
2151 @lilypond[verbatim,quote,relative=1]
2152 \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
2153 \set Score.currentBarNumber = #11
2154 % Permit first bar number to be printed
2155 \bar ""
2156 c1 | c | c | c
2157 \break
2158 c1 | c | c | c
2159 @end lilypond
2160
2161
2162 @snippets
2163
2164 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2165 {printing-the-bar-number-for-the-first-measure.ly}
2166
2167 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2168 {printing-bar-numbers-at-regular-intervals.ly}
2169
2170 @cindex measure number, format
2171 @cindex bar number, format
2172
2173 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2174 {printing-bar-numbers-inside-boxes-or-circles.ly}
2175
2176 @cindex bar number alignment
2177
2178 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2179 {aligning-bar-numbers.ly}
2180
2181 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
2182 {removing-bar-numbers-from-a-score.ly}
2183
2184
2185 @seealso
2186 Snippets:
2187 @rlsr{Rhythms}.
2188
2189 Internals Reference: @rinternals{BarNumber}.
2190
2191
2192 @cindex bar number collision
2193 @cindex collision, bar number
2194
2195 @knownissues
2196
2197 Bar numbers may collide with the top of the @code{StaffGroup} bracket,
2198 if there is one.  To solve this, the @code{padding} property of
2199 @code{BarNumber} can be used to position the number correctly.  See
2200 @rinternals{StaffGroup} and @rinternals{BarNumber} for more.
2201
2202
2203
2204 @node Bar and bar number checks
2205 @unnumberedsubsubsec Bar and bar number checks
2206
2207 @cindex bar check
2208 @cindex bar number check
2209 @cindex measure check
2210 @cindex measure number check
2211
2212 @funindex barCheckSynchronize
2213 @funindex |
2214
2215 Bar checks help detect errors in the entered durations.  A bar check
2216 may be entered using the bar symbol, @code{|}, at any place where a
2217 bar line is expected to fall.  If bar check lines are encountered at
2218 other places, a list of warnings is printed in the log file, showing
2219 the line numbers and lines in which the bar checks failed.  In the
2220 next example, the second bar check will signal an error.
2221
2222 @example
2223 \time 3/4 c2 e4 | g2 |
2224 @end example
2225
2226 Bar checks can also be used in lyrics, for example
2227
2228 @example
2229 \lyricmode @{
2230   \time 2/4
2231   Twin -- kle | Twin -- kle |
2232 @}
2233 @end example
2234
2235 An incorrect duration can result in a completely garbled score,
2236 especially if the score is polyphonic, so a good place to start
2237 correcting input is by scanning for failed bar checks and
2238 incorrect durations.
2239
2240 If successive bar checks are off by the same musical interval,
2241 only the first warning message is displayed.  This allows the
2242 warning to focus on the source of the timing error.
2243
2244
2245 @funindex |
2246 @funindex pipeSymbol
2247
2248 It is also possible to redefine the action taken when a bar check
2249 or pipe symbol, @code{|}, is encountered in the input, so that
2250 it does something other than a bar check.  This is done by
2251 assigning a music expression to @code{pipeSymbol}.
2252 In the following example @code{|} is set to insert a double bar
2253 line wherever it appears in the input, rather than checking
2254 for end of bar.
2255
2256 @lilypond[quote,verbatim]
2257 pipeSymbol = \bar "||"
2258 {
2259   c'2 c'2 |
2260   c'2 c'2
2261   c'2 | c'2
2262   c'2 c'2
2263 }
2264 @end lilypond
2265
2266 @funindex \barNumberCheck
2267 @funindex barNumberCheck
2268
2269 When copying large pieces of music, it can be helpful to check that
2270 the LilyPond bar number corresponds to the original that you are
2271 entering from.  This can be checked with @code{\barNumberCheck}, for
2272 example,
2273
2274 @verbatim
2275 \barNumberCheck #123
2276 @end verbatim
2277
2278 @noindent
2279 will print a warning if the @code{currentBarNumber} is not 123
2280 when it is processed.
2281
2282
2283 @seealso
2284 Snippets:
2285 @rlsr{Rhythms}.
2286
2287
2288 @node Rehearsal marks
2289 @unnumberedsubsubsec Rehearsal marks
2290
2291 @cindex rehearsal marks
2292 @cindex mark, rehearsal
2293
2294 @funindex \mark
2295 @funindex mark
2296
2297 To print a rehearsal mark, use the @code{\mark} command.
2298
2299 @lilypond[quote,verbatim,relative=2]
2300 c1 \mark \default
2301 c1 \mark \default
2302 c1 \mark #8
2303 c1 \mark \default
2304 c1 \mark \default
2305 @end lilypond
2306
2307 @noindent
2308 The letter@tie{}@q{I} is skipped in accordance with engraving
2309 traditions.  If you wish to include the letter @q{I}, then use
2310
2311 @example
2312 \set Score.markFormatter = #format-mark-alphabet
2313 @end example
2314
2315 The mark is incremented automatically if you use @code{\mark
2316 \default}, but you can also use an integer argument to set the
2317 mark manually.  The value to use is stored in the property
2318 @code{rehearsalMark}.
2319
2320 @cindex rehearsal mark format
2321 @cindex rehearsal mark style
2322 @cindex style, rehearsal mark
2323 @cindex format, rehearsal mark
2324 @cindex mark, rehearsal, style
2325 @cindex mark, rehearsal, format
2326 @cindex rehearsal mark, manual
2327 @cindex mark, rehearsal, manual
2328 @cindex custom rehearsal mark
2329 @cindex manual rehearsal mark
2330
2331 The style is defined by the property @code{markFormatter}.  It is
2332 a function taking the current mark (an integer) and the current
2333 context as argument.  It should return a markup object.  In the
2334 following example, @code{markFormatter} is set to a pre-defined
2335 procedure.  After a few measures, it is set to a procedure that
2336 produces a boxed number.
2337
2338 @lilypond[quote,verbatim,relative=2]
2339 \set Score.markFormatter = #format-mark-numbers
2340 c1 \mark \default
2341 c1 \mark \default
2342 \set Score.markFormatter = #format-mark-box-numbers
2343 c1 \mark \default
2344 \set Score.markFormatter = #format-mark-circle-numbers
2345 c1 \mark \default
2346 \set Score.markFormatter = #format-mark-circle-letters
2347 c1
2348 @end lilypond
2349
2350 The file @file{scm/@/translation@/-functions@/.scm} contains the
2351 definitions of @code{format-mark-numbers} (the default format),
2352 @code{format-mark-box-numbers}, @code{format-mark-letters} and
2353 @code{format-mark-box-letters}.  These can be used as inspiration
2354 for other formatting functions.
2355
2356 You may use @code{format-mark-barnumbers},
2357 @code{format-mark-box-barnumbers}, and
2358 @code{format-mark-circle-barnumbers} to get bar numbers instead of
2359 incremented numbers or letters.
2360
2361 Other styles of rehearsal mark can be specified manually:
2362
2363 @example
2364 \mark "A1"
2365 @end example
2366
2367 @noindent
2368 Note that @code{Score.markFormatter} does not affect marks specified
2369 in this manner.  However, it is possible to apply a @code{\markup} to the
2370 string.
2371
2372 @example
2373 \mark \markup@{ \box A1 @}
2374 @end example
2375
2376 @cindex segno
2377 @cindex coda
2378 @cindex D.S. al Fine
2379 @cindex fermata
2380 @cindex music glyphs
2381 @cindex glyphs, music
2382
2383 @funindex \musicglyph
2384 @funindex musicglyph
2385
2386 Music glyphs (such as the segno sign) may be printed inside a
2387 @code{\mark}
2388
2389 @lilypond[quote,verbatim,relative=1]
2390 c1 \mark \markup { \musicglyph #"scripts.segno" }
2391 c1 \mark \markup { \musicglyph #"scripts.coda" }
2392 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
2393 c1
2394 @end lilypond
2395
2396 @noindent
2397 See @ref{The Feta font}, for a list of symbols which may be
2398 printed with @code{\musicglyph}.
2399
2400 For common tweaks to the positioning of rehearsal marks, see
2401 @ref{Formatting text}.
2402
2403
2404 @seealso
2405 Notation Reference:
2406 @ref{The Feta font},
2407 @ref{Formatting text}.
2408
2409 Installed Files:
2410 @file{scm/@/translation@/-functions@/.scm} contains
2411 the definition of @code{format-mark-numbers} and
2412 @code{format-mark-letters}.  They can be used as inspiration for
2413 other formatting functions.
2414
2415 Snippets:
2416 @rlsr{Rhythms}.
2417
2418 Internals Reference: @rinternals{RehearsalMark}.
2419
2420
2421 @node Special rhythmic concerns
2422 @subsection Special rhythmic concerns
2423
2424
2425 @menu
2426 * Grace notes::
2427 * Aligning to cadenzas::
2428 * Time administration::
2429 @end menu
2430
2431 @node Grace notes
2432 @unnumberedsubsubsec Grace notes
2433
2434 @cindex ornaments
2435 @cindex grace notes
2436 @cindex appoggiatura
2437 @cindex acciaccatura
2438
2439 @funindex \grace
2440 @funindex grace
2441
2442 Grace notes are ornaments that are written out. Grace notes
2443 are printed in a smaller font and take up no logical time
2444 in a measure.
2445
2446 @lilypond[quote,relative=2,verbatim]
2447 c4 \grace c16 c4
2448 \grace { c16[ d16] } c2
2449 @end lilypond
2450
2451 LilyPond also supports two special types of grace notes, the
2452 @emph{acciaccatura} -- an unmeasured grace note indicated by a slurred
2453 small note with a slashed stem -- and the @emph{appoggiatura}, which
2454 takes a fixed fraction of the main note and appears in small print
2455 without a slash.
2456
2457 @lilypond[quote,relative=2,verbatim]
2458 \grace c8 b4
2459 \acciaccatura d8 c4
2460 \appoggiatura e8 d4
2461 \acciaccatura { g16[ f] } e4
2462 @end lilypond
2463
2464 The placement of grace notes is synchronized between different
2465 staves.  In the following example, there are two sixteenth grace
2466 notes for every eighth grace note
2467
2468 @lilypond[quote,relative=2,verbatim]
2469 << \new Staff { e2 \grace { c16[ d e f] } e2 }
2470    \new Staff { c2 \grace { g8[ b] } c2 } >>
2471 @end lilypond
2472
2473 @cindex grace notes, following
2474
2475 @funindex \afterGrace
2476 @funindex afterGrace
2477
2478 If you want to end a note with a grace, use the @code{\afterGrace}
2479 command.  It takes two arguments: the main note, and the grace
2480 notes following the main note.
2481
2482 @lilypond[quote,verbatim,relative=2]
2483 c1 \afterGrace d1 { c16[ d] } c1
2484 @end lilypond
2485
2486 This will put the grace notes after a space lasting 3/4 of the
2487 length of the main note.  The default fraction 3/4 can be changed by
2488 setting @code{afterGraceFraction}.  The following example shows
2489 the results from setting the space at the default,  at 15/16, and
2490 finally at 1/2 of the main note.
2491
2492 @lilypond[quote,verbatim,relative=2]
2493 <<
2494   \new Staff {
2495     c1 \afterGrace d1 { c16[ d] } c1
2496   }
2497   \new Staff {
2498     #(define afterGraceFraction (cons 15 16))
2499     c1 \afterGrace d1 { c16[ d] } c1
2500   }
2501   \new Staff {
2502     #(define afterGraceFraction (cons 1 2))
2503     c1 \afterGrace d1 { c16[ d] } c1
2504   }
2505 >>
2506 @end lilypond
2507
2508 The space between the main note and the grace note may also be
2509 specified using spacers. The following example places the grace
2510 note after a space lasting 7/8 of the main note.
2511
2512 @lilypond[quote,verbatim,relative=2]
2513 \new Voice {
2514   << { d1^\trill_( }
2515      { s2 s4. \grace { c16[ d] } } >>
2516   c1)
2517 }
2518 @end lilypond
2519
2520 @cindex tweaking grace notes
2521 @cindex grace notes, tweaking
2522 @cindex grace notes, changing layout settings
2523
2524 A @code{\grace} music expression will introduce special
2525 typesetting settings, for example, to produce smaller type, and
2526 set directions.  Hence, when introducing layout tweaks to
2527 override the special settings, they should be placed inside
2528 the grace expression. The overrides should also be reverted
2529 inside the grace expression. Here, the grace note's default stem
2530 direction is overridden and then reverted.
2531
2532 @lilypond[quote,verbatim,relative=2]
2533 \new Voice {
2534   \acciaccatura {
2535     \stemDown
2536     f16->
2537     \stemNeutral
2538   }
2539   g4 e c2
2540 }
2541 @end lilypond
2542
2543
2544 @cindex stem, with slash
2545
2546
2547 @snippets
2548
2549 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2550 {using-grace-note-slashes-with-normal-heads.ly}
2551
2552 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2553 {tweaking-grace-layout-within-music.ly}
2554
2555 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2556 {redefining-grace-note-global-defaults.ly}
2557
2558 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2559 {positioning-grace-notes-with-floating-space.ly}
2560
2561
2562 @seealso
2563 Music Glossary:
2564 @rglos{grace notes},
2565 @rglos{acciaccatura},
2566 @rglos{appoggiatura}.
2567
2568 Installed Files: @file{ly/@/grace@/-init@/.ly}.
2569
2570 Snippets: @rlsr{Rhythms}.
2571
2572 Internals Reference: @rinternals{GraceMusic}.
2573
2574
2575 @knownissues
2576
2577 @cindex acciaccatura, multi-note
2578 @cindex multi-note acciaccatura
2579 @cindex grace-note synchronization
2580
2581 A multi-note beamed @i{acciaccatura} is printed without a slash,
2582 and looks exactly the same as a multi-note beamed
2583 @i{appoggiatura}.
2584
2585 @c TODO Add link to LSR snippet to add slash when available
2586
2587 Grace note synchronization can also lead to surprises.  Staff
2588 notation, such as key signatures, bar lines, etc., are also
2589 synchronized.  Take care when you mix staves with grace notes and
2590 staves without, for example,
2591
2592 @lilypond[quote,relative=2,verbatim]
2593 <<
2594   \new Staff { e4 \bar "|:" \grace c16 d2. }
2595   \new Staff { c4 \bar "|:" d2. }
2596 >>
2597 @end lilypond
2598
2599 @noindent
2600 This can be remedied by inserting grace skips of the corresponding
2601 durations in the other staves.  For the above example
2602
2603 @lilypond[quote,relative=2,verbatim]
2604 <<
2605   \new Staff { e4 \bar "|:" \grace c16 d2. }
2606   \new Staff { c4 \bar "|:" \grace s16 d2. }
2607 >>
2608 @end lilypond
2609
2610 Grace sections should only be used within sequential music
2611 expressions.  Nesting or juxtaposing grace sections is not
2612 supported, and might produce crashes or other errors.
2613
2614 @node Aligning to cadenzas
2615 @unnumberedsubsubsec Aligning to cadenzas
2616
2617 @cindex cadenza
2618 @cindex cadenza, aligning to
2619 @cindex aligning to cadenza
2620
2621 In an orchestral context, cadenzas present a special problem: when
2622 constructing a score that includes a measured cadenza or other solo
2623 passage, all other instruments should skip just as many notes as the
2624 length of the cadenza, otherwise they will start too soon or too late.
2625
2626 One solution to this problem is to use the functions
2627 @code{mmrest-of-length} and @code{skip-of-length}.  These Scheme
2628 functions take a defined piece of music as an argument and generate a
2629 multi-measure rest or @code{\skip} exactly as long as the piece.
2630
2631 @lilypond[verbatim,quote]
2632 MyCadenza = \relative c' {
2633   c4 d8 e f g g4
2634   f2 g4 g
2635 }
2636
2637 \new GrandStaff <<
2638   \new Staff {
2639     \MyCadenza c'1
2640     \MyCadenza c'1
2641   }
2642   \new Staff {
2643     #(ly:export (mmrest-of-length MyCadenza))
2644     c'1
2645     #(ly:export (skip-of-length MyCadenza))
2646     c'1
2647   }
2648 >>
2649 @end lilypond
2650
2651
2652 @seealso
2653 Music Glossary:
2654 @rglos{cadenza}.
2655
2656 Snippets:
2657 @rlsr{Rhythms}.
2658
2659
2660 @node Time administration
2661 @unnumberedsubsubsec Time administration
2662
2663 @cindex time administration
2664 @cindex timing (within the score)
2665 @cindex music, unmetered
2666 @cindex unmetered music
2667
2668 @funindex currentBarNumber
2669 @funindex measurePosition
2670 @funindex measureLength
2671
2672 Time is administered by the @code{Timing_translator}, which by
2673 default is to be found in the @code{Score} context.  An alias,
2674 @code{Timing}, is added to the context in which the
2675 @code{Timing_translator} is placed.
2676
2677 The following properties of @code{Timing} are used
2678 to keep track of timing within the score.
2679
2680 @cindex bar number
2681 @cindex measure number
2682
2683 @table @code
2684 @item currentBarNumber
2685 The current measure number.  For an example showing the
2686 use of this property see @ref{Bar numbers}.
2687
2688 @item measureLength
2689 The length of the measures in the current time signature.  For a
2690 4/4 time this is@tie{}1, and for 6/8 it is 3/4.  Its value
2691 determines when bar lines are inserted and how automatic beams
2692 should be generated.
2693
2694 @item measurePosition
2695 The point within the measure where we currently are.  This
2696 quantity is reset by subtracting @code{measureLength} whenever
2697 @code{measureLength} is reached or exceeded.  When that happens,
2698 @code{currentBarNumber} is incremented.
2699
2700 @item timing
2701 If set to true, the above variables are updated for every time
2702 step.  When set to false, the engraver stays in the current
2703 measure indefinitely.
2704
2705 @end table
2706
2707 Timing can be changed by setting any of these variables
2708 explicitly.  In the next example, the default 4/4 time
2709 signature is printed, but @code{measureLength} is set to 5/4.
2710 At 4/8 through the third measure, the @code{measurePosition} is
2711 advanced by 1/8 to 5/8, shortening that bar by 1/8.
2712 The next bar line then falls at 9/8 rather than 5/4.
2713
2714 @lilypond[quote,verbatim,relative=1]
2715 \set Score.measureLength = #(ly:make-moment 5 4)
2716 c1 c4
2717 c1 c4
2718 c4 c4
2719 \set Score.measurePosition = #(ly:make-moment 5 8)
2720 b4 b4 b8
2721 c4 c1
2722 @end lilypond
2723
2724 @noindent
2725 As the example illustrates, @code{ly:make-moment n m} constructs a
2726 duration of n/m of a whole note.  For example,
2727 @code{ly:make-moment 1 8} is an eighth note duration and
2728 @code{ly:make-moment 7 16} is the duration of seven sixteenths
2729 notes.
2730
2731
2732 @seealso
2733 This manual: @ref{Bar numbers}, @ref{Unmetered music}
2734
2735 Snippets:
2736 @rlsr{Rhythms}.
2737
2738 Internals Reference: @rinternals{Timing_translator},
2739 @rinternals{Score}
2740