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