Time administration

Time is administered by the Timing_translator, which by default is to be found in the Score context. An alias, Timing, is added to the context in which the Timing_translator is placed. To ensure that the Timing alias is available, you may need to explicitly instantiate the containing context (such as Voice or Staff).

The following properties of Timing are used to keep track of timing within the score.

currentBarNumber

The current measure number. For an example showing the use of this property see Bar numbers.

measureLength

The length of the measures in the current time signature. For a 4/4 time this is 1, and for 6/8 it is 3/4. Its value determines when bar lines are inserted and how automatic beams should be generated.

measurePosition

The point within the measure where we currently are. This quantity is reset by subtracting measureLength whenever measureLength is reached or exceeded. When that happens, currentBarNumber is incremented.

timing

If set to #t, the above variables are updated for every time step. When set to #f, the engraver stays in the current measure indefinitely.

Timing can be changed by setting any of these variables explicitly. In the next example, the default 4/4 time signature is printed, but measureLength is set to 5/4. At 4/8 through the third measure, the measurePosition is advanced by 1/8 to 5/8, shortening that bar by 1/8. The next bar line then falls at 9/8 rather than 5/4.

\new Voice \relative {
  \set Timing.measureLength = \musicLength 4*5
  c'1 c4 |
  c1 c4 |
  c4 c
  \set Timing.measurePosition = \musicLength 8*5
  b4 b b8 |
  c4 c1 |
}

[image of music]

As the example illustrates, \musicLength music computes the musical length of the given music. For example, \musicLength 8 is the length of an eighth note and \musicLength {8. 8 8} is the length of seven sixteenth notes.

See also

Notation Reference: Bar numbers, Unmetered music.

Snippets: Rhythms.

Internals Reference: Timing_translator, Score.


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