Relative octave entry

Absolute octave entry requires specifying the octave for every single note. Relative octave entry, in contrast, specifies each octave in relation to the last note: changing one note’s octave will affect all of the following notes.

Relative note mode has to be entered explicitly using the \relative command:

\relative startpitch musicexpr

In relative mode, each note is assumed to be as close to the previous note as possible. This means that the octave of each pitch inside musicexpr is calculated as follows:

Here is the relative mode shown in action:

\relative {
  \clef bass
  c d e f
  g a b c
  d e f g
}

[image of music]

Octave changing marks are used for intervals greater than a fourth:

\relative {
  c'' g c f,
  c' a, e'' c
}

[image of music]

A note sequence without a single octave mark can nevertheless span large intervals:

\relative {
  c f b e
  a d g c
}

[image of music]

When \relative blocks are nested, the innermost \relative block starts with its own reference pitch independently of the outer \relative.

\relative {
  c' d e f
  \relative {
    c'' d e f
  }
}

[image of music]

To use absolute mode inside of \relative, put the absolute music inside \fixed c { … } and the absolute pitches will not affect the octaves of the relative music:

\relative {
  c'4 \fixed c { f'' g'' } c |
  c4 \fixed c'' { f g } c
}

[image of music]

\relative has no effect on \chordmode blocks.

\new Staff {
  \relative c''' {
    \chordmode { c1 }
  }
  \chordmode { c1 }
}

[image of music]

\relative is not allowed inside of \chordmode blocks.

Music inside a \transpose block is absolute unless a \relative is included.

\relative {
  d' e
  \transpose f g {
    d e
    \relative {
      d' e
    }
  }
}

[image of music]

If the preceding item is a chord, the first note of the chord is used as the reference point for the octave placement of a following note or chord. Inside chords, the next note is always relative to the preceding one. Examine the next example carefully, paying attention to the c notes.

\relative {
  c'
  <c e g>
  <c' e g'>
  <c, e, g''>
}

[image of music]

As explained above, the octave of pitches is calculated only with the note names, regardless of any alterations. Therefore, an E-double-sharp following a B will be placed higher, while an F-double-flat will be placed lower. In other words, a double-augmented fourth is considered a smaller interval than a double-diminished fifth, regardless of the number of semitones that each interval contains.

\relative {
  c''2 fis
  c2 ges
  b2 eisis
  b2 feses
}

[image of music]

In complex situations, it is sometimes useful to get back to a certain pitch regardless of what happened before. This can be done using \resetRelativeOctave:

\relative {
  <<
    { c''2 d }
    \\
    { e,,2 f }
  >>
  \resetRelativeOctave c''
  c2
}

[image of music]

See also

Music Glossary: fifth, interval, Pitch names.

Notation Reference: Octave checks.

Snippets: Pitches.

Internals Reference: RelativeOctaveMusic.


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