From ba8c5a22f1ffefcf89dd4c40aa2ce82493f95572 Mon Sep 17 00:00:00 2001 From: Trevor Daniels Date: Fri, 13 Mar 2009 09:35:19 +0000 Subject: [PATCH] Auto-beaming changes - add beam grouping rules for 3/8, 4/8, 6/4, 6/16, 9/4, 9/16, 12/4, 12/16 time signatures - amend beam ending rules to limit lengths of beamed runs of 16th and 32nd notes in some time signatures only (these may need some fine-tuning with experience and feedback) - except for 4/4 time, where the previous beaming is preserved - amend documentation to match --- Documentation/user/rhythms.itely | 118 +++++++++---------- scm/auto-beam.scm | 196 ++++++++++++++++++++----------- scm/music-functions.scm | 28 +++-- 3 files changed, 207 insertions(+), 135 deletions(-) diff --git a/Documentation/user/rhythms.itely b/Documentation/user/rhythms.itely index e02d14258e..a931db3d97 100644 --- a/Documentation/user/rhythms.itely +++ b/Documentation/user/rhythms.itely @@ -1438,9 +1438,6 @@ By default, beams are inserted automatically: @cindex beams, setting rules for @cindex beams, custom rules for -@funindex measureLength -@funindex beatLength -@funindex beatGrouping @funindex \autoBeamOn @funindex autoBeamOn @funindex \autoBeamOff @@ -1452,29 +1449,11 @@ By default, beams are inserted automatically: @end lilypond If these automatic decisions are not satisfactory, beaming can be -entered explicitly; see @ref{Manual beams}. Beams must also be -entered manually in the same way if beams are to be extended over -rests. - -It is possible -to define beaming patterns that differ from the defaults. The -default beaming rules for most common time signatures are defined -in @file{scm/@/auto@/-beam@/.scm}. If there are no beaming rules -defined for a particular beam's duration in the time signature being -used, its beaming is controlled by the values of three context -properties, @code{measureLength}, @code{beatLength} and -@code{beatGrouping}. Both the beaming rules and the context -properties can be overridden, see @ref{Setting automatic beam behavior}. +entered explicitly; see @ref{Manual beams}. Beams @emph{must} be +entered manually if beams are to be extended over rests. - -@warning{If beams are used to indicate melismata in songs, then automatic -beaming should be switched off with @code{\autoBeamOff} and the beams -indicated manually.} - - -@noindent -Automatic beaming may be turned off and on with -@code{\autoBeamOff} and @code{\autoBeamOn} commands: +If automatic beaming is not required, it may be turned off with +@code{\autoBeamOff} and on with @code{\autoBeamOn}: @lilypond[quote,relative=1,verbatim] c4 c8 c8. c16 c8. c16 c8 @@ -1484,6 +1463,13 @@ c4 c8 c8. c16 c8. c16 c8 @end lilypond +@warning{If beams are used to indicate melismata in songs, then +automatic beaming should be switched off with @code{\autoBeamOff} +and the beams indicated manually.} + +Beaming patterns that differ from the automatic defaults may be +created, see @ref{Setting automatic beam behavior}. + @predefined @code{\autoBeamOff}, @@ -1549,18 +1535,29 @@ Beams can collide with note heads and accidentals in other voices @funindex \set @funindex set -The placement of automatic beams is determined by the rules -described in @ref{Automatic beams}. There are two mutually -exclusive ways in which these rules may be modified. The -first, modifying the grouping of beats, applies to uncommon time -signatures, i.e. those for which there are no predefined rules -defining the beam end points. The second method, modifying the -specification of the beam end points, can be used for any time -signature. This second method @strong{must} be used for those time -signatures and beam durations combinations for which beam ending -rules are pre-defined, unless these have all been reverted. There -are predefined rules for time signatures of 3/2, 3/4, 4/4, 2/4, -4/8, 4/16, 6/8, 9/8 and 12/8. +There are two types of beaming rules: @emph{beam-grouping} +rules and @emph{beam-ending} rules. Beam-grouping rules are the +simplest, but are over-ridden by any beam-ending rules which apply. + +The placement of automatic beams is determined by applying the +following rules in order: + +@itemize + +@item If a manual beam is specified with @code{[..]} set the beam +as specified, otherwise + +@item if @code{\autoBeamOff} is in force do not beam, otherwise + +@item if a beam-ending rule applies use it to determine the valid +places where beams may end, otherwise + +@item if a valid (see below) beat-grouping rule applies use it to +group notes with beams, otherwise + +@item use the value of @code{beatLength} to group notes with beams + +@end itemize @i{@strong{Modifying the grouping of beats}} @@ -1570,8 +1567,14 @@ controlled by three context properties: @code{measureLength}, @code{beatLength} and @code{beatGrouping}. These properties may be set in the @code{Score}, @code{Staff} or @code{Voice} contexts to delimit their scope. The default values -are set while processing @code{\time} commands, so the @code{\set} -commands must be placed after all @code{\time} commands. +are set while processing @code{\time} commands, so any @code{\set} +commands to modify their value must be placed after all @code{\time} +commands. + +@warning{These three properties become effective for a particular +beam @strong{only} if there are no beam-ending rules predefined for +that beam's duration in the time signature in use, or if these +beam-ending rules have all been reverted.} These determine the beaming as follows: @@ -1591,11 +1594,6 @@ the end points of beams. @end itemize -@warning{These three properties become effective for a particular -beam @strong{only} if there are no beam-ending rules predefined for -that beam's duration in the time signature in use, or if these -beam-ending rules have all been reverted.} - By default the @code{measureLength} and @code{beatLength} are derived from the time signature set by the @code{\time} command. The @code{measureLength} is set to be exactly the same length as @@ -1606,7 +1604,8 @@ of the time signature. The default value of @code{beatGrouping} is taken from a table in @file{scm/@/music@/-functions@/.scm}. To find this, see @rlearning{Other sources of information}. It defines the beat -grouping for 5/8, 6/8, 8/8, 9/8 and 12/8 time signatures. +grouping for 3/8, 4/8, 5/8, 8/8, and all the common compound time +signatures. Both @code{measureLength} and @code{beatLength} are @i{moments}, units of musical duration. A quantity of type @i{moment} is @@ -1643,20 +1642,21 @@ beats in each group. @strong{@i{Modifying the beam end points}} -In common time signatures, automatic beams can start on any note -but can end at only a few positions within the measure, namely at -durations specified by the properties in @code{autoBeamSettings}. -These properties consist of a list of rules defining where beams can -end. The default @code{autoBeamSettings} rules are defined in -@file{scm/@/auto@/-beam@/.scm}. To find this, see +Beam-ending rules are required when beams of different durations are +to end at different points within the measure. For example, it may +be desirable for eighth-note beams in 4/4 time to end only at the +end of the measure or half-way through it, but for sixteenth-note +beams to end at quarter note positions to avoid overly long beamed +runs. The rules work as follows: + +Automatic beams can start on any note but can end at only a few +positions within the measure, namely at positions specified by the +properties in @code{autoBeamSettings}. These properties consist of +a list of rules defining where beams can end. The default +@code{autoBeamSettings} rules are defined in +@file{scm/@/auto@/-beam@/.scm}. To find this file, see @rlearning{Other sources of information}. -This method @strong{must} be used for the time signatures for which -beam-ending rules are defined by default, unless these have all -been reverted. It is also particularly suitable for many other time -signatures if the time signature of the measures changes frequently, -or if the beaming should be different for different beam durations. - In order to add a rule to the list, use @example @@ -1762,8 +1762,8 @@ possible interference, because the beam endings defined there will still apply in addition to your own.} Any unwanted or conflicting default endings must be reverted for -your time signature(s). Existing auto-beam rules are removed by -using +your time signature(s). Existing default or user-defined +beam-ending rules are removed by using @example #(revert-auto-beam-setting diff --git a/scm/auto-beam.scm b/scm/auto-beam.scm index 6479969eb8..8940c232fb 100644 --- a/scm/auto-beam.scm +++ b/scm/auto-beam.scm @@ -24,95 +24,93 @@ (define-public default-auto-beam-settings `( ;; in 2 2 time: - ;; use beatLength for all except 32nd notes - ;; end beams with 32nd notes each 1 4 beat + ;; use beatLength for all except 32nd notes + ;; end beams with 32nd notes each 1 4 beat ((end 1 32 2 2) . ,(ly:make-moment 1 4)) ((end 1 32 2 2) . ,(ly:make-moment 2 4)) ((end 1 32 2 2) . ,(ly:make-moment 3 4)) - ;; in 3 2 time: - ;; use beatLength for all except 16th and 32nd notes - ;; end beams with 16th notes each 1 4 beat - ;; end beams with 32nd notes each 1 8 beat + ;; in 2 4, 2 8 and 2 16 time: + ;; use beatLength - ((end 1 16 3 2) . ,(ly:make-moment 1 4)) - ((end 1 16 3 2) . ,(ly:make-moment 2 4)) - ((end 1 16 3 2) . ,(ly:make-moment 3 4)) - ((end 1 16 3 2) . ,(ly:make-moment 4 4)) - ((end 1 16 3 2) . ,(ly:make-moment 5 4)) - - ((end 1 32 3 2) . ,(ly:make-moment 1 8)) - ((end 1 32 3 2) . ,(ly:make-moment 2 8)) - ((end 1 32 3 2) . ,(ly:make-moment 3 8)) - ((end 1 32 3 2) . ,(ly:make-moment 4 8)) - ((end 1 32 3 2) . ,(ly:make-moment 5 8)) - ((end 1 32 3 2) . ,(ly:make-moment 6 8)) - ((end 1 32 3 2) . ,(ly:make-moment 7 8)) - ((end 1 32 3 2) . ,(ly:make-moment 8 8)) - ((end 1 32 3 2) . ,(ly:make-moment 9 8)) - ((end 1 32 3 2) . ,(ly:make-moment 10 8)) - ((end 1 32 3 2) . ,(ly:make-moment 11 8)) - - ;; in 2 4 time: + ;; in 3 2 time: ;; use beatLength for all except 32nd notes - ;; end beams with 32nd notes each 1 8 beat + ;; end beams with 32nd notes each 1 4 beat - ((end 1 32 2 4) . ,(ly:make-moment 1 8)) - ((end 1 32 2 4) . ,(ly:make-moment 2 8)) - ((end 1 32 2 4) . ,(ly:make-moment 3 8)) + ((end 1 32 3 2) . ,(ly:make-moment 1 4)) + ((end 1 32 3 2) . ,(ly:make-moment 2 4)) + ((end 1 32 3 2) . ,(ly:make-moment 3 4)) + ((end 1 32 3 2) . ,(ly:make-moment 4 4)) + ((end 1 32 3 2) . ,(ly:make-moment 5 4)) - ;; in 3 4 time: - ;; override beatLength which would end beams at 1 4 beats - ;; end beams with 16th notes each 1 4 beat - ;; end beams with 32nd notes each 1 8 beat + ;; in 3 4, 3 8 and 3 16 time: + ;; use beatLength - ((end * * 3 4) . ,(ly:make-moment 3 4)) - ((end 1 16 3 4) . ,(ly:make-moment 1 4)) - ((end 1 16 3 4) . ,(ly:make-moment 2 4)) - ((end 1 32 3 4) . ,(ly:make-moment 1 8)) - ((end 1 32 3 4) . ,(ly:make-moment 2 8)) - ((end 1 32 3 4) . ,(ly:make-moment 3 8)) - ((end 1 32 3 4) . ,(ly:make-moment 4 8)) - ((end 1 32 3 4) . ,(ly:make-moment 5 8)) - - ;; in common time: - ;; override beatLength which would end beams at 1 4 beats - ;; end all beams at 1 2 beat - ;; end beams with 8th triplets each 1 4 beat + ;; in 4 2 time: + ;; use beatLength for all except 16th and 32nd notes ;; end beams with 16th notes each 1 4 beat ;; end beams with 32nd notes each 1 8 beat - ((end * * 4 4) . ,(ly:make-moment 1 2)) - - ((end 1 12 4 4) . ,(ly:make-moment 1 4)) - ((end 1 12 4 4) . ,(ly:make-moment 3 4)) - - ((end 1 16 4 4) . ,(ly:make-moment 1 4)) - ((end 1 16 4 4) . ,(ly:make-moment 3 4)) + ((end 1 16 4 2) . ,(ly:make-moment 1 4)) + ((end 1 16 4 2) . ,(ly:make-moment 2 4)) + ((end 1 16 4 2) . ,(ly:make-moment 3 4)) + ((end 1 16 4 2) . ,(ly:make-moment 4 4)) + ((end 1 16 4 2) . ,(ly:make-moment 5 4)) + ((end 1 16 4 2) . ,(ly:make-moment 6 4)) + ((end 1 16 4 2) . ,(ly:make-moment 7 4)) + + ((end 1 32 4 2) . ,(ly:make-moment 1 8)) + ((end 1 32 4 2) . ,(ly:make-moment 2 8)) + ((end 1 32 4 2) . ,(ly:make-moment 3 8)) + ((end 1 32 4 2) . ,(ly:make-moment 4 8)) + ((end 1 32 4 2) . ,(ly:make-moment 5 8)) + ((end 1 32 4 2) . ,(ly:make-moment 6 8)) + ((end 1 32 4 2) . ,(ly:make-moment 7 8)) + ((end 1 32 4 2) . ,(ly:make-moment 8 8)) + ((end 1 32 4 2) . ,(ly:make-moment 9 8)) + ((end 1 32 4 2) . ,(ly:make-moment 10 8)) + ((end 1 32 4 2) . ,(ly:make-moment 11 8)) + ((end 1 32 4 2) . ,(ly:make-moment 12 8)) + ((end 1 32 4 2) . ,(ly:make-moment 13 8)) + ((end 1 32 4 2) . ,(ly:make-moment 14 8)) + ((end 1 32 4 2) . ,(ly:make-moment 15 8)) + + ;; in 4 4 (common) time: + ;; use beatLength for all except 32nd notes: + ;; end beams with 32nd notes each 1 8 beat + + ((end 1 8 4 4) . ,(ly:make-moment 1 2)) ((end 1 32 4 4) . ,(ly:make-moment 1 8)) ((end 1 32 4 4) . ,(ly:make-moment 2 8)) ((end 1 32 4 4) . ,(ly:make-moment 3 8)) + ((end 1 32 4 4) . ,(ly:make-moment 4 8)) ((end 1 32 4 4) . ,(ly:make-moment 5 8)) ((end 1 32 4 4) . ,(ly:make-moment 6 8)) ((end 1 32 4 4) . ,(ly:make-moment 7 8)) - ;; in 3 8 time: - ;; override beatLength which would end beams at 1 8 beats + ;; in 4 8 and 4 16 time: + ;; use beatLength - ((end * * 3 8) . ,(ly:make-moment 3 8)) + ;; in 6 4 time: + ;; use beatGrouping for all except 16th, 32nd notes + ;; end beams with 16th or 32nd notes each 1 4 beat - ;; in 4 8 time - ;; override beatLength which would end beams at 1 8 beats - ;; end all beams at 1 4 beat - ;; end beams with 32nd notes each 1 8 beat - ((end * * 4 8) . ,(ly:make-moment 1 4)) - ((end 1 32 4 8) . ,(ly:make-moment 1 8)) - ((end 1 32 4 8) . ,(ly:make-moment 3 8)) + ((end 1 16 6 4) . ,(ly:make-moment 1 4)) + ((end 1 16 6 4) . ,(ly:make-moment 2 4)) + ((end 1 16 6 4) . ,(ly:make-moment 3 4)) + ((end 1 16 6 4) . ,(ly:make-moment 4 4)) + ((end 1 16 6 4) . ,(ly:make-moment 5 4)) + + ((end 1 32 6 4) . ,(ly:make-moment 1 4)) + ((end 1 32 6 4) . ,(ly:make-moment 2 4)) + ((end 1 32 6 4) . ,(ly:make-moment 3 4)) + ((end 1 32 6 4) . ,(ly:make-moment 4 4)) + ((end 1 32 6 4) . ,(ly:make-moment 5 4)) - ;; in 6 8, 9 8 and 12 8 time: + ;; in 6 8 time: ;; use beatGrouping for all except 32nd notes ;; end beams with 32nd notes each 1 8 beat @@ -122,6 +120,35 @@ ((end 1 32 6 8) . ,(ly:make-moment 4 8)) ((end 1 32 6 8) . ,(ly:make-moment 5 8)) + ;; in 6 16 time: + ;; use beatGrouping + + ;; in 9 4 time: + ;; use beatGrouping for all except 16th, 32nd notes + ;; end beams with 16th or 32nd notes each 1 4 beat + + ((end 1 16 9 4) . ,(ly:make-moment 1 4)) + ((end 1 16 9 4) . ,(ly:make-moment 2 4)) + ((end 1 16 9 4) . ,(ly:make-moment 3 4)) + ((end 1 16 9 4) . ,(ly:make-moment 4 4)) + ((end 1 16 9 4) . ,(ly:make-moment 5 4)) + ((end 1 16 9 4) . ,(ly:make-moment 6 4)) + ((end 1 16 9 4) . ,(ly:make-moment 7 4)) + ((end 1 16 9 4) . ,(ly:make-moment 8 4)) + + ((end 1 32 9 4) . ,(ly:make-moment 1 4)) + ((end 1 32 9 4) . ,(ly:make-moment 2 4)) + ((end 1 32 9 4) . ,(ly:make-moment 3 4)) + ((end 1 32 9 4) . ,(ly:make-moment 4 4)) + ((end 1 32 9 4) . ,(ly:make-moment 5 4)) + ((end 1 32 9 4) . ,(ly:make-moment 6 4)) + ((end 1 32 9 4) . ,(ly:make-moment 7 4)) + ((end 1 32 9 4) . ,(ly:make-moment 8 4)) + + ;; in 9 8 time: + ;; use beatGrouping for all except 32nd notes + ;; end beams with 32nd notes each 1 8 beat + ((end 1 32 9 8) . ,(ly:make-moment 1 8)) ((end 1 32 9 8) . ,(ly:make-moment 2 8)) ((end 1 32 9 8) . ,(ly:make-moment 3 8)) @@ -131,6 +158,41 @@ ((end 1 32 9 8) . ,(ly:make-moment 7 8)) ((end 1 32 9 8) . ,(ly:make-moment 8 8)) + ;; in 9 16 time + ;; use beatGrouping + + ;; in 12 4 time: + ;; use beatGrouping for all except 16th, 32nd notes + ;; end beams with 16th or 32nd notes each 1 4 beat + + ((end 1 16 12 4) . ,(ly:make-moment 1 4)) + ((end 1 16 12 4) . ,(ly:make-moment 2 4)) + ((end 1 16 12 4) . ,(ly:make-moment 3 4)) + ((end 1 16 12 4) . ,(ly:make-moment 4 4)) + ((end 1 16 12 4) . ,(ly:make-moment 5 4)) + ((end 1 16 12 4) . ,(ly:make-moment 6 4)) + ((end 1 16 12 4) . ,(ly:make-moment 7 4)) + ((end 1 16 12 4) . ,(ly:make-moment 8 4)) + ((end 1 16 12 4) . ,(ly:make-moment 9 4)) + ((end 1 16 12 4) . ,(ly:make-moment 10 4)) + ((end 1 16 12 4) . ,(ly:make-moment 11 4)) + + ((end 1 32 12 4) . ,(ly:make-moment 1 4)) + ((end 1 32 12 4) . ,(ly:make-moment 2 4)) + ((end 1 32 12 4) . ,(ly:make-moment 3 4)) + ((end 1 32 12 4) . ,(ly:make-moment 4 4)) + ((end 1 32 12 4) . ,(ly:make-moment 5 4)) + ((end 1 32 12 4) . ,(ly:make-moment 6 4)) + ((end 1 32 12 4) . ,(ly:make-moment 7 4)) + ((end 1 32 12 4) . ,(ly:make-moment 8 4)) + ((end 1 32 12 4) . ,(ly:make-moment 9 4)) + ((end 1 32 12 4) . ,(ly:make-moment 10 4)) + ((end 1 32 12 4) . ,(ly:make-moment 11 4)) + + ;; in 12 8 time: + ;; use beatGrouping for all except 32nd notes + ;; end beams with 32nd notes each 1 8 beat + ((end 1 32 12 8) . ,(ly:make-moment 1 8)) ((end 1 32 12 8) . ,(ly:make-moment 2 8)) ((end 1 32 12 8) . ,(ly:make-moment 3 8)) @@ -143,10 +205,8 @@ ((end 1 32 12 8) . ,(ly:make-moment 10 8)) ((end 1 32 12 8) . ,(ly:make-moment 11 8)) - ;; in 4 16 time - ;; end all beams each 1 8 beat - - ((end * * 4 16) . ,(ly:make-moment 1 8)) + ;; in 12 16 time: + ;; use beatGrouping )) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 42a08cc344..de8b5973fb 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -479,17 +479,29 @@ of beat groupings " "Some standard subdivisions for time signatures." (let* ((key (cons num den)) - (entry (assoc key '(((6 . 8) . (3 3)) - ((5 . 8) . (3 2)) - ((9 . 8) . (3 3 3)) - ((12 . 8) . (3 3 3 3)) - ((8 . 8) . (3 3 2)) - )))) + (entry (assoc key '( + ; Simple time signatures + (( 3 . 8) . (3)) + (( 4 . 8) . (2 2)) + ; Compound time signatures + (( 6 . 4) . (3 3)) + (( 6 . 8) . (3 3)) + (( 6 . 16) . (3 3)) + (( 9 . 4) . (3 3 3)) + (( 9 . 8) . (3 3 3)) + (( 9 . 16) . (3 3 3)) + ((12 . 4) . (3 3 3 3)) + ((12 . 8) . (3 3 3 3)) + ((12 . 16) . (3 3 3 3)) + ; Some common irregular time signatures + (( 5 . 8) . (3 2)) + (( 8 . 8) . (3 3 2)) + )))) (if entry (cdr entry) - '()))) - + '()))) + (let* ((set1 (make-property-set 'timeSignatureFraction (cons num den))) (beat (ly:make-moment 1 den)) (len (ly:make-moment num den)) -- 2.39.5