3 % this document should be run through the mudela-book script after lilypond
4 % has been installed. The rules have been precooked into the
5 % Documentation/Rules.make file; do
7 % make out/introduction.dvi
11 % mudela-book --outdir=out/ --outname=introduction.mudtex introduction.doc
12 % latex '\nonstopmode \input out/introduction.mudtex'
15 \documentclass{article}
17 \title{Introduction to GNU LilyPond}
18 \author{Jan Nieuwenhuizen}
21 \def\file#1{\verb+#1+}
23 % ugh: trick to get examples not generate par
25 \def\mudelapaperlinewidth{-28.452756}%
26 \def\mudelapaperindent{28.452756}%
27 \def\mudelapaperrulethickness{0.400000}%
28 \def\mudelapaperbarsize{16.000000}%
29 \def\mudelapaperinterline{4.000000}%
30 \def\mudelapapernotewidth{5.930000}%
31 \def\mudelapaperwholewidth{8.640000}%
32 \def\mudelapaperunitspace{22.000000}%
33 \def\mudelapaperbasicspace{4.000000}%
34 \def\mudelapapergeometric{0.000000}%
35 \def\mudelapaperarithmetic_basicspace{2.000000}%
36 \def\mudelapaperarithmetic_multiplier{4.800000}%
37 \def\mudelapaperinterbeam{3.140000}%
38 \def\mudelapapergourlay_energybound{100000.000000}%
39 \def\mudelapapergourlay_maxmeasures{14.000000}%
41 % \def\exampleheight{2\mudelapaperbarsize pt}
42 \def\exampleheight{2cm}
44 % ful of pars, needs the above
48 \def\musixsixteendefs{}
51 \def\turnOnPostScript{}
59 %\def\interexample{\hskip15mm$\Longrightarrow$\hskip15mm}
60 %\def\interexample{\hbox to10mm{\hfill\hbox to0pt{\hss\vbox to\exampleheight{\vss$\Longrightarrow$\vss}\hss}\hfill}}
63 \def\postexample{\par\medskip}
65 \def\file#1{{\texttt{#1}}}
66 \setcounter{secnumdepth}{-1}
68 \emph{\Large ***Under construction***}
70 \section{Introduction}
71 This document should provide a gentle introduction to
72 LilyPond's input language, Mudela.
73 For completeness and nifty features see
76 \file{lily/parser.y}, \file{lily/lexer.l}.
77 By tradition, Mudela files have the extension \file{.ly}.
79 Mudela is an ascii script language
80 that is especially designed
81 to be easy to read and write.
82 In the following sections
83 the basic elements of Mudela are presented
84 in a series of simple examples.
86 a verbatim snippet of Mudela%
87 % a snippet of Mudela as it's typed-in%
89 In an effort not to bore you too much with details,
90 we leave-out some red tape
91 that's needed for a valid piece of Mudela.
92 Therefore, before you try-out any of the examples,
93 be sure to read the section `A complete example'.}
95 and the resulting fragment of music on the right
96 as it was produced by LilyPond.
100 Let's start with a single note, a quarter C
102 \begin[fragment,verbatim,center]{mudela}
106 Now that was easy and entering a scale is not much harder
108 %\subsection{Pitches}
110 \begin[fragment,verbatim,center]{mudela}
114 % \subsection{Durations}
116 However, having only quarter notes may get a bit dull.
117 Durations are entered as their reciproce values
118 % a1 a2 a4 a a8 a a16 a a32 a a64 a a a a
119 \begin[fragment,verbatim,center]{mudela}
120 a1 a2 a4 a a8 a a16 a32 a64
122 note that you only have to specify
123 the duration when it changes:
124 Lily assumes a note has the same duration as the previous one.
126 Now we can already write a little tune
127 \begin[fragment,verbatim,center]{mudela}
128 c d e c | c d e c | e f g2
130 As you'll probably have guessed,
131 the vertical bar (pipe) \verb+|+ may be used to mark
134 In the scale shown above
135 we left-out the last c note of the next octave.
136 Postfixing the pitch with a quote \verb+'+
137 produces a note by one octave higher
138 \begin[fragment,verbatim,center]{mudela}
142 Prefixing the pitch with a quote \verb+'+
143 produces a note by one octave lower
144 \begin[fragment,verbatim,center]{mudela}
148 \section{Slurs and Ties}
150 A tie connects two adjacent noteheads
152 \begin[fragment,verbatim,center]{mudela}
156 Whereas a slur rather connects `chords',
157 and tries to avoid crossing stems
159 \begin[fragment,verbatim,center]{mudela}
163 And of course, such a (legato) slur can span several notes
164 \begin[fragment,verbatim,center]{mudela}
168 \section{Beams and Plets}
171 \begin[fragment,verbatim,center]{mudela}
175 Here's a beamed triplet
176 \begin[fragment,verbatim,center]{mudela}
180 a triplet without a beam
181 \begin[fragment,verbatim,center]{mudela}
186 \begin[fragment,verbatim,center]{mudela}
191 \begin[fragment,verbatim,center]{mudela}
195 \begin[fragment,verbatim,center]{mudela}
201 Lily has predefined sets of notenames
202 for various languages%
203 \footnote{These are Dutch, English, German, Italian and Swedish.
204 Simply include the language specific init file \file{<language.ly>}.}.
205 The default set are the ones we like best are the Dutch notenames.
207 A sharp is formed by adding \verb+is+
208 \begin[fragment,verbatim,center]{mudela}
209 cis dis eis fis gis ais bis
212 and a flat is formed by adding \verb+es+%
213 %\footnote{Exceptions: \verb+es+ and \verb+as+.}
214 \footnote{Exceptions: {\tt es} and {\tt as}.}
215 \begin[fragment,verbatim,center]{mudela}
216 ces des es fes ges as bes
219 With the obvious names for double sharps
220 \begin[fragment,verbatim,center]{mudela}
221 cisis disis eisis fisis gisis aisis bisis
225 \begin[fragment,verbatim,center]{mudela}
226 ceses deses eses feses geses ases beses
230 There are two special `notenames', the rest
231 \begin[fragment,verbatim,center]{mudela}
236 \begin[fragment,verbatim,center]{mudela}
237 a2 s-"diminuendo" | a
243 \begin[fragment,verbatim,center]{mudela}
248 \begin[fragment,verbatim,center]{mudela}
249 \clef "violin"; f' e' \clef "alto"; d' c'
252 \begin[fragment,verbatim,center]{mudela}
256 \begin[fragment,verbatim,center]{mudela}
258 'g 'a 'b cis d e fis g'
260 Note how Mudela allows you to
261 convey a musical message
262 rather than forces you to produce a list of typesetting commands.
263 If the music a \verb+cis+, you type a \verb+cis+.
264 Depending on the key and context of the note
265 Lily will determine what accidentals to typeset.
267 A reminder accidental can be forced by
268 using an exclamation mark \verb+!+
269 on a pitch a reminder accidental
270 \begin[fragment,verbatim,center]{mudela}
271 cis d e cis | c! d e c |
274 \begin[fragment,verbatim,center]{mudela}
276 \bar "|:"; c c \bar ":|:"; c c \bar ":|"; c c \bar "|.";
281 Staccato may be abbreviated
282 \begin[fragment,verbatim,center]{mudela}
287 \begin[fragment,verbatim,center]{mudela}
292 \begin[fragment,verbatim,center]{mudela}
299 \begin[fragment,verbatim,center]{mudela}
303 \begin[fragment,verbatim,center]{mudela}
307 \begin[fragment,verbatim,center]{mudela}
311 Dynamics from pianississimo upto mezzopiano
312 \begin[fragment,verbatim,center]{mudela}
316 from fortississimo downto mezzoforte
317 \begin[fragment,verbatim,center]{mudela}
321 sforzando, sforzato and rinforzato
324 \begin[fragment,verbatim,center]{mudela}
329 \begin[fragment,verbatim,center]{mudela}
330 [e8-1 c'-5 g-3 f-2] a''-\flageolet
334 \begin[fragment,verbatim,center]{mudela}
339 \begin[fragment,verbatim,center]{mudela}
340 \clef "bass"; \octave c;
341 'b4.-\lheel [cis8-\ltoe dis8-\rtoe e8-\rheel]
344 \section{Chords and Voices}
346 Here's a simple chord
347 \begin[fragment,verbatim,center]{mudela}
352 \begin[fragment,verbatim,center]{mudela}
361 \begin[fragment,verbatim,center]{mudela}
363 { \voiceone c g c g }
364 { \voicetwo 'c2 'g2 }
369 \section{A complete example}
372 A Mudela file needs some red tape
374 \begin[verbatim,center]{mudela}
387 \begin[verbatim,center]{mudela}
410 Check-out this handy little script
411 that not only may save you quite some keystrokes,
412 but produces titles and takes care of
413 margins and (hopefully) papersizes.
414 See \file{ly2dvi (1)}.