Setting automatic beam behavior - GNU LilyPond
Description: GNU LilyPond

Previous: Automatic accidentals, Up: Automatic notation

#### 9.1.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 properties in `autoBeamSettings` consist of a list of rules for where beams can begin and end. The default `autoBeamSettings` rules are defined in `scm/auto-beam.scm`.

In order to add a rule to the list, use

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

- `be` is either "begin" or "end".
- `p/q` is the duration of the note for which you want to add a rule. A beam is considered to have the duration of its shortest note. Set `p` and `q` to `'*'` to have this apply to any beam.
- `n/m` is the time signature to which this rule should apply. Set `n` and `m` to `'*'` to have this apply in any time signature.
- `a/b` is the position in the bar at which the beam should begin/end.
- `context` is optional, and it specifies the context at which the change should be made. The default is `'Voice`. `#(score-override-auto-beam-setting '(A B C D) E F)` is equivalent to `#(override-auto-beam-setting '(A B C D) E F 'Score)`.

For example, if automatic beams should always end on the first quarter note, use

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

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

>          \time 2/4
>          #(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 |
>          #(override-auto-beam-setting '(end 1 32 * *) 1 16)
>          a32 a a a a16 a a a a a |

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

>          \time 5/8
>          #(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

You can also remove a previously set beam-ending rule by using

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

be, p, q, n, m, a, b and context are the same as above. Note that the default rules are specified in `scm/auto-beam.scm`, so you can revert rules that you did not explicitly create.

>          \time 4/4
>          a16 a a a a a a a a a a a a a a a
>          #(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

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

If automatic beams should end on every quarter in 5/4 time, specify all endings

    #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
    #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
    #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
    #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
    ...

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)
    #(override-auto-beam-setting '(end * * * *) 1 2)
    #(override-auto-beam-setting '(end * * * *) 7 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).

If beams are used to indicate melismata in songs, then automatic beaming should be switched off with `\autoBeamOff`.

##### 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.

This page is for LilyPond-2.8.8 (stable-branch).

Other languages: English.
Using automatic language selection.