]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/notation/rhythms.itely
Issue 3687 (part 2): Amend docs to use \compressMMRests
[lilypond.git] / Documentation / notation / rhythms.itely
index 32d82db04bf8740352110c3b9d01bbcce2c8fc51..54ce04cb8f869fa65d5d61384c4c4c41423fbd08 100644 (file)
@@ -7,7 +7,7 @@
     Guide, node Updating translation committishes..
 @end ignore
 
-@c \version "2.17.30"
+@c \version "2.19.20"
 
 @node Rhythms
 @section Rhythms
@@ -93,6 +93,15 @@ note.
 a a a2 a a4 a a1 a
 @end lilypond
 
+Durations occuring on their own within a music sequence will take
+their pitches from the preceding note or chord.
+
+@lilypond[quote,verbatim,relative=2]
+\time 8/1
+c \longa \breve 1 2
+4 8 16 32 64 128 128
+@end lilypond
+
 @cindex notes, dotted
 @cindex dotted notes
 @cindex notes, double-dotted
@@ -190,31 +199,28 @@ rests from 128th to maxima (8 x whole) may be printed.
 @funindex tuplet
 
 Tuplets are made from a music expression with the @code{\tuplet}
-command, multiplying the speed of the music expression by a
-fraction:
+command, multiplying the speed of the music expression by a fraction:
 
 @example
 \tuplet @var{fraction} @{ @var{music} @}
 @end example
 
 @noindent
-The fraction's numerator will be printed over or
-under the notes, optionally with a bracket.  The most common
-tuplets are triplets: 3@tie{}notes sound within the duration
-normally allowed for@tie{}2:
+The fraction's numerator will be printed over or under the notes,
+optionally with a bracket.  The most common tuplets are triplets
+(3@tie{}notes sound within the duration normally allowed for@tie{}2).
 
 @lilypond[quote,verbatim,relative=2]
-a2 \tuplet 3/2 { b4 b b }
+a2 \tuplet 3/2 { b4 4 4 }
 c4 c \tuplet 3/2 { b4 a g }
 @end lilypond
 
 @cindex tuplet grouping
 @noindent
 When entering long passages of tuplets, having to write a separate
-@code{\tuplet} command for each group is inconvenient.  It is
-possible to specify the duration of one tuplet group directly
-before the music in order to have the tuplets grouped
-automatically:
+@code{\tuplet} command for each group is inconvenient.  It is possible
+to specify the duration of one tuplet group directly before the music
+in order to have the tuplets grouped automatically:
 
 @lilypond[quote,verbatim,relative=2]
 g2 r8 \tuplet 3/2 8 { cis16 d e e f g g f e }
@@ -229,8 +235,14 @@ g2 r8 \tuplet 3/2 8 { cis16 d e e f g g f e }
 @funindex \tupletNeutral
 @funindex tupletNeutral
 
-Tuplet brackets may be manually placed above or below the staff;
-see @ref{Direction and placement}.
+Tuplet brackets may be manually placed above or below the staff:
+
+@lilypond[quote,verbatim,relative=2]
+\tupletUp \tuplet 3/2 { c8 d e }
+\tupletNeutral \tuplet 3/2 { c8 d e }
+\tupletDown \tuplet 3/2 { f,8 g a }
+\tupletNeutral \tuplet 3/2 { f8 g a }
+@end lilypond
 
 Tuplets may be nested:
 
@@ -239,12 +251,11 @@ Tuplets may be nested:
 c4 \tuplet 5/4 { f8 e f \tuplet 3/2 { e[ f g] } } f4
 @end lilypond
 
-Modifying nested tuplets which begin at the same musical moment
-must be done with @code{\tweak}.
-
-To modify the duration of notes without printing a tuplet bracket,
-see @ref{Scaling durations}.
+Modifying nested tuplets which begin at the same musical moment must be
+done with @code{\tweak}.
 
+To modify the duration of notes without printing a tuplet bracket, see
+@ref{Scaling durations}.
 
 @predefined
 @code{\tupletUp},
@@ -262,7 +273,7 @@ see @ref{Scaling durations}.
 @funindex tupletSpannerDuration
 
 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
-{entering-several-tuplets-using-only-one--times-command.ly}
+{entering-several-tuplets-using-only-one--tuplet-command.ly}
 
 @cindex Tuplet number changes
 
