Octave checks

In relative mode, it is easy to forget an octave changing mark. Octave checks make such errors easier to find by displaying a warning and correcting the octave if a note is found in an unexpected octave.

To check the octave of a note, specify the absolute octave after the = symbol. This example will generate a warning (and change the pitch) because the second note is the absolute octave d'' instead of d' as indicated by the octave correction.

\relative {
  c''2 d='
  e2 f
}

[image of music]

The octave of notes may also be checked with the \octaveCheck controlpitch command. controlpitch is specified in absolute mode. This checks that the interval between the previous note and the controlpitch is within a fourth (i.e., the normal calculation of relative mode). If this check fails, a warning is printed. While the previous note itself is not changed, future notes are relative to the corrected value.

\relative {
  c''2 d
  \octaveCheck c'
  e2 f
}

[image of music]

Compare the two bars below. The first and third \octaveCheck checks fail, but the second one does not fail.

\relative {
  c''4 f g f

  c4
  \octaveCheck c'
  f
  \octaveCheck c'
  g
  \octaveCheck c'
  f
}

[image of music]

See also

Snippets: Pitches.

Internals Reference: RelativeOctaveCheck.


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