Node: First steps, Next: , Up: Tutorial



First steps

We start off by showing how very simple music is entered in LilyPond: you get a note simply by typing its note name, from a through g. So if you enter

     c d e f g a b
     

then the result looks like this:

[picture of music]

The length of a note is specified by adding a number, 1 for a whole note, 2 for a half note, and so on:

     a1 a2 a4 a16 a32
     

[picture of music]

If you do not specify a duration, the previous one is used:

     a4 a a2 a
     

[picture of music]

Rests are entered just like notes, but with the name "r":

          r2 r4 r8 r16
          

[picture of music]



Add a dot . after the duration to get a dotted note:

     a2. a4 a8. a16
     

[picture of music]

The meter (or time signature) can be set with the \time command:

     \time 3/4
     \time 6/8
     \time 4/4
     

[picture of music]

The clef can be set using the \clef command:

     \clef treble
     \clef bass
     \clef alto
     \clef tenor
     

[picture of music]

Notes and commands like \clef and \time , are enclosed in \notes {...}. This indicates that music (as opposed to lyrics) follows:

     \notes {
       \time 3/4
       \clef bass
       c2 e4 g2.
       f4 e d c2 r4
     }
     
Now the piece of music is almost ready to be printed. The final step is to combine the music with a printing command.

The printing command is the so-called \paper block:

     \paper { }
     

The \paper block is used to customize printing specifics. The customization commands go between { and }, but for now, we accept the defaults. The music and the \paper block are combined by enclosing them in \score { ... }, so the following is a complete and valid input file:

     \score {
       \notes {
         \time 3/4
         \clef bass
         c2 e4 g2.
         f4 e d c2 r4
       }
       \paper { }
     }
     

[picture of music]

In the rest of the tutorial we will often leave out \score and \paper for clarity. However, both must be present when feeding the file to LilyPond.

For more elaborate information on

entering pitches and durations
see Pitches and Durations.
Clefs
see Clef
Time signatures and other timing commands
see Time signature.

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

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