@@ -290,6 +301,7 @@ Learning Manual:
 @rlearning{Tweaking methods}.
 
 Notation Reference:
+@ref{Direction and placement},
 @ref{Time administration},
 @ref{Scaling durations},
 @ref{The tweak command},
@@ -303,20 +315,6 @@ Internals Reference:
 @rinternals{TupletNumber},
 @rinternals{TimeScaledMusic}.
 
-@cindex grace notes within tuplet brackets
-
-@knownissues
-Grace notes may be placed within tuplet brackets, @emph{except}
-when a staff begins with a grace note followed by a tuplet.  In this
-particular case, the grace note must be placed before the @code{\tuplet}
-command to avoid errors.
-
-@cindex tempo marks within tuplet brackets
-
-When using a tuplet at the beginning of a piece with a @code{\tempo}
-mark, the music must be explicitly entered in a @code{\new Voice}
-block, as discussed in @rlearning{Voices contain music}.
-
 
 @node Scaling durations
 @unnumberedsubsubsec Scaling durations
@@ -422,7 +420,14 @@ of each pair of notes being tied.  This indicates that the note
 should be tied to the following note, which must be at the same pitch.
 
 @lilypond[quote,verbatim,relative=2]
-a2~ a4~ a16 r r8
+a2~ 4~ 16 r r8
+@end lilypond
+
+Ties can make use of the @q{last explicit pitch} interpretation of
+isolated durations:
+
+@lilypond[quote,verbatim,relative=2]
+a2~ 4~ 16 r r8
 @end lilypond
 
 Ties are used either when the note crosses a bar line, or when
@@ -431,8 +436,8 @@ used when note values cross larger subdivisions of the measure:
 
 @lilypond[verbatim,quote]
 \relative c' {
-  r8 c~ c2 r4 |
-  r8^"not" c2~ c8 r4
+  r8 c~ 2 r4 |
+  r8^"not" c2~ 8 r4
 }
 @end lilypond
 
@@ -450,7 +455,8 @@ created.  Chords may be partially tied by placing the ties inside
 the chord.
 
 @lilypond[quote,verbatim,relative=1]
-<c e g>~ <c e g c>
+<c e g>2 ~ 2
+<c e g>4~ <c e g c>
 <c~ e g~ b> <c e g b>
 @end lilypond
 
@@ -519,26 +525,26 @@ dashed.
 
 @lilypond[quote, verbatim, relative=1]
 \tieDotted
-c2~ c
+c2~ 2
 \tieDashed
-c2~ c
+c2~ 2
 \tieHalfDashed
-c2~ c
+c2~ 2
 \tieHalfSolid
-c2~ c
+c2~ 2
 \tieSolid
-c2~ c
+c2~ 2
 @end lilypond
 
 Custom dash patterns can be specified:
 
 @lilypond[quote, verbatim, relative=1]
 \tieDashPattern #0.3 #0.75
-c2~ c
+c2~ 2
 \tieDashPattern #0.7 #1.5
-c2~ c
+c2~ 2
 \tieSolid
-c2~ c
+c2~ 2
 @end lilypond
 
 Dash pattern definitions for ties have the same structure as dash
@@ -804,6 +810,8 @@ Internals Reference:
 @cindex whole rest for a full measure
 @cindex rest, whole for a full measure
 
+@funindex compressMMRests
+@funindex \compressMMRests
 @funindex R
 
 Rests for one or more full measures are entered like notes with
@@ -811,11 +819,12 @@ the note name uppercase @code{R}:
 
 @lilypond[quote,verbatim,relative=2]
 % Rest measures contracted to single measure
-\compressFullBarRests
-R1*4
-R1*24
-R1*4
-b2^"Tutti" b4 a4
+\compressMMRests {
+  R1*4
+  R1*24
+  R1*4
+  b2^"Tutti" b4 a4
+}
 @end lilypond
 
 The duration of full-measure rests is identical to the duration
@@ -824,15 +833,16 @@ always be an integral number of measure-lengths, so augmentation dots
 or fractions must often be used:
 
 @lilypond[quote,verbatim,relative=2]
-\compressFullBarRests
-\time 2/4
-R1 | R2 |
-\time 3/4
-R2. | R2.*2 |
-\time 13/8
-R1*13/8 | R1*13/8*12 |
-\time 10/8
-R4*5*4 |
+\compressMMRests {
+  \time 2/4
+  R1 | R2 |
+  \time 3/4
+  R2. | R2.*2 |
+  \time 13/8
+  R1*13/8 | R1*13/8*12 |
+  \time 10/8
+  R4*5*4 |
+}
 @end lilypond
 
 A full-measure rest is printed as either a whole or breve rest,
@@ -850,11 +860,6 @@ R1*2 |
 @cindex multi-measure rest, expanding
 @cindex multi-measure rest, contracting
 
-@funindex \expandFullBarRests
-@funindex expandFullBarRests
-@funindex \compressFullBarRests
-@funindex compressFullBarRests
-
 By default a multi-measure rest is expanded in the printed score to
 show all the rest measures explicitly.  Alternatively, a multi-measure
 rest can be shown as a single measure containing a multi-measure rest
@@ -866,10 +871,10 @@ symbol, with the number of measures of rest printed above the measure:
 \time 2/4 R2 |
 \time 4/4
 % Rest measures contracted to single measure
-\compressFullBarRests
-r1 | R1*17 | R1*4 |
-% Rest measures expanded
-\expandFullBarRests
+\compressMMRests {
+  r1 | R1*17 | R1*4 |
+}
+% Rest measures expanded again
 \time 3/4
 R2.*2 |
 @end lilypond
@@ -893,10 +898,11 @@ The predefined command @code{\fermataMarkup}
 is provided for adding fermatas.
 
 @lilypond[quote,verbatim,relative=2]
-\compressFullBarRests
-\time 3/4
-R2.*10^\markup { \italic "ad lib." }
-R2.^\fermataMarkup
+\compressMMRests {
+  \time 3/4
+  R2.*10^\markup { \italic "ad lib." }
+  R2.^\fermataMarkup
+}
 @end lilypond
 
 @warning{Markups attached to a multi-measure rest are objects of type
@@ -923,17 +929,14 @@ setting, resulting bar-check warnings may not be displayed.
 @funindex textLengthOff
 @funindex \fermataMarkup
 @funindex fermataMarkup
-@funindex \compressFullBarRests
-@funindex compressFullBarRests
-@funindex \expandFullBarRests
-@funindex expandFullBarRests
+@funindex \compressMMRests
+@funindex compressMMRests
 
 @predefined
 @code{\textLengthOn},
 @code{\textLengthOff},
 @code{\fermataMarkup},
-@code{\compressFullBarRests},
-@code{\expandFullBarRests}.
+@code{\compressMMRests}.
 @endpredefined
 
 
@@ -1021,7 +1024,9 @@ The time signature is set as follows:
 \time 3/4 c2.
 @end lilypond
 
-@cindex time signature, visibility of
+Mid-measure time signature changes are covered in @ref{Upbeats}.
+
+@cindex time signature visibility
 
 Time signatures are printed at the beginning of a piece
 and whenever the time signature changes.  If a change takes place
@@ -1141,37 +1146,6 @@ for the time signature that go beyond ending at every beat, as
 described in @ref{Setting automatic beam behavior}.
 @end enumerate
 
-The context containing @code{\overrideTimeSignatureSettings} must
-be instantiated before the @code{\overrideTimeSignatureSettings}
-call is executed.  That means it must either be explicitly
-instantiated or there must be music in the context before the
-@code{\overrideTimeSignatureSettings} call:
-
-@lilypond[quote,verbatim]
-\score {
-  \relative c' {
-    % This call will fail because the context isn't yet instantiated
-    \overrideTimeSignatureSettings
-      4/4        % timeSignatureFraction
-      1/4        % baseMomentFraction
-      #'(3 1)    % beatStructure
-      #'()       % beamExceptions
-    \time 4/4
-    c8^\markup {"Beamed (2 2)"}
-    \repeat unfold 7 { c8 } |
-    % This call will succeed
-    \overrideTimeSignatureSettings
-      4/4        % timeSignatureFraction
-      1/4        % baseMomentFraction
-      #'(3 1)    % beatStructure
-      #'()       % beamExceptions
-    \time 4/4
-    c8^\markup {"Beamed (3 1)"}
-    \repeat unfold 7 { c8 } |
-  }
-}
-@end lilypond
-
 
 @cindex time signature properties, restoring default values
 @cindex restoring default properties for time signatures
@@ -1346,15 +1320,16 @@ restores the default behavior of ignoring tempo marks
 for horizontal spacing.
 
 @lilypond[verbatim,quote,relative=0]
-\compressFullBarRests
-\markLengthOn
-\tempo "Molto vivace"
-R1*12
-\tempo "Meno mosso"
-R1*16
-\markLengthOff
-\tempo "Tranquillo"
-R1*20
+\compressMMRests {
+  \markLengthOn
+  \tempo "Molto vivace"
+  R1*12
+  \tempo "Meno mosso"
+  R1*16
+  \markLengthOff
+  \tempo "Tranquillo"
+  R1*20
+}
 @end lilypond
 
 @snippets
@@ -1399,29 +1374,22 @@ Internals Reference:
 @cindex measure, partial
 @cindex measure, pickup
 @cindex pickup measure
+@cindex time signature, mid-measure
 
 @funindex measurePosition
 @funindex \partial
 @funindex partial
 
 Partial or pick-up measures, such as an @emph{anacrusis} or an
-@emph{upbeat}, are entered using the @code{\partial} command,
+@emph{upbeat}, are entered using the @code{\partial} command:
 
 @example
 \partial @var{duration}
 @end example
 
-@noindent
-where @code{@var{duration}} is the @emph{remaining} length of the
-partial measure @emph{before} the start of the next full measure.
-
-@lilypond[quote,verbatim,relative=1]
-\time 3/4
-\partial 8
-e8 | a4 c8 b c4 |
-@end lilypond
-
-The @var{duration} can be any value less than a full measure:
+When @code{\partial} is used at the beginning of a score,
+@code{@var{duration}} is the length of the music preceding the
+first bar.
 
 @lilypond[quote,verbatim,relative=1]
 \time 3/4
@@ -1429,29 +1397,23 @@ The @var{duration} can be any value less than a full measure:
 r4 e8 | a4 c8 b c4 |
 @end lilypond
 
-@code{\partial @var{duration}} can also be written as:
-
-@example
-\set Timing.measurePosition -@var{duration}
-@end example
-
-So the first example above could be written:
+When @code{\partial} is used after the beginning of a score,
+@code{@var{duration}} is the @emph{remaining} length of the
+current measure.  It does not create a new numbered bar.
 
 @lilypond[quote,verbatim,relative=1]
-\time 3/4
-\set Timing.measurePosition = #(ly:make-moment -1/8)
-e8 | a4 c8 b c4 |
+\set Score.barNumberVisibility = #all-bar-numbers-visible
+\override Score.BarNumber.break-visibility =
+          #end-of-line-invisible
+\time 9/8
+d'4.~ 4 d8 d( c) b | c4.~ 4. \bar "||"
+\time 12/8
+\partial 4.
+c8( d) e | f2.~ 4 f8 a,( c) f |
 @end lilypond
 
-The property @code{measurePosition} contains a rational number,
-which is usually positive and indicates how much of the measure
-has passed at this point.  @code{\partial @var{duration}} is
-defined such that no numbered bar gets created: when used at the
-beginning of a measure, @code{measurePosition} is set to a
-negative number, implying that the current bar will be
-@emph{preceded} by additional material.  When used after a measure
-has already started, however, it moves the requested distance
-before the @emph{end} of the bar.
+The @code{\partial} command is @emph{required} when the time
+signature changes in mid measure, but it may also be used alone.
 
 @lilypond[quote,verbatim,relative=1]
 \set Score.barNumberVisibility = #all-bar-numbers-visible
@@ -1467,6 +1429,9 @@ r8 e8 | a4
 c8 b[ c b] |
 @end lilypond
 
+The @code{\partial} command sets the @code{Timing.measurePosition}
+property, which is a rational number that indicates how much of
+the measure has passed.
 
 @seealso
 Music Glossary:
@@ -1620,8 +1585,8 @@ stretches of unmetered music to permit breaking:
 
 @cindex double time signatures
 @cindex signatures, polymetric
-@cindex time signatures, polymetric
-@cindex time signatures, double
+@cindex time signature, polymetric
+@cindex time signature, double
 @cindex polymetric signatures
 @cindex meter, polymetric
 
@@ -1824,6 +1789,37 @@ inserts ties for notes.  One of its uses is to debug complex scores: if
 the measures are not entirely filled, then the ties show exactly how
 much each measure is off.
 
+The property @code{completionUnit} sets a preferred duration for
+the split notes.
+
+@lilypond[quote,verbatim,relative=2]
+\new Voice \with {
+  \remove "Note_heads_engraver"
+  \consists "Completion_heads_engraver"
+} {
+  \time 9/8 g\breve. d4. \bar "||"
+  \set completionUnit = #(ly:make-moment 3 8)
+  g\breve. d4.
+}
+@end lilypond
+
+These engravers split notes with scaled duration, such as those in tuplets,
+into notes with the same scale-factor as in the input note.
+
+@lilypond[quote,verbatim,relative=2]
+\new Voice \with {
+  \remove "Note_heads_engraver"
+  \consists "Completion_heads_engraver"
+} {
+  \time 2/4 r4
+  \tuplet 3/2 {g4 a b}
+  \scaleDurations 2/3 {g a b}
+  g4*2/3 a b
+  \tuplet 3/2 {g4 a b}
+  r4
+}
+@end lilypond
+
 @seealso
 Music Glossary:
 @rglos{tie}
@@ -1843,12 +1839,12 @@ Internals Reference:
 @rinternals{Forbid_line_break_engraver}.
 
 @knownissues
-Not all durations (especially those containing tuplets) can be
-represented exactly with normal notes and dots, but the
-@code{Completion_heads_engraver} will not insert tuplets.
-
-The @code{Completion_heads_engraver} only affects notes; it does not
-split rests.
+For consistency with previous behavior, notes and rests with
+duration longer than a measure, such as @code{c1*2}, are split into
+notes without any scale factor, @code{@{ c1 c1 @}}.  The property
+@code{completionFactor} controls this behavior, and setting it to
+@code{#f} cause split notes and rest to have the scale factor
+of the input durations.
 
 
 @node Showing melody rhythms
@@ -2051,6 +2047,7 @@ new beam starts.
 @funindex autoBeaming
 @funindex baseMoment
 @funindex beamExceptions
+@funindex \beamExceptions
 @funindex beatStructure
 @funindex measureLength
 @funindex \time
@@ -2096,6 +2093,14 @@ units of @code{baseMoment}.  By default, @code{baseMoment} is one
 over the denominator of the time signature.  By default, each unit of
 length @code{baseMoment} is a single beat.
 
+Note that there are separate @code{beatStructure} and @code{baseMoment}
+values for each time signature.  Changes to these variables apply only
+to the time signature that is currently in force, hence those changes
+must be placed after the @code{\time} command which starts a new time
+signature section, not before it.  New values given to a particular
+time signature are retained and reinstated whenever that time signature
+is re-established.
+
 @lilypond[quote,relative=2,verbatim]
 \time 5/16
 c16^"default" c c c c |
@@ -2192,42 +2197,24 @@ the time signature. Any exceptions to this default can be found in
 Special autobeaming rules (other than ending a beam on a beat)
 are defined in the @code{beamExceptions} property.
 
+The value for @code{beamExceptions}, a somewhat complex Scheme
+data structure, is easiest generated with the
+@code{\beamExceptions} function.  This function is given one or
+more manually beamed measure-length rhythmic patterns (measures
+have to be separated by a bar check@tie{}@code{|} since the
+function has no other way to discern the measure length).  Here is
+a simple example:
+
 @lilypond[quote,relative=2,verbatim]
 \time 3/16
 \set Timing.beatStructure = #'(2 1)
 \set Timing.beamExceptions =
-  #'(                         ;start of alist
-     (end .                   ;entry for end of beams
-      (                       ;start of alist of end points
-       ((1 . 32) . (2 2 2))   ;rule for 1/32 beams -- end each 1/16
-      )))                     %close all entries
+  \beamExceptions { 32[ 32] 32[ 32] 32[ 32] }
 c16 c c |
 \repeat unfold 6 { c32 } |
 @end lilypond
 
-@code{beamExceptions} is an alist with a key of rule-type and a value
-of beaming-rules.
-
-At this time the only available value of rule-type is
-@code{'end} for beam ending.
-
-Beaming-rules is a scheme alist (or list of pairs) that indicates the
-beam type and the grouping to be applied to beams containing notes with
-a shortest duration of that beam type.
-
-@example
-#'((beam-type1 . grouping-1)
-   (beam-type2 . grouping-2)
-   (beam-type3 . grouping-3))
-@end example
-
-Beam type is a scheme pair indicating the duration of the beam,
-e.g., @code{(1 . 16)}.
-
-Grouping is a scheme list indicating the grouping to be applied to
-the beam.  The grouping is in units of the beam type.
-
-@warning{ A @code{beamExceptions} value must be @emph{complete}
+@warning{A @code{beamExceptions} value must be @emph{complete}
 exceptions list.  That is, every exception that should be applied
 must be included in the setting.  It is not possible to add, remove,
 or change only one of the exceptions. While this may seem cumbersome,
@@ -2402,6 +2389,7 @@ in only one staff.
     \time 3/4
     \set Timing.baseMoment = #(ly:make-moment 1/8)
     \set Timing.beatStructure = #'(1 5)
+    \set Timing.beamExceptions = #'()
     \repeat unfold 6 { a8 }
   }
   \new Staff {
@@ -2812,9 +2800,10 @@ c4 c c c \break
 c1
 @end lilypond
 
-Additionally there is an @code{\inStaffSegno} command which
-creates a segno bar, placed in cooperation
-with the @code{\repeat volta} command.
+Additionally there is an @code{\inStaffSegno} command which creates
+a segno bar line in conjunction with an appropriate repeat bar line
+when used with a @code{\repeat volta} command, see
+@ref{Normal repeats}.
 
 @funindex \defineBarLine
 @funindex defineBarLine
@@ -3081,15 +3070,6 @@ next example, the second bar check will signal an error.
 \time 3/4 c2 e4 | g2 |
 @end example
 
-Bar checks can also be used in lyrics:
-
-@example
-\lyricmode @{
-  \time 2/4
-  Twin -- kle | Twin -- kle |
-@}
-@end example
-
 An incorrect duration can result in a completely garbled score,
 especially if the score is polyphonic, so a good place to start
 correcting input is by scanning for failed bar checks and
@@ -3099,6 +3079,22 @@ If successive bar checks are off by the same musical interval,
 only the first warning message is displayed.  This allows the
 warning to focus on the source of the timing error.
 
+Bar checks can also be inserted in lyrics:
+
+@example
+\lyricmode @{
+  \time 2/4
+  Twin -- kle | Twin -- kle |
+@}
+@end example
+
+Note that bar check marks in lyrics are evaluated at the musical
+moment when the syllable @emph{following} the check mark is processed.
+If the lyrics are associated with the notes of a voice which has a
+rest at the beginning of a bar, then no syllable can be located at the
+start of that bar and a warning will be issued if a bar check mark is
+placed in the lyrics at that position.
+
 
 @funindex |
 @funindex "|"
@@ -3511,32 +3507,11 @@ durations in the other staves.  For the above example
 >>
 @end lilypond
 
-The use of grace notes within voice contexts confuses the way the voice
-is typeset. This can be overcome by inserting a rest or note between the
-voice command and the grace note.
-
-@lilypond[quote,verbatim]
-accMusic = {
-  \acciaccatura { f8 } e8 r8 \acciaccatura { f8 } e8 r4
-}
-
-\new Staff {
-  <<
-    \new Voice {
-      \relative c'' {
-        r8 r8 \voiceOne \accMusic \oneVoice r8 |
-        r8 \voiceOne r8 \accMusic \oneVoice r8 |
-      }
-    }
-    \new Voice {
-      \relative c' {
-        s8 s8 \voiceTwo \accMusic \oneVoice s8 |
-        s8 \voiceTwo r8 \accMusic \oneVoice s8 |
-      }
-    }
-  >>
-}
-@end lilypond
+Please make sure that you use the @code{\grace} command for the
+spacer part, even if the visual part uses @code{\acciaccatura} or
+@code{\appoggiatura} because otherwise an ugly slur fragment will
+be printed, connecting the invisible grace note with the following
+note.
 
 Grace sections should only be used within sequential music expressions.
 Nesting or juxtaposing grace sections is not supported, and might