Time signature

The time signature is set as follows:

\time 2/4 c''2
\time 3/4 c''2.

[image of music]

Mid-measure time signature changes are covered in Upbeats.

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.

\relative c'' {
  \time 2/4
  c2 c
  \break
  c c
  \break
  \time 4/4
  c c c c
}

[image of music]

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

\relative c'' {
  % 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
}

[image of music]

Mensural time signatures are covered in Mensural time signatures.

In addition to setting the printed time signature, the \time command also sets the values of the time-signature-based properties beatBase, beatStructure, and beamExceptions. The predefined default values for these properties can be found in scm/time-signature-settings.scm.

The default value of beatStructure can be overridden in the \time command itself by supplying it as the optional first argument:

\score {
  \new Staff {
    \relative {
      \time 2,2,3 7/8
      \repeat unfold 7 { c'8 } |
      \time 3,2,2 7/8
      \repeat unfold 7 { c8 } |
    }
  }
}

[image of music]

Alternatively, the default values of all these time-signature-based variables, including beatBase and beamExceptions, can be set together. The values can be set independently for several different time signatures. The new values take effect when a subsequent \time command with the same value of the time signature is executed:

\score {
  \new Staff {
    \relative c' {
      \overrideTimeSignatureSettings
        4/4        % timeSignatureFraction
        #1/4       % beatBase
        3,1        % beatStructure
        #'()       % beamExceptions
      \time 4/4
      \repeat unfold 8 { c8 } |
    }
  }
}

[image of music]

\overrideTimeSignatureSettings takes four arguments:

  1. timeSignatureFraction, a fraction describing the time signature to which these values apply.
  2. beatBase, the musical length corresponding to one unit of beatStructure.
  3. beatStructure, a Scheme list describing the length of each beat in the measure in units of beatBase.
  4. beamExceptions, an alist containing any beaming rules for the time signature that go beyond ending at every beat, as described in Setting automatic beam behavior.

Changed values of default time signature properties can be restored to the original values:

\score {
  \relative {
    \repeat unfold 8 { c'8 } |
    \overrideTimeSignatureSettings
      4/4        % timeSignatureFraction
      #1/4       % beatBase
      3,1        % beatStructure
      #'()       % beamExceptions
    \time 4/4
    \repeat unfold 8 { c8 } |
    \revertTimeSignatureSettings 4/4
    \time 4/4
    \repeat unfold 8 { c8 } |
  }
}

[image of music]

Different values of default time signature properties can be established for different staves by enabling polymetric notation (see Polymetric notation).

\score {
  \new StaffGroup <<
     \new Staff {
        \overrideTimeSignatureSettings
          4/4        % timeSignatureFraction
          #1/4       % beatBase
          3,1        % beatStructure
          #'()       % beamExceptions
        \time 4/4
        \repeat unfold 8 {c''8}
     }
     \new Staff {
        \overrideTimeSignatureSettings
          4/4        % timeSignatureFraction
          #1/4       % beatBase
          1,3        % beatStructure
          #'()       % beamExceptions
        \time 4/4
        \repeat unfold 8 {c''8}
     }
  >>
  \layout {
    \enablePolymeter
  }
}

[image of music]

A further method of changing these time-signature-related variables, which avoids reprinting the time signature at the time of the change, is shown in Setting automatic beam behavior.

Predefined commands

\numericTimeSignature, \defaultTimeSignature.

Selected Snippets

Time signature printing only the numerator as a number (instead of the fraction)

Sometimes, a time signature should not print the whole fraction (for example, 7/4), but only the numerator (digit 7 in this case). This can be easily done by using \override Staff.TimeSignature.style = #'single-number to change the style permanently. By using \revert Staff.TimeSignature.style, this setting can be reversed. To apply the single-number style to only one time signature, use the \override command and prefix it with a \once.

\relative c'' {
  \time 3/4
  c4 c c
  % Change the style permanently
  \override Staff.TimeSignature.style = #'single-number
  \time 2/4
  c4 c
  \time 3/4
  c4 c c
  % Revert to default style:
  \revert Staff.TimeSignature.style
  \time 2/4
  c4 c
  % single-number style only for the next time signature
  \once \override Staff.TimeSignature.style = #'single-number
  \time 5/4
  c4 c c c c
  \time 2/4
  c4 c
}

[image of music]

See also

Music Glossary: time signature

Notation Reference: Mensural time signatures, Polymetric notation, Setting automatic beam behavior, Time administration.

Installed Files: scm/time-signature-settings.scm.

Snippets: Rhythms.

Internals Reference: TimeSignature, Timing_translator.

Known issues and warnings

\numericTimeSignature and \defaultTimeSignature have no effect when used in a MensuralStaff. To use these modern time signatures in a MensuralStaff, either select them already when creating the context:

\new MensuralStaff \with { \numericTimeSignature } {
  c'1
}

[image of music]

or use an explicit \override:

\new MensuralStaff {
  \time 2/2
  c'1
  \override MensuralStaff.TimeSignature.style = #'numbered
  \time 2/2
  c'
  \override MensuralStaff.TimeSignature.style = #'default
  \time 2/2
  c'
}

[image of music]

If there is more than a single staff, and a time signature starts a prima volta but not the seconda volta, it is necessary to help LilyPond synchronize this situation by adding an explicit but invisible time signature in the seconda volta.

music = {
  \repeat volta 2 {
    \time 2/4 c'2 |
    \alternative {
      \volta 1 {
        \time 3/8 d'4. |
        \time 2/4 c'2 | }
      \volta 2 {
        \once \omit Staff.TimeSignature
        \time 2/4 c'2 |
      }
    }
  }
  \time 3/8 c'4. |
}

<<
  \new Staff \music
  \new Staff \music
>>

[image of music]


LilyPond Notation Reference v2.25.22 (development-branch).