GNU LilyPond Notation Reference: 1.2.3 Displaying rhythms

### 1.2.3 Displaying rhythms

#### Time signature

The time signature is set as follows:

>     \time 2/4 c2
>     \time 3/4 c2.

Time signatures are printed at the beginning of a piece and whenever the time signature changes. If a change takes place at the end of a line a warning time signature sign is printed there. This default behavior may be changed, see Visibility of objects.

>     \time 2/4
>     c2 c
>     \break
>     c c
>     \break
>     \time 4/4
>     c c c c

The time signature symbol that is used in 2/2 and 4/4 time can be changed to a numeric style:

>     % Default style
>     \time 4/4 c1
>     \time 2/2 c1
>     % Change to numeric style
>     \numericTimeSignature
>     \time 4/4 c1
>     \time 2/2 c1
>     % Revert to default style
>     \defaultTimeSignature
>     \time 4/4 c1
>     \time 2/2 c1

Mensural time signatures are covered in Mensural time signatures.

#### Predefined commands

`\numericTimeSignature`, `\defaultTimeSignature`.

#### Selected Snippets

Changing the time signature without affecting the beaming

The `\time` command sets the properties `timeSignatureFraction`, `beatLength`, `beatGrouping` and `measureLength` in the `Timing` context, which is normally aliased to `Score`. Changing the value of `timeSignatureFraction` causes the new time signature symbol to be printed without changing any of the other properties:

>     \relative c'' {
>       \time 3/4
>       a16 a a a a a a a a a a a

>       % Change time signature symbol but keep 3/4 beaming
>       % due to unchanged underlying time signature
>       \set Score.timeSignatureFraction = #'(12 . 16)
>       a16 a a a a a a a a a a a

>       \time 12/16
>       % Lose 3/4 beaming now \time has been changed
>       a16 a a a a a a a a a a a
>     }

Compound time signatures

Odd 20th century time signatures (such as "5/8") can often be played as compound time signatures (e.g. "3/8 + 2/8"), which combine two or more inequal metrics. LilyPond can make such music quite easy to read and play, by explicitly printing the compound time signatures and adapting the automatic beaming behavior. (Graphic measure grouping indications can also be added; see the appropriate snippet in this database.)

>     #(define ((compound-time one two num) grob)
>       (grob-interpret-markup grob
>         (markup #:override '(baseline-skip . 0) #:number
>           (#:line (
>               (#:column (one num))
>               #:vcenter "+"
>               (#:column (two num)))))))

>     \relative c' {
>       \override Staff.TimeSignature #'stencil = #(compound-time "2" "3" "8")
>       \time 5/8
>       #(override-auto-beam-setting '(end 1 8 5 8) 1 4)
>       c8 d e fis gis
>       c8 fis, gis e d
>       c8 d e4 gis8
>     }

#### See also

Music Glossary: time signature

Notation Reference: Mensural time signatures, Time administration.

Snippets: Rhythms.

Internals Reference: TimeSignature, Timing_translator.

#### Upbeats

Partial or pick-up measures, such as an anacrusis or upbeat, are entered using the `\partial` command, with the syntax

>     \partial duration

where `duration` is the rhythmic length of the interval before the start of the first complete measure:

>     \partial 4 e4 |
>     a2. c,4 |

The partial measure can be any duration less than a full measure:

>     \partial 8*3 c8 d e |
>     a2. c,4 |

Internally, this is translated into

>     \set Timing.measurePosition = -duration

The property `measurePosition` contains a rational number indicating how much of the measure has passed at this point. Note that this is set to a negative number by the `\partial` command: i.e., `\partial 4` is internally translated to `-4`, meaning “there is a quarter note left in the measure.”

#### See also

Music Glossary: anacrusis.

Notation Reference: Grace notes.

Snippets: Rhythms.

Internal Reference: Timing_translator.

#### Known issues and warnings

The `\partial` command is intended to be used only at the beginning of a piece. If you use it after the beginning, some odd warnings may occur.

#### Unmetered music

Bar lines and bar numbers are calculated automatically. For unmetered music (some cadenzas, for example), this is not desirable. To turn off automatic calculation of bar lines and bar numbers, use the command `\cadenzaOn`, and use `\cadenzaOff` to turn them on again.

    c4 d e d
    \cadenzaOn
    c4 c d8 d d f4 g4.
    \cadenzaOff
    \bar "|"
    d4 e d c

Bar numbering is resumed at the end of the cadenza as if the cadenza were not there:

    % Show all bar numbers
    \override Score.BarNumber #'break-visibility = #all-visible
    c4 d e d
    \cadenzaOn
    c4 c d8 d d f4 g4.
    \cadenzaOff
    \bar "|"
    d4 e d c

#### Predefined commands

`\cadenzaOn`, `\cadenzaOff`.

#### See also

Music Glossary: cadenza.

Notation Reference: Visibility of objects.

Snippets: Rhythms.

#### Known issues and warnings

LilyPond will insert line breaks and page breaks only at a bar line. Unless the unmetered music ends before the end of the staff line, you will need to insert invisible bar lines with

>     \bar ""

to indicate where breaks can occur.

#### Polymetric notation

Polymetric notation is supported, either explicitly or by modifying the visible time signature symbol and scaling the note durations.

Staves with different time signatures, equal measure lengths

This notation can be created by setting a common time signature for each staff but replacing the symbol manually by setting `timeSignatureFraction` to the desired fraction and scaling the printed durations in each staff to the common time signature; see Time signature. The scaling is done with `\scaleDurations`, which is used in a similar way to `\times`, but does not create a tuplet bracket; see Scaling durations.

In this example, music with the time signatures of 3/4, 9/8, and 10/8 are used in parallel. In the second staff, shown durations are multiplied by 2/3, as 2/3 * 9/8 = 3/4, and in the third staff, shown durations are multiplied by 3/5, as 3/5 * 10/8 = 3/4. It will often be necessary to insert beams manually, as the duration scaling affects the autobeaming rules.

>     \relative c' <<
>       \new Staff {
>         \time 3/4
>         c4 c c |
>         c c c |
>       }
>       \new Staff {
>         \time 3/4
>         \set Staff.timeSignatureFraction = #'(9 . 8)
>         \scaleDurations #'(2 . 3)
>         \repeat unfold 6 { c8[ c c] }
>       }
>       \new Staff {
>         \time 3/4
>         \set Staff.timeSignatureFraction = #'(10 . 8)
>         \scaleDurations #'(3 . 5) {
>           \repeat unfold 2 { c8[ c c] }
>           \repeat unfold 2 { c8[ c] } |
>           c4. c4. \times 2/3 { c8[ c c] } c4
>         }
>       }
>     >>

Staves with different time signatures, unequal bar lengths

Each staff can be given its own independent time signature by moving the `Timing_translator` and the `Default_bar_line_engraver` to the `Staff` context.

>     \layout {
>       \context {
>         \Score
>         \remove "Timing_translator"
>         \remove "Default_bar_line_engraver"
>       }
>       \context {
>         \Staff
>         \consists "Timing_translator"
>         \consists "Default_bar_line_engraver"
>       }
>     }

>     % Now each staff has its own time signature.

>     \relative c' <<
>       \new Staff {
>         \time 3/4
>         c4 c c |
>         c c c |
>       }
>       \new Staff {
>         \time 2/4
>         c4 c |
>         c c |
>         c c |
>       }
>       \new Staff {
>         \time 3/8
>         c4. |
>         c8 c c |
>         c4. |
>         c8 c c |
>       }
>     >>

#### Selected Snippets

Compound time signatures

Odd 20th century time signatures (such as "5/8") can often be played as compound time signatures (e.g. "3/8 + 2/8"), which combine two or more inequal metrics. LilyPond can make such music quite easy to read and play, by explicitly printing the compound time signatures and adapting the automatic beaming behavior. (Graphic measure grouping indications can also be added; see the appropriate snippet in this database.)

>     #(define ((compound-time one two num) grob)
>       (grob-interpret-markup grob
>         (markup #:override '(baseline-skip . 0) #:number
>           (#:line (
>               (#:column (one num))
>               #:vcenter "+"
>               (#:column (two num)))))))

>     \relative c' {
>       \override Staff.TimeSignature #'stencil = #(compound-time "2" "3" "8")
>       \time 5/8
>       #(override-auto-beam-setting '(end 1 8 5 8) 1 4)
>       c8 d e fis gis
>       c8 fis, gis e d
>       c8 d e4 gis8
>     }

#### See also

Music Glossary: polymetric, polymetric time signature, meter.

Notation Reference: Time signature, Scaling durations.

Snippets: Rhythms.

Internals Reference: TimeSignature, Timing_translator, Default_bar_line_engraver, Staff.

#### Known issues and warnings

When using different time signatures in parallel, notes at the same moment will be be placed at the same horizontal location. However, the bar lines in the different staves will cause the note spacing to be less regular in each of the individual staves than would be normal without the different time signatures.

#### Automatic note splitting

Long notes which overrun bar lines can be converted automatically to tied notes. This is done by replacing the `Note_heads_engraver` with the `Completion_heads_engraver`. In the following example, notes crossing the bar lines are split and tied.

>     \new Voice \with {
>       \remove "Note_heads_engraver"
>       \consists "Completion_heads_engraver"
>     }

>     { c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 }

This engraver splits all running notes at the bar line, and inserts ties. 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.

#### See also

Music Glossary: tie

Learning Manual: Engravers explained, Adding and removing engravers.

Snippets: Rhythms.

Internals Reference: Note_heads_engraver, Completion_heads_engraver, Forbid_line_break_engraver.

#### Known issues and warnings

Not all durations (especially those containing tuplets) can be represented exactly with normal notes and dots, but the `Completion_heads_engraver` will not insert tuplets.

The `Completion_heads_engraver` only affects notes; it does not split rests.

#### Showing melody rhythms

Sometimes you might want to show only the rhythm of a melody. This can be done with the rhythmic staff. All pitches of notes on such a staff are squashed, and the staff itself has a single line

>     <<
>       \new RhythmicStaff {
>         \new Voice = "myRhythm" {
>           \time 4/4
>           c4 e8 f g2
>           r4 g g f
>           g1
>         }
>       }
>       \new Lyrics {
>         \lyricsto "myRhythm" {
>           This is my song
>           I like to sing
>         }
>       }
>     >>

Guitar chord charts often show the strumming rhythms. This can be done with the `Pitch_squash_engraver` and `\improvisationOn`.

>     <<
>       \new ChordNames {
>         \chordmode {
>           c1 f g c
>         }
>       }

>       \new Voice \with {
>         \consists Pitch_squash_engraver
>       } \relative c'' {
>         \improvisationOn
>         c4 c8 c c4 c8 c
>         f4 f8 f f4 f8 f
>         g4 g8 g g4 g8 g
>         c4 c8 c c4 c8 c
>       }
>     >>

#### Predefined commands

`\improvisationOn`, `\improvisationOff`.

#### Selected Snippets

Guitar strum rhythms

For guitar music, it is possible to show strum rhythms, along with melody notes, chord names and fret diagrams.

>     \include "predefined-guitar-fretboards.ly"
>     <<
>       \new ChordNames {
>         \chordmode {
>           c1 f g c
>         }
>       }
>       \new FretBoards {
>         \chordmode {
>           c1 f g c
>         }
>       }
>       \new Voice \with {
>         \consists "Pitch_squash_engraver"
>       } {
>         \relative c'' {
>           \improvisationOn
>           c4 c8 c c4 c8 c
>           f4 f8 f f4 f8 f
>           g4 g8 g g4 g8 g
>           c4 c8 c c4 c8 c
>         }
>       }
>       \new Voice = "melody" {
>         \relative c'' {
>           c2 e4 e4
>           f2. r4
>           g2. a4
>           e4 c2.
>         }
>       }
>       \new Lyrics {
>         \lyricsto "melody" {
>           This is my song.
>           I like to sing.
>         }
>       }
>     >>

#### See also

Snippets: Rhythms.

Internals Reference: RhythmicStaff, Pitch_squash_engraver.

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

#### Notation Reference