Next: Working on text files, Previous: Compiling a file, Up: First steps
LilyPond will add some notation elements automatically. In the next example, we have only specified four pitches, but LilyPond has added a clef, time signature, and rhythms.
{ c' e' g' e' }
This behavior may be altered, but in most cases these automatic values are useful.
The easiest way to enter notes is by using \relative
mode. In
this mode, the interval between the previous note and the
current note is assumed to be within a fourth. We begin by
entering the most elementary piece of music, a scale.
\relative c' { c d e f g a b c }
The initial note is middle C. Each successive note is within a fourth of the previous note – in other words, the first `c' is the closest C to middle C. This is followed by the closest D to the previous note. We can create melodies which have larger intervals:
\relative c' { d f a g c b f d }
As you may notice, this example does not start on middle C. The first note – the `d' – is the closest D to middle C.
To add intervals that are larger than a fourth, we can raise the octave
by adding a single quote '
(or apostrophe) to the note name. We can
lower the octave by adding a comma ,
to the note name.
\relative c'' { a a, c' f, g g'' a,, f' }
To change a note by two (or more!) octaves, we use multiple ''
or
,,
– but be careful that you use two single quotes ''
and
not one double quote "
! The initial value in
\relative c'
may also be modified like this.
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. Beams are added automatically.
\relative c'' { a1 a2 a4 a8 a a16 a a a a32 a a a a64 a a a a a a a a2 }
If you do not specify a duration, the previous duration is used for the next note. The duration of the first note defaults to a quarter.
To create dotted notes, add a dot `.' to the duration number.
\relative c'' { a a a4. a8 a8. a16 a a8. a8 a4. }
A rest is entered just like a note with the name `r':
\relative c'' { a r r2 r8 a r4 r4. r8 }
The time signature) can be set with the \time
command:
\relative c'' { \time 3/4 a4 a a \time 6/8 a4. a \time 4/4 a4 a a a }
The clef can be set using the \clef
command:
\relative c' { \clef treble c1 \clef alto c1 \clef tenor c1 \clef bass c1 }
Here is a small example showing all these elements together:
\relative c, { \time 3/4 \clef bass c2 e8 c' g'2. f4 e d c4 c, r4 }
- Entering pitches and durations
- see Pitches and Durations.
- Rests
- see Rests.
- Time signatures and other timing commands
- see Time signature.
- Clefs
- see Clef.
Next: Working on text files, Previous: Compiling a file, Up: First steps
This page is for LilyPond-2.10.33 (stable-branch).
Other languages: French.