2 % this document should be run through the mudela-book script after lilypond
6 \documentclass{article}
8 \title{Mudela and LilyPond crash course}
9 \author{Han-Wen Nienhuys}
10 \date{October 20, 1997}
11 \def\file#1{{\texttt{#1}}}
15 \def\interexample{\par Produces the following:\par}
16 \def\preexample{\par\medskip}
17 \def\postexample{\par\medskip}
19 \emph{This document is not complete yet. It's just a brief blurb which
20 skims some features of Mudela}
24 This document describes various things, but let's first point out the
25 different parts of the package, and their names.
27 \item[Mudela] A language for defining music.
28 \item[LilyPond] A package (the only one existing :-) which can
29 read a mudela file and interpret it.
30 \item[Feta] A (Meta)Font of musical symbols. LilyPond uses it to
36 Let's start with a very simple example, we will enter ``twinkle
37 twinkle little star.'' We start with the most important part: the
40 Imagine being in a music-lesson, and that you made an error playing
41 ``twinkle twinkle''. Your teacher asks you to read out loud the
42 melody of the song, just to verify your eyesight. You would probably
45 A quarter note C, Another quarter note C, a quarter G, another one, etc.
48 Mudela tries to capture this verbal presentation of sheet music, in
49 the following way. The first line of twinkle twinkle is written in
56 The notes are entered with names (a, b, c) combined with numbers
57 (2,4). The names designate the pitches, the numbers the durations: 4
58 is a quarter note, 2 a half note, etc.
60 Now all we have to specify what should be done with the music. We
61 want a paper version, so we combine the music with a ``output this on
62 paper'' statement. These two are combined in ``score'' block. This
63 is the final result with its output. We add a comment (the line
64 starting with \verb+%+).
66 called \file{twinkle.ly}
80 there are a few things to note about this example:
82 The braces are grouping characters. In general, in mudela data entry
83 for a data section called ``foobar'' looks like this:
89 To see if it actually works, we run it through LilyPond. Invoke the
94 When LilyPond starts working it will produce various ``operator
95 pacification'' messages, which you can safely ignore for now. The run
96 should have left a file called \file{lelie.tex} in your working
97 directory. You can process that file with \TeX, and it will look like
110 As you can see, this is the song that we wanted, albeit a little
111 low-pitched. You would probably want a version of the song which has
112 all notes an octave higher. This can be done by adding a
113 \verb+\octave+ command to the source. This sets the default octave
114 for all notes. Another convenience is the default duration: if you do
115 not specify a duration with the notename, the last explicitly entered
116 is used. The improved version reads thus
119 \begin[verbatim]{mudela}
133 FIXME rewrite starting here.
135 \begin[verbatim]{mudela}
137 \melodic { % {...} is a voice
138 c'4 g'4 % c and g are pitches, 4 is the duration
139 % (crotchet/quarter note)
140 c''4 ''c4 % c' is 1 octave up, 'c 1 down.
141 <c'4 g'4> % <...> is a chord
147 \begin[fragment,verbatim]{mudela}
151 Basics: the \verb+%+ introduces a comment. All music is inside a
152 \verb+\score+ block which represents one movement, ie one contiguous
153 block of music. Voices are grouped by \verb+{+ and \verb+}+ and
154 chords by \verb+<+ and \verb+>+.
157 The \verb+\octave+ command controls the default pitch (octave). If you
158 do not specify duration, the last one entered is used. The
159 \verb+\paper+ block contains parameters for spacing and dimensions.
161 \begin[verbatim]{mudela}
163 % twinkle twinkle little star
167 f4 f e e d [d8. e16] c2
170 \paper { linewidth = 5.\cm; }
174 A more complex example; The multi command controls at what level the
175 different components of a chord are interpreted. The LilyPond chord
176 is much more general than a traditional chord. Multiple voices on a
177 staff are entered as a chord of voices. A score is a chord of staffs,
180 \begin[verbatim]{mudela}
185 \multi 1 < { c2 c2 } { c'2 c'2 } >
186 \multi 2 < { \stemdown c2 c2 } { \stemup c'2 c'2 } >
188 { \clef "bass"; c2 c2 }
189 { \meter 2/4;\bar "||";
190 \key fis cis gis; c'2 c'2 } >
194 { \meter 2/4; \clef "violin"; c2 c2 }
195 { \meter 2/4; \clef "bass"; c2 c2 }
198 { \meter 2/4; \clef "violin"; c2 c2 }
199 { \meter 2/4; \clef "bass"; c2 c2 }
208 LilyPond is designed to handle complicated stuff automatically.
209 Expertise should be in the program, not in the user.
211 The following example shows how multiple voices on the same staff are
212 handled graciously (well, somewhat). If the noteheads of different
213 voices collide, they are moved horizontally. Rests are moved
218 \begin[verbatim]{mudelaXX}
221 { \octave c'; \stemdown
222 c4 d e f g2~ g4 a [c8 d e f] c2| }
224 g4 f e g ~ g2 g2 c4 g4 g2 }
228 two_voice_steminvert = \melodic
230 { \octave c'; \stemup
231 % the f and g on 4th beat are exceptionally ugh.
238 three_voice = \melodic
242 { \property Voice.hshift = 1 \stemup
252 { \stemup g'8 f' e' d' c' b a g f e d c }
253 { \stemdown r r r r r r r r r r r r }
257 \multi 2 < r8 r8 r8 >
258 \multi 2 < r8 r8 r8 r8 >
267 \melodic { \$two_voice \$two_voice_steminvert
268 \$three_voice \restsII }