Node: Relative octaves, Next: , Up: Easier music entry



Relative octaves

Octaves are specified by adding ' and , to pitch names. When you copy existing music, it is easy to accidentally put a pitch in the wrong octave and hard to find such an error. The relative octave mode prevents these errors: a single error puts the rest of the piece off by one octave:

       \relative startpitch musicexpr
     

The octave of notes that appear in musicexpr are calculated as follows: If no octave changing marks are used, the basic interval between this and the last note is always taken to be a fourth or less (; this distance is determined without regarding alterations: a fisis following a ceses will be put above the ceses).

The octave changing marks ' and , can be added to raise or lower the pitch by an extra octave. Upon entering relative mode, an absolute starting pitch must be specified that will act as the predecessor of the first note of musicexpr.

Here is the relative mode shown in action:

       \relative c'' {
         b c d c b c bes a
       }
     

[picture of music]

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

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

[picture of music]

If the preceding item is a chord, the first note of the chord is used to determine the first note of the next chord:

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

[picture of music]

The pitch after the \relative contains a note name. To parse the pitch as a note name, you have to be in note mode, so there must be a surrounding \notes keyword (which is not shown here).

The relative conversion will not affect \transpose, \chords or \relative sections in its argument. If you want to use relative within transposed music, you must place an additional \relative inside the \transpose.


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

Report errors to <bug-lilypond@gnu.org>.