#### 3.5.2 Setting automatic beam behavior

In normal time signatures, automatic beams can start on any note but can only end in a few positions within the measure: beams can end on a beat, or at durations specified by the properties in `autoBeamSettings`. The defaults for `autoBeamSettings` are defined in scm/auto-beam.scm.

The value of `autoBeamSettings` is changed with two functions,

           #(override-auto-beam-setting
              '(be p q n m) a b
              [context])
           #(revert-auto-beam-setting '(be p q n m))

Here, be is the symbol `begin` or `end`, and context is an optional context (default: `'Voice`). It determines whether the rule applies to begin or end-points. The quantity p/q refers to the length of the beamed notes (and ``* *`' designates notes of any length), n/M refers to a time signature (wildcards ``* *`' may be entered to designate all time signatures), a/b is a duration. By default, this command changes settings for the current voice. It is also possible to adjust settings at higher contexts, by adding a context argument.

For example, if automatic beams should end on every quarter note, use the following

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

Since the duration of a quarter note is 1/4 of a whole note, it is entered as `(ly:make-moment 1 4)`.

The same syntax can be used to specify beam starting points. In this example, automatic beams can only end on a dotted quarter note

            #(override-auto-beam-setting '(end * * * *) 3 8)

In 4/4 time signature, this means that automatic beams could end only on 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times 3/8, has passed within the measure).

Rules can also be restricted to specific time signatures. A rule that should only be applied in N/M time signature is formed by replacing the second asterisks by N and M. For example, a rule for 6/8 time exclusively looks like

          #(override-auto-beam-setting '(begin * * 6 8) ...)

If a rule should be to applied only to certain types of beams, use the first pair of asterisks. Beams are classified according to the shortest note they contain. For a beam ending rule that only applies to beams with 32nd notes (and no shorter notes), use `(end 1 32 * *)`.

If beams are used to indicate melismata in songs, then automatic beaming should be switched off. This is done by setting `autoBeaming` to `#f`.

##### Predefined commands

`\autoBeamOff`, `\autoBeamOn`.

##### Bugs

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 polyphonic voices, entered with `<< ... \\ ... >>`. If a polyphonic voice ends while an automatic beam is still accepting notes, it is not typeset.

The rules for ending a beam depend on the shortest note in a beam. So, while it is possible to have different ending rules for eight beams and sixteenth beams, a beam that contains both eight and sixteenth notes will use the rules for the sixteenth beam.

In the example below, the autobeamer makes eight beams and sixteenth end at 3 eights; the third beam can only be corrected by specifying manual beaming.

It is not possible to specify beaming parameters that act differently in different parts of a measure. This means that it is not possible to use automatic beaming in irregular meters such as `5/8`.

Read comments on this page, or add one. This page is for LilyPond-2.2.5 (stable-branch).