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