]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/mudela-course.doc
release: 0.0.76
[lilypond.git] / Documentation / mudela-course.doc
1 % -*-LaTeX-*-
2 \documentclass{article}
3 \usepackage{a4wide}
4 \title{Mudela and LilyPond crash course}
5 \author{Han-Wen Nienhuys}
6
7 \begin{document}
8 \maketitle
9 \def\interexample{\par Produces the following:\par}
10 \def\preexample{\par\medskip}
11 \def\postexample{\par\medskip}
12
13
14 \section{Overview}
15 Mudela is a language for specifying music. LilyPond is a
16 program which converts such a specification into formatted  sheet
17 music, or MIDI output.
18
19 Please note that some examples not only demonstrate features but also
20 some lurking bugs. If can't understand what is happening, it might
21 just be my (lack of) programming skills.
22
23
24 \begin[fragment,verbatim]{mudela}
25   { c4 e4 g4 }
26 \end{mudela}
27
28
29 Basics: the \verb+%+ introduces a comment. All music is inside a
30 \verb+\score+ block which represents one movement, ie one contiguous
31 block of music.  Voices are grouped by \verb+{+ and \verb+}+ and
32 chords by \verb+<+ and \verb+>+.
33
34 \begin[verbatim]{mudela}
35 \score {
36         \melodic {      % { means voice
37         c'4 g'4         % 4 means quaver, 1 beat in 4/4 meter
38         c''4 ''c4       % c' is 1 octave up, 'c 1 down.
39         <c'4 g'4>       % <> means a chord
40         }
41
42 \end{mudela}
43
44 The \verb+\octave+ command controls the default pitch (octave). If you
45 do not specify duration, the last one entered is used.  The
46 \verb+\paper+ block contains parameters for spacing and dimensions.
47
48 \begin[verbatim]{mudela}
49 \score {
50         % twinkle twinkle little star
51         \melodic { 
52                 \octave c';
53                 c4 c g g a a g2
54                 f4 f e e d [d8. e16] c2
55                 
56         }
57         \paper { linewidth = 5.\cm; }
58 }
59 \end{mudela}
60
61 A more complex example; The multi command controls at what level the
62 different components of a chord are interpreted.  The LilyPond chord
63 is much more general than a traditional chord.  Multiple voices on a
64 staff are entered as a chord of voices.  A score is a chord of staffs,
65 etc.
66
67 \begin[verbatim]{mudela}
68         
69 \score{
70   \melodic 
71     { \octave c'; c4 c4 
72       < \multi 1;  { c2 c2 } { c'2 c'2 } > 
73       < \multi 2;  { \stem -1; c2 c2 } { \stem 1; c'2 c'2 } > 
74       < \multi 3;
75         { \clef "bass"; c2 c2 }
76         { \meter 2/4;\bar "||";
77           \key fis cis gis; c'2 c'2 } > 
78          c2 c1 
79       c1 c1
80       < \multi 1; < \multi 3; 
81         { \meter 2/4; \clef "violin"; c2 c2 }
82         { \meter 2/4; \clef "bass"; c2 c2 }
83       >
84       < \multi 3; 
85         { \meter 2/4; \clef "violin"; c2 c2 }
86         { \meter 2/4; \clef "bass"; c2 c2 }
87       >
88       >
89     }
90 }
91
92 \end{mudela}
93
94
95 LilyPond is designed to handle complicated stuff
96 automatically. Expertise should be in the program, not in the user.
97
98 The following example shows how multiple voice  on the same staff are
99 handled graciously (well, somewhat). If the noteheads of different
100 voices collide, they are moved horizontally. The same goes for the rests. 
101
102 \begin[verbatim]{mudela}
103 two_voice = \melodic 
104         < \multi 2; 
105           {     \octave c'; \stem -1;
106                 c4 d e f g2~  g4 a [c8 d e f] c2| }
107           { \stem 1;
108                 g4 f e g ~ g2 g2  c4 g4 g2 } 
109
110         >
111
112 two_voice_steminvert = \melodic 
113         < \multi 2;  
114           {     \octave c'; \stem 1;
115 % the f and g on 4th beat are exceptionally ugh.
116                 c4 d e f g2 g4 a | }
117           { \stem -1;
118                 g4 f e g  g2 g2 } 
119
120         >
121
122 three_voice = \melodic 
123         < \multi 2;
124         { \stem 1; 
125                 g4 f e f g a g2 }
126         { \hshift 1; \stem 1; 
127                 e2  e2  e2  e2 }
128         { \stem -1;
129                 c4 d e d c d es }
130         >
131
132
133 restsII = \melodic {
134         \octave c'; 
135                         < \multi2;  
136                                 { \stem 1;  g'8 f' e' d' c' b a g f e d c }
137                                 { \stem -1; r  r  r  r  r  r r r r r r r }
138                         >
139                         r8 r4
140                         < \multi2;  r8 r8 >
141                         < \multi2;  r8 r8 r8 >
142                         < \multi2;  r8 r8 r8 r8 >
143                         < \multi2;  r r >
144                         < \multi2;  r r r >
145                         \stem 1;
146                         [c''8 r8 c''8 c''8]
147                         [c8 r8 c8 c8]
148 }
149
150 \score{
151         \melodic {  \$two_voice  \$two_voice_steminvert 
152                         \$three_voice  \restsII }
153 }
154
155 \end{mudela}
156
157 \end{document}