Next: , Previous: Relative octaves, Up: Pitches


6.1.7 Octave check

Octave checks make octave errors easier to correct: a note may be followed by =quotes which indicates what its absolute octave should be. In the following example,

\relative c'' { c='' b=' d,='' }

the d will generate a warning, because a d'' is expected (because b' to d'' is only a third), but a d' is found. In the output, the octave is corrected to be a d'' and the next note is calculated relative to d'' instead of d'.

There is also an octave check that produces no visible output. The syntax

\octave pitch

This checks that pitch (without quotes) yields pitch (with quotes) in \relative mode compared to the note given in the \relative command. If not, a warning is printed, and the octave is corrected. The pitch is not printed as a note.

In the example below, the first check passes without incident, since the e (in relative mode) is within a fifth of a'. However, the second check produces a warning, since the e is not within a fifth of b'. The warning message is printed, and the octave is adjusted so that the following notes are in the correct octave once again.

\relative c' {
  e
  \octave a'
  \octave b'
}

The octave of a note following an octave check is determined with respect to the note preceding it. In the next fragment, the last note is an a', above middle C. That means that the \octave check passes successfully, so the check could be deleted without changing the output of the piece.

     
     \relative c' {
       e
       \octave b
       a
     }

[image of music]



Next: , Previous: Relative octaves, Up: Pitches

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

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.

Other languages: French.