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}
13 \def\interexample{\par Produces the following:\par}
14 \def\preexample{\par\medskip}
15 \def\postexample{\par\medskip}
17 \emph{This document is not complete yet. It's just a brief blurb which
18 skimps some features of Mudela}
22 Mudela is a language for specifying music. LilyPond is a
23 program which converts such a specification into formatted sheet
24 music, or MIDI output.
26 Please note that some examples not only demonstrate features but also
27 some lurking bugs. If can't understand what is happening, it might
28 just be my (lack of) programming skills.
31 \begin[fragment,verbatim]{mudela}
36 Basics: the \verb+%+ introduces a comment. All music is inside a
37 \verb+\score+ block which represents one movement, ie one contiguous
38 block of music. Voices are grouped by \verb+{+ and \verb+}+ and
39 chords by \verb+<+ and \verb+>+.
41 \begin[verbatim]{mudela}
43 \melodic { % {...} is a voice
44 c'4 g'4 % c and g are pitches, 4 is the duration (quaver)
45 c''4 ''c4 % c' is 1 octave up, 'c 1 down.
46 <c'4 g'4> % <...> is a chord
51 The \verb+\octave+ command controls the default pitch (octave). If you
52 do not specify duration, the last one entered is used. The
53 \verb+\paper+ block contains parameters for spacing and dimensions.
55 \begin[verbatim]{mudela}
57 % twinkle twinkle little star
61 f4 f e e d [d8. e16] c2
64 \paper { linewidth = 5.\cm; }
68 A more complex example; The multi command controls at what level the
69 different components of a chord are interpreted. The LilyPond chord
70 is much more general than a traditional chord. Multiple voices on a
71 staff are entered as a chord of voices. A score is a chord of staffs,
74 \begin[verbatim]{mudela}
79 < \multi 1; { c2 c2 } { c'2 c'2 } >
80 < \multi 2; { \stem -1; c2 c2 } { \stem 1; c'2 c'2 } >
82 { \clef "bass"; c2 c2 }
83 { \meter 2/4;\bar "||";
84 \key fis cis gis; c'2 c'2 } >
87 < \multi 1; < \multi 3;
88 { \meter 2/4; \clef "violin"; c2 c2 }
89 { \meter 2/4; \clef "bass"; c2 c2 }
92 { \meter 2/4; \clef "violin"; c2 c2 }
93 { \meter 2/4; \clef "bass"; c2 c2 }
102 LilyPond is designed to handle complicated stuff
103 automatically. Expertise should be in the program, not in the user.
105 The following example shows how multiple voice on the same staff are
106 handled graciously (well, somewhat). If the noteheads of different
107 voices collide, they are moved horizontally. The same goes for the rests.
109 \begin[verbatim]{mudela}
112 { \octave c'; \stem -1;
113 c4 d e f g2~ g4 a [c8 d e f] c2| }
115 g4 f e g ~ g2 g2 c4 g4 g2 }
119 two_voice_steminvert = \melodic
121 { \octave c'; \stem 1;
122 % the f and g on 4th beat are exceptionally ugh.
129 three_voice = \melodic
133 { \hshift 1; \stem 1;
143 { \stem 1; g'8 f' e' d' c' b a g f e d c }
144 { \stem -1; r r r r r r r r r r r r }
148 < \multi2; r8 r8 r8 >
149 < \multi2; r8 r8 r8 r8 >
158 \melodic { \$two_voice \$two_voice_steminvert
159 \$three_voice \restsII }