Next: , Previous: Automatic beams, Up: Beams


Setting automatic beam behavior

The placement of automatic beams is determined by the rules described in 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 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.

Modifying the grouping of beats

If there are no beam-ending rules defined for the beam duration of a particular beam in the time signature in use, its beaming is controlled by three context properties: measureLength, beatLength and beatGrouping. These properties may be set in the Score, Staff or Voice contexts to delimit their scope. The default values are set while processing \time commands, so the \set commands must be placed after all \time commands.

These determine the beaming as follows:

Beams may begin anywhere (unless a beam is already active). Beams end at a time determined by the values of beatGrouping and beatLength, as follows:

Note: These three properties become effective for a particular beam 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 measureLength and beatLength are derived from the time signature set by the \time command. The measureLength is set to be exactly the same length as the measure length given by the time signature, and the beatLength is set to be the same as one over the denominator of the time signature.

The default value of beatGrouping is taken from a table in scm/music-functions.scm. To find this, see Other sources of information. It defines the beat grouping for 5/8, 6/8, 8/8, 9/8 and 12/8 time signatures.

Both measureLength and beatLength are moments, units of musical duration. A quantity of type moment is created by the scheme function ly:make-moment. For more information about this function, see Time administration.

beatGrouping is a list of integers giving the number of beats in each group.

Selected Snippets

Grouping beats

Beaming patterns may be altered with the beatGrouping property:

     
     \relative c'' {
       \time 5/16
       \set beatGrouping = #'(2 3)
       c8[^"(2+3)" c16 c8]
       \set beatGrouping = #'(3 2)
       c8[^"(3+2)" c16 c8]
     }
     

[image of music]

Specifying context with beatGrouping

By specifying the context, the effect of beatGrouping can be limited to the context specified, and the values which may have been set in higher-level contexts can be overridden. The \set commands must be placed after all ime commands:

     
     \score {
       \new Staff <<
         \time 7/8
         \new Voice {
           \relative c'' {
             \set Staff.beatGrouping = #'(2 3 2)
             a8 a a a a a a
           }
         }
         \new Voice {
           \relative c' {
             \voiceTwo
             \set Voice.beatGrouping = #'(1 3 3)
             f8 f f f f f f
           }
         }
       >>
     }

[image of music]

Using beatLength and beatGrouping

The property measureLength determines where bar lines should be inserted and, with beatLength and beatGrouping, how automatic beams should be generated for beam durations and time signatures for which no beam-ending rules are defined. This example shows several ways of controlling beaming by setting these properties. The explanations are shown as comments in the code.

     
     \relative c'' {
       \time 3/4
       % The default in 3/4 time is to beam in three groups
       % each of a quarter note length
       a16 a a a a a a a a a a a
     
       \time 12/16
       % No auto-beaming is defined for 12/16
       a16 a a a a a a a a a a a
     
       \time 3/4
       % Change time signature symbol, but retain underlying 3/4 beaming
       \set Score.timeSignatureFraction = #'(12 . 16)
       a16 a a a a a a a a a a a
     
       % The 3/4 time default grouping of (1 1 1) and beatLength of 1/8
       % are not consistent with a measureLength of 3/4, so the beams
       % are grouped at beatLength intervals
       \set Score.beatLength = #(ly:make-moment 1 8)
       a16 a a a a a a a a a a a
     
       % Specify beams in groups of (3 3 2 3) 1/16th notes
       % 3+3+2+3=11, and 11*1/16<>3/4, so beatGrouping does not apply,
       % and beams are grouped at beatLength (1/16) intervals
       \set Score.beatLength = #(ly:make-moment 1 16)
       \set Score.beatGrouping = #'(3 3 2 3)
       a16 a a a a a a a a a a a
     
       % Specify beams in groups of (3 4 2 3) 1/16th notes
       % 3+4+2+3=12, and 12*1/16=3/4, so beatGrouping applies
       \set Score.beatLength = #(ly:make-moment 1 16)
       \set Score.beatGrouping = #'(3 4 2 3)
       a16 a a a a a a a a a a a
     }
     

[image of music]

Sub-dividing beams

The beams of consecutive 16th (or shorter) notes are, by default, not sub-divided. That is, the three (or more) beams stretch unbroken over entire groups of notes. This behavior can be modified to sub-divide the beams into sub-groups by setting the property subdivideBeams. When set, multiple beams will be sub-divided at intervals defined by the current value of beatLength by reducing the multiple beams to just one beam between the sub-groups. Note that beatLength defaults to one over the denominator of the current time signature if not set explicitly. It must be set to a fraction giving the duration of the beam sub-group using the make-moment function, as shown here:

     
     \relative c'' {
       c32[ c c c c c c c]
       \set subdivideBeams = ##t
       c32[ c c c c c c c]
     
       % Set beam sub-group length to an eighth note
       \set beatLength = #(ly:make-moment 1 8)
       c32[ c c c c c c c]
     
       % Set beam sub-group length to a sixteenth note
       \set beatLength = #(ly:make-moment 1 16)
       c32[ c c c c c c c]
     }

[image of music]

Conducting signs, measure grouping signs

Options to group beats within a bar are available through the Scheme function set-time-signature, which takes three arguments: the number of beats, the beat length, and the internal grouping of beats in the measure. If the Measure_grouping_engraver is included, the function will also create MeasureGrouping signs. Such signs ease reading rhythmically complex modern music. In the example, the 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to set-time-signature as the third argument: '(2 2 2 3):

     
     \score {
       \relative c'' {
         #(set-time-signature 9 8 '(2 2 2 3))
         #(revert-auto-beam-setting '(end * * 9 8) 3 8)
         #(override-auto-beam-setting '(end 1 8 9 8) 1 4)
         #(override-auto-beam-setting '(end 1 8 9 8) 2 4)
         #(override-auto-beam-setting '(end 1 8 9 8) 3 4)
         g8 g d d g g a( bes g) |
         #(set-time-signature 5 8 '(3 2))
         a4. g4
       }
       \layout {
         \context {
           \Staff
           \consists "Measure_grouping_engraver"
         }
       }
     }

[image of music]

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 autoBeamSettings. These properties consist of a list of rules defining where beams can end. The default autoBeamSettings rules are defined in scm/auto-beam.scm. To find this, see Other sources of information.

This method 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

#(override-auto-beam-setting
  '(beam-limit
    beam-numerator  beam-denominator
    time-signature-numerator time-signature-denominator)
  moment-numerator moment-denominator [context])

where

For example, if automatic beams should always end on the first quarter note, whatever the time signature or beam duration, use

     
     a8 a a a a a a a
     #(override-auto-beam-setting '(end * * * *) 1 4)
     a8 a a a a a a a

[image of music]

You can force the beam settings to take effect only on beams whose shortest note is a certain duration

     
     \time 2/4
     % end 1/16 beams for all time signatures at the 1/16 moment
     #(override-auto-beam-setting '(end 1 16 * *) 1 16)
     a16 a a a a a a a |
     a32 a a a a16 a a a a a |
     % end 1/32 beams for all time signatures at the 1/16 moment
     #(override-auto-beam-setting '(end 1 32 * *) 1 16)
     a32 a a a a16 a a a a a |

[image of music]

You can force the beam settings to take effect only in certain time signatures

     
     \time 5/8
     % end beams of all durations in 5/8 time signature at the 2/8 moment
     #(override-auto-beam-setting '(end * * 5 8) 2 8)
     c8 c d d d
     \time 4/4
     e8 e f f e e d d
     \time 5/8
     c8 c d d d

[image of music]

When multiple voices are used the Staff context must be specified if the beaming is to be applied to all voices in the staff:

     
     \time 7/8
     % rhythm 3-1-1-2
     % Context not specified - does not work correctly
     #(override-auto-beam-setting '(end * * 7 8) 3 8)
     #(override-auto-beam-setting '(end * * 7 8) 4 8)
     #(override-auto-beam-setting '(end * * 7 8) 5 8)
     << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>
     
     % Works correctly with context specified
     #(override-auto-beam-setting '(end * * 7 8) 3 8 'Staff)
     #(override-auto-beam-setting '(end * * 7 8) 4 8 'Staff)
     #(override-auto-beam-setting '(end * * 7 8) 5 8 'Staff)
     << {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>

[image of music]

Note: If any unexpected beam behavior occurs, check the default automatic beam settings in scm/auto-beam.scm for 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

#(revert-auto-beam-setting
  '(beam-limit
    beam-numerator  beam-denominator
    time-signature-numerator time-signature-denominator)
  moment-numerator moment-denominator [context])

beam-limit, beam-numerator, beam-denominator, time-signature-numerator, time-signature-denominator, moment-numerator, moment-denominator and context are the same as above.

     
     \time 4/4
     a16 a a a a a a a a a a a a a a a
     % undo a rule ending 1/16 beams in 4/4 time at 1/4 moment
     #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
     a16 a a a a a a a a a a a a a a a

[image of music]

The rule in a revert-auto-beam-setting statement must exactly match the original rule. That is, no wildcard expansion is taken into account.

     
     \time 1/4
     #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
     a16 a a a
     #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
     a a a a
     #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
     a a a a

[image of music]

Selected Snippets

Beam grouping in 7/8 time

There are no default automatic beam groupings specified for 7/8 time, so if automatic beams are required the grouping must be specified. For example, to group all beams 2-3-2 in 7/8 time, specify beam endings at 2/8 and 5/8:

     
     \relative c'' {
       \time 7/8
       % rhythm 2-3-2
       a8 a a a a a a
       #(override-auto-beam-setting '(end * * 7 8) 2 8)
       #(override-auto-beam-setting '(end * * 7 8) 5 8)
       a8 a a a a a a
     }

[image of music]

Reverting default beam endings

To typeset beams grouped 3-4-3-2 in 12/8 it is necessary first to override the default beam endings in 12/8, and then to set up the new beaming endings:

     
     \relative c'' {
       \time 12/8
     
       % Default beaming
       a8 a a a a a a a a a a a
     
       % Revert default values in scm/auto-beam.scm for 12/8 time
       #(revert-auto-beam-setting '(end * * 12 8) 3 8)
       #(revert-auto-beam-setting '(end * * 12 8) 3 4)
       #(revert-auto-beam-setting '(end * * 12 8) 9 8)
       a8 a a a a a a a a a a a
     
       % Set new values for beam endings
       #(override-auto-beam-setting '(end * * 12 8) 3 8)
       #(override-auto-beam-setting '(end * * 12 8) 7 8)
       #(override-auto-beam-setting '(end * * 12 8) 10 8)
       a8 a a a a a a a a a a a
     }

[image of music]

Beam endings in Score context

Beam-ending rules specified in the Score context apply to all staves, but can be modified at both Staff and Voice levels:

     
     \relative c'' {
       \time 5/4
       % Set default beaming for all staves
       #(score-override-auto-beam-setting '(end * * 5 4) 3 8)
       #(score-override-auto-beam-setting '(end * * 5 4) 7 8)
       <<
         \new Staff {
           c8 c c c c c c c c c
         }
         \new Staff {
           % Modify beaming for just this staff
           #(override-auto-beam-setting '(end * * 5 4) 6 8 'Staff)
           #(revert-auto-beam-setting '(end * * 5 4) 7 8 'Staff)
           c8 c c c c c c c c c
         }
         \new Staff {
           % Inherit beaming from Score context
           <<
             {
               \voiceOne
               c8 c c c c c c c c c
             }
             % Modify beaming for this voice only
             \new Voice {
               \voiceTwo
               #(override-auto-beam-setting '(end * * 5 4) 6 8)
               #(revert-auto-beam-setting '(end * * 5 4) 7 8)
               a8 a a a a a a a a a
             }
           >>
         }
       >>
     }

[image of music]

Predefined commands

\autoBeamOff, \autoBeamOn.

Known issues and warnings

If a score ends while an automatic beam has not been ended and is still accepting notes, this last beam will not be typeset at all. The same holds for polyphonic voices, entered with << ... \\ ... >>. If a polyphonic voice ends while an automatic beam is still accepting notes, it is not typeset.

See also

Snippets: Rhythms.

Other languages: français, español, deutsch.