Next: , Previous: Adding titles, Up: Final touches


2.5.3 Absolute note names

So far we have always used \relative to define pitches. This is the easiest way to enter most music, but another way of defining pitches exists: absolute mode.

If you omit the \relative, LilyPond treats all pitches as absolute values. A c' will always mean middle C, a b will always mean the note one step below middle C, and a g, will always mean the note on the bottom staff of the bass clef.

     
     {
       \clef bass
       c' b g, g,
       g, f, f c'
     }

[image of music]

Here is a four-octave scale:

     
     {
       \clef bass
       c, d, e, f,
       g, a, b, c
       d e f g
       a b c' d'
       \clef treble
       e' f' g' a'
       b' c'' d'' e''
       f'' g'' a'' b''
       c'''1
     }

[image of music]

As you can see, writing a melody in the treble clef involves a lot of quote ' marks. Consider this fragment from Mozart:

     
     {
       \key a \major
       \time 6/8
       cis''8. d''16 cis''8 e''4 e''8
       b'8. cis''16 b'8 d''4 d''8
     }

[image of music]

All these quotes makes the input less readable and it is a source of errors. With \relative, the previous example is much easier to read:

     
     \relative c'' {
       \key a \major
       \time 6/8
       cis8. d16 cis8 e4 e8
       b8. cis16 b8 d4 d8
     }

[image of music]

If you make a mistake with an octave mark (' or ,) while working in \relative mode, it is very obvious – many notes will be in the wrong octave. When working in absolute mode, a single mistake will not be as visible, and will not be as easy to find.

However, absolute mode is useful for music which has large intervals, and is extremely useful for computer-generated LilyPond files.


Next: , Previous: Adding titles, Up: Final touches

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.