Next: , Up: Tutorial



2.1 First steps

The first example demonstrates how to enter the most elementary piece of music, a scale. A note can be entered by typing its name, from a through g. So, if you enter

     c d e f g a b

the result looks like this

[image of music]

The duration of a note is specified by a number after the note name. 1 for a whole note, 2 for a half note, 4 for a quarter note and so on

     a1 a2 a4 a16 a32

[image of music]

If you do not specify a duration, the duration last entered is used; the duration of the first note defaults to a quarter

     a a8 a a2 a

[image of music]

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

     r2 r4 r8 r16

[image of music]



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

     a2. a4 a8. a16

[image of music]

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

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

[image of music]

The clef can be set using the \clef command

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

[image of music]

To recognize names like c and d as pitches, they have to be entered inside a so-called \notes block. This block is formed by enclosing notes and commands are enclosed in curly braces { ... } and adding the keyword \notes before the opening brace

     \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. Enclose the \notes block in a \score block

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

and the music will be converted to printable output.

[image of music]

In many examples in this manual, both \score and \notes and accompanying braces are left out for brevity. However, they 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
Rests
see Rests.
Time signatures and other timing commands
see Time signature.

Read comments on this page, or add one.

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

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