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