|
|
GNU LilyPondWelcome to the home of the GNU Music Typesetter |
||||||||||
|
Node:The first real tune, Next:Lyrics and chords, Previous:Running LilyPond, Up:Tutorial The first real tuneThe rest of this tutorial will demonstrate how to use Lilypond by presenting examples of input along with resulting output. We will use English terms for notation. In case you are not familiar with those, you may consult the glossary that is distributed with LilyPond. The examples discussed are included in the distribution, in the
subdirectory To demonstrate what LilyPond input looks like, we start off with a
full-fledged, yet simple example. It is a convoluted version
of the famous minuet in J. S. Bach's Klavierbüchlein. The file
is included in the distribution as % all text after a percent sign is a comment
% and is ignored by LilyPond
\include "paper16.ly"
\score {
\notes
\relative c'' \sequential {
\time 3/4
\key g \major
\repeat "volta" 2 {
d4 g,8 a b c d4 g, g |
e'4 c8 d e fis g4 g, g |
c4 d8( )c b a( )b4 c8 b a g |
a4 [b8 a] [g fis] g2. |
}
b'4 g8 a b g
a4 d,8 e fis d |
g4 e8 fis g d cis4 b8 cis a4 |
a8-. b-. cis-. d-. e-. fis-.
g4 fis e |
fis a, r8 cis8
d2.-\fermata
\bar "|."
}
\paper {
% standard settings are too big and wide for a book
indent = 1.0 \cm
linewidth = 15.0 \cm
}
}
We will analyse the input, line by line. % all text after a percent sign is a comment
% and is ignored by LilyPond
Percent signs introduce comments: everything after a percent sign is
ignored. You can use this to write down mental notes to yourself. You
can also make longer comments by enclosing text in %{ and
%}.
\include "paper16.ly"
By default, LilyPond will typeset the music in a size such that each
staff is 20 point (0.7 cm, or 0.27 inch) high. We want smaller output
(16 point staff height), so we must import the settings for that size,
which is done here.
\score {
Music is printed by combining a piece of music with directions for
outputting it. This combination is formed in the \score block.
\notes
Prepare LilyPond for accepting notes.
\relative c''
Even though a piece of music often spans a range of several octaves, it mostly moves in small intervals. LilyPond has a special entry mode to save typing in this situation. In this "relative" octave mode, octaves of notes without quotes are chosen such that a note is as close as possible (graphically, on the staff) to the preceding note. If you add a high-quote an extra octave is added. A lowered quote (a comma) will subtract an extra octave. Because the first note has no predecessor, you have to give the (absolute) pitch of the note to start with.
\sequential {
What follows is sequential music, i.e.,
notes that are to be played and printed after each other.
\time 3/4
Set (or change) the time signature of the current piece: a 3/4 sign is
printed. The time signature setting is also used to generate bar lines
at the right spots.
\key g \major
Set (or change) the current key signature to G-major. Although in this
example, the \key command happened to be entered after the
\time command, in the output the time signature will be printed
after the key signature; LilyPond knows about music typesetting
conventions.
\repeat "volta" 2
The following piece of music is played twice. The first argument
indicates the type of repeat. In this case, "volta" means that
prima volta/secunda volta brackets are used for the alternative
endings--if there were any.
{
The subject of the repeat is again sequential music. Since
\sequential is such a common construct, a shorthand is provided:
just leave off \sequential, and the result is the same.
d4 g,8
Two notes. The first note is a quarter note with relative pitch
d. The relative music was started with a c'', so the real
pitch of this note is d''. The duration of a note is designated
by a number; the 4 here represents a quarter note.
The second note is an eight note with relative pitch
a b
Two more notes, with pitch a and b. Because their
duration is the same as the g,8, there is no need to enter the
duration, but you may enter it anyway, i.e., a4 b4
d4 g, g |
Three more notes. The | character is a "bar check". LilyPond
will verify that bar checks are found at the start of a measure. This can
help you track down typing errors.
c8 d e fis
So far, no notes were chromatically altered. Here is the first one that
is: fis. LilyPond by default uses Dutch2 note names, and "Fis" is the Dutch note name for "F
sharp". However, there is no sharp sign in the output. The program
keeps track of key signatures, and will only print accidentals if they
are needed.
For groups of eighth notes and shorter, LilyPond can determine how the notes should form a beam. In this case, the 4 eights are automatically printed as a beam.
c4 d8( )c b a( )b4 c8 b a g |
The beginning and ending notes of a slur are marked with parentheses,
( and ) for start and end respectively. The line above
indicates two slurs. These slur markers (parentheses) are entered
between the slurred notes.
a4 [b8 a] [g fis]
Automatic beaming can be overridden by inserting beam marks, [
and ]. These beam markers (brackets) are put around the notes
you want beamed.
g2. |
A period adds a dot to the note.
}
The end of the sequential music to be repeated. LilyPond will typeset a
repeat bar.
cis'4 b8 cis a4 |
Accidentals are printed whenever necessary: the first C sharp of the bar
will be printed with an accidental, the second one without.
a8-. b-. cis-. d-. e-. fis-.
You can enter articulation signs either in a verbose form or using a
shorthand. Here we demonstrate the shorthand: it is formed by a dash
and the character for the articulation to use, e.g. -. for
staccato as shown above.
fis a, r8 cis8
Rests are denoted by the special note name
d2.-\fermata
All articulations have a verbose form, like \fermata. The
command \fermata is not part of the core of the language, but it
is a shorthand for a more complicated description of a fermata symbol.
\fermata names that description and is therefore called an
identifier.
\bar "|."
}
Here the music ends. LilyPond does not automatically typeset an end
bar, we must explicitly request one, using "|.".
\paper {
% standard settings are too big and wide for a book
indent = 1.0\cm
linewidth = 15.0\cm
}
The \paper block specifies how entered music should be converted
to notation output. Most of the details of the conversion (font sizes,
dimensions, etc.) have been taken care of, but to fit the output in this
document, it has to be narrower. We do this by setting the line width
to 14 centimeters (approximately 5.5 inches).
}
The last brace ends the \score block.
Footnotes
|
||||||||||
|
Go back to index of LilyPond.
Please send GNU LilyPond questions and comments to lilypond-user@gnu.org. Please send comments on these web pages to lilypond@packages.debian.org Copyright (c) 1997--2001 Han-Wen Nienhuys and Jan Nieuwenhuizen. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. |
|||||||||||
This page was built from LilyPond-1.4.12 (stable-branch) by