Dear LilyPonders,
here is the whole first chapter one more time, with all latest
corrections and suggestions incorporated. Further criticism is
nevertheless encouraged.
Manuel
LilyPond's
Beginners Guide
for the
Absolute Beginner
(Mac OS X version)
Chapter One.
Open a new LilyPond window.
Then type this inside:
{ c' d' e' f' g' a' b' c' ' }
Save the file and then select "Typeset file" from the "Compile" menu.
A small window will open, where you can follow the proceedings, and
then a ".pdf" document will appear, with this result:
(insert graphic here)
It is a little C-major scale. Let us consider it:
The so-called "curly braces"
{
and
}
are essential. You must always write your music inside such braces.
Also, LilyPond is "case sensitive", which means that in our little
example, "c" (that's lower case) is right, but "C" (that's upper
case) would be wrong.
LilyPond has certain pre-set values, called "defaults", which will
apply whenever you do not ask for something different. In our present
example, for instance: the treble clef, 4/4 time signature, quarter
notes (or "crotchets", for non-American English speakers).
You can, of course, change these and all other defaults; indeed you
can engrave contemporary notation, orchestral scores, do MIDI files,
and more. But all that lies further down the road. For the moment, we
will teach you how to engrave a simple melody.
First, we'll give you a very useful tool to input your notes, called
the "relative mode".
In our example, we have written each note with an octave
denomination: one apostrophe:
'
for the so-called "first octave", which is the octave immediately
above and including the middle c - that's the central c in the piano
keyboard - and two apostrophes:
''
for the "second octave", the one immediately above the first octave.
But now, using the "relative mode", you will save yourself a lot of
work. Erase what you wrote before in the LilyPond window and write
this instead:
\relative
{ c d e f g a b c }
Note that the \relative command comes before and outside the { } .
Also, be very precise in the way you write this and all other
commands: don't allow a space between the backslash and the word,
since for instance:
\ relative
will not work, and only
\relative
will be fine.
Save the file again, close the .pdf and select "Typeset file" from
the "Compile" menu. The result will be the same C-major scale:
(insert graphic here)
But now, with the
\relative
command, the first note is automatically engraved as close as
possible to the middle c and every further note will be engraved as
close as possible to the previous note. "As close as possible" means
calculating the smallest interval. Thus if you modify your input to
this:
\relative
{ e g c b g f d c }
(Don't forget to always save the file and close the previous .pdf
before compiling)
You will get this result:
(insert graphic here)
You can analyze the exercise and see that the first note e appears a
third above middle c rather than a sixth below; the same happens with
the following g, a third above in relation to the preceding e; then
comes the c that is a fourth above the g instead of a fifth below,
and so forth.
Now in this mode, when you add an apostrophe, it makes the note
appear one octave higher than it would have appeared without the
apostrophe. Two apostrophes make for two octaves, and so forth.
To make a note one octave lower than it would otherwise appear, add a
comma:
c,
or two or more for more octaves:
c,,,
See it here:
\relative
{ c' g e' d c c, d c }
(insert graphic here)
Good. Now let's see how to select the following:
Clefs
Time signatures
Keys major and minor
Rhythmic values
Sharps and flats
Double bars and repeat bars.
These are simple things to do. Write this example:
\relative
{
\clef treble
\key c \major
\time 4/4
c d e f g a b c }
The result is our first example of a C-major scale:
(insert graphic here)
but this time you see the way some defaults are set. Change them
easily, like this:
\relative
{
\clef alto
\key cis \minor
\time 2/2
c d e f g a b c }
This should look thus:
(insert graphic here)
Don't worry just yet about the naturals. We'll explain them when we
come to talk about keys.
You set the clef by naming the one you want: in the preceeding
example, we wrote "alto" instead of "treble". Other clefs are called:
tenor (C clef on the fourth line)
bass (F clef on the fourth line)
as well as
french (G clef on the first line)
soprano (C clef on the first line)
mezzosoprano (C clef on the second line)
baritone (C clef on the fifth line)
varbaritone (F clef on the third line)
subbass (F clef on the fifth line)
percussion (percussion clef)
tab (tablature clef)
and also "chiavette"-type clefs like
"G_8"
which is the one used for guitar music and modern tenor parts. And
there are more!
To set the key, proceed in this way:
\key (name of the tonic) \(major or minor)
For example:
\key g \minor
And similarly for the time signature, like this:
\time x/y
for example:
\time 6/8
Now for the rhythmic values.
You specify these values with a number after the name of the note:
"c1" will make a whole note (also called a semi-breve); "d8" an
eighth note (or quaver), etc.
Add full stops (called "periods" in American English) for dotted or
double dotted notes:
g4.
for a dotted quarter note,
a8..
for a double dotted eighth note, and so on.
Insert rests with the letter "r" and specify their duration with
numbers:
r4.
will be a dotted quarter rest.
Once a rhythmic value is entered it remains the same for all the
following notes or rests until you change it. Lets see this with an
example:
\relative
{c4 r8 e g4 c r8 g c r c,4 r}
(insert graphic here)
Analyze this and see how the rhythmic values are automatically repeated.
Working fine? Then let's go for sharps and flats
Just add
is
to the name of a note to make it a sharp, like this:
cis
dis
eis
fis
gis
ais
bis
and add
es
to the name of a note to make it a flat, like this:
ces
des
ees
fes
ges
aes
bes
Please note that this is not necessarily the way you are used to
naming the notes, just a quick, logical and easy way to input them,
similar to the German namig system (if you would prefer to use more
familiar names, see the section in the manual on "note names in other
languages").
"cisis" and "ceses" will give you double alterations. Get it?
Whatever key you have chosen, you must always input the exact name of
the note you wish to have printed. For example in the key of D-Major
you must type in "fis" and "cis" to get f-sharp and c-sharp,
otherwise a natural sign will be printed before the note. This is not
a disadvantage, as you will surely notice after a time.
Insert double bars and repeats like this:
\relative
{
\clef treble
\key c \major
\time 4/4
e f e d
\bar "|:"
b c d e
\bar ":|:"
f g a b
\bar ":|"
c b a g
\bar "||"
f e d c
\bar "|."
}
(insert graphic here)
And last but not least in our little first beginners' chapter, we'll
give you the tool for beginning your melodies with an anacrusis, also
known as "upbeat" or "pickup". This is the
\partial
command. If you need, say, an eight-note anacrusis, you type
\partial 8
For example:
\relative
{
\clef treble
\key c \major
\time 4/4
\partial 8
b8 c4 d e f g a b c
\bar "|."
}
(insert graphic here)
Just state the rhythmic value you need, including dots:
\relative
{
\clef treble
\key c \major
\time 4/4
\partial 4.
d8 b d c4 d e f g a b c
\bar "|."
}
(insert graphic here)
Now consider the following example:
\relative
{
\clef treble
\key c \major
\time 4/4
\partial 16*5
c16 d c b d c4 d e f g a b c
\bar "|."
}
(insert graphic here)
There is no rhythmic value equivalent to that anacrusis, so we used a
formula:
\partial x * y
where "x" stands for a rhythmic value - like "16" for a sixteenth
note or "semiquaver" and "y" stands for the quantity of those, like
"5" . The sign in between is an asterisk. Thus
\partial 16*5
will give you the preceding example's result. Change the values of
this formula to suit your needs. Remember that it doesn't matter how
the rhythmic value of the anacrusis is distributed among several notes:
\partial 2
is good for a half note, or two quarter notes, or two eighth notes
and a quarter note, or any other combination of rhythmic values
adding up to a half note.
You can now amuse yourself writing away melodies, trying things and
see how they look. Don't worry, if what you write is impossible and
does not compile, you will get an instructive error message in the
little "process log window" we mentioned at the beginning and no
printout, but you won't crash the program.
The exercises you have done so far should enable you to write any
simple melody. As you are surely aware, we have not said anything yet
about tuplets, lyrics, polyphony and many other things, which are
certainly no problem to do with this program. Indeed, if you wonder
whether you can do any imaginable thing with LilyPond, the answer is
very probably "YES!"
Look for ways to do more things in the other tutorials or in the next
chapters, if and when they are written. Any unsolved questions can be
directed to the mailing list, including an example of your problem.
Take great care where you put your { and } around your music, and
have fun!
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user