]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/mudela-course.doc
release: 0.1.7
[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 \emph{This document is not complete yet. It's just a brief blurb which
18   skimps some features of Mudela}
19
20
21 \section{Overview}
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.
25
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.
29
30
31 \begin[fragment,verbatim]{mudela}
32   { c4 e4 g4 }
33 \end{mudela}
34
35
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+>+.
40
41 \begin[verbatim]{mudela}
42 \score {
43         \melodic {      % {...} is a voice
44         c'4 g'4         % c and g are pitches, 4 is the duration
45                         % (crotchet/quarter note)
46         c''4 ''c4       % c' is 1 octave up, 'c 1 down.
47         <c'4 g'4>       % <...> is a chord
48         }
49
50 \end{mudela}
51
52 The \verb+\octave+ command controls the default pitch (octave). If you
53 do not specify duration, the last one entered is used.  The
54 \verb+\paper+ block contains parameters for spacing and dimensions.
55
56 \begin[verbatim]{mudela}
57 \score {
58         % twinkle twinkle little star
59         \melodic { 
60                 \octave c';
61                 c4 c g g a a g2
62                 f4 f e e d [d8. e16] c2
63                 
64         }
65         \paper { linewidth = 5.\cm; }
66 }
67 \end{mudela}
68
69 A more complex example; The multi command controls at what level the
70 different components of a chord are interpreted.  The LilyPond chord
71 is much more general than a traditional chord.  Multiple voices on a
72 staff are entered as a chord of voices.  A score is a chord of staffs,
73 etc.
74
75 \begin[verbatim]{mudela}
76         
77 \score{
78   \melodic 
79     { \octave c'; c4 c4 
80       < \multi 1;  { c2 c2 } { c'2 c'2 } > 
81       < \multi 2;  { \stem -1; c2 c2 } { \stem 1; c'2 c'2 } > 
82       < \multi 3;
83         { \clef "bass"; c2 c2 }
84         { \meter 2/4;\bar "||";
85           \key fis cis gis; c'2 c'2 } > 
86          c2 c1 
87       c1 c1
88       < \multi 1; < \multi 3; 
89         { \meter 2/4; \clef "violin"; c2 c2 }
90         { \meter 2/4; \clef "bass"; c2 c2 }
91       >
92       < \multi 3; 
93         { \meter 2/4; \clef "violin"; c2 c2 }
94         { \meter 2/4; \clef "bass"; c2 c2 }
95       >
96       >
97     }
98 }
99
100 \end{mudela}
101
102
103 LilyPond is designed to handle complicated stuff
104 automatically. Expertise should be in the program, not in the user.
105
106 The following example shows how multiple voice  on the same staff are
107 handled graciously (well, somewhat). If the noteheads of different
108 voices collide, they are moved horizontally. The same goes for the rests. 
109
110 \begin[verbatim]{mudela}
111 two_voice = \melodic 
112         < \multi 2; 
113           {     \octave c'; \stem -1;
114                 c4 d e f g2~  g4 a [c8 d e f] c2| }
115           { \stem 1;
116                 g4 f e g ~ g2 g2  c4 g4 g2 } 
117
118         >
119
120 two_voice_steminvert = \melodic 
121         < \multi 2;  
122           {     \octave c'; \stem 1;
123 % the f and g on 4th beat are exceptionally ugh.
124                 c4 d e f g2 g4 a | }
125           { \stem -1;
126                 g4 f e g  g2 g2 } 
127
128         >
129
130 three_voice = \melodic 
131         < \multi 2;
132         { \stem 1; 
133                 g4 f e f g a g2 }
134         { \hshift 1; \stem 1; 
135                 e2  e2  e2  e2 }
136         { \stem -1;
137                 c4 d e d c d es }
138         >
139
140
141 restsII = \melodic {
142         \octave c'; 
143                         < \multi2;  
144                                 { \stem 1;  g'8 f' e' d' c' b a g f e d c }
145                                 { \stem -1; r  r  r  r  r  r r r r r r r }
146                         >
147                         r8 r4
148                         < \multi2;  r8 r8 >
149                         < \multi2;  r8 r8 r8 >
150                         < \multi2;  r8 r8 r8 r8 >
151                         < \multi2;  r r >
152                         < \multi2;  r r r >
153                         \stem 1;
154                         [c''8 r8 c''8 c''8]
155                         [c8 r8 c8 c8]
156 }
157
158 \score{
159         \melodic {  \$two_voice  \$two_voice_steminvert 
160                         \$three_voice  \restsII }
161 }
162
163 \end{mudela}
164
165 \end{document}