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