]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/toet.itely
patch::: 1.3.152.jcn1
[lilypond.git] / Documentation / user / toet.itely
1 @c -*-texinfo-*-
2
3 @c TODO: LilyPond Lilypond lilypond
4
5 @node Toet
6 @chapter Toet
7
8 The music is described in a text file, using a simple music language.
9 LilyPond reads that text file and generates music that you can print or
10 view.
11
12 Therefore, creating music notation with LilyPond is done in two steps.
13 Using a text editor, you write down the notes to print.  Then, you run
14 LilyPond to get your printed output.
15
16
17 This tutorial starts with a small introduction to the LilyPond music
18 language.  After this first contact, we will show you how to produce
19 printed output; you should then be able to create your first sheets of
20 music.
21
22 The tutorial continues with a bit more elaborate example of real music.
23 This piece introduces and explains some finer details of LilyPond.
24 Then, a number of more complex examples follow, that will help you to
25 produce most complex music with LilyPond.
26
27
28 @menu
29 * Music language of LilyPond::  First contact
30 * Running LilyPond toet::       
31 @end menu
32
33
34
35 @node Music language of LilyPond
36 @section Music language of LilyPond
37
38 This section shows how easy making music with LilyPond actually is.  If
39 you have not used LilyPond before, this section is for you.
40
41
42 You get a simple note by typing its name, from @code{a} through @code{g}:
43
44 @lilypond[verbatim, relative 1]
45 a b c d e f g
46 @end lilypond
47
48 @separate
49
50 A are sharp is made by adding @code{is}, a flat by adding @code{es}:
51
52 @lilypond[verbatim, relative 0]
53 fis aes cisis beses
54 @end lilypond
55
56 @separate
57
58 The length of a note is specified by adding a number, @code{1} for a
59 whole note, @code{2} for a halve note:
60
61 @lilypond[verbatim, relative 1]
62 a1 a2 a8 a4 a16 a8. a16
63 @end lilypond
64
65 @separate
66
67 Adding a high quote @code{'}, raises the pitch by one octave, adding a
68 ``low quote'' @code{,} (a comma), lowers the pitch one octave:
69
70 @lilypond[verbatim, relative 1]
71 c c' c,,
72 @end lilypond
73
74 @separate
75
76 If you type no octaviation quotes, LilyPond chooses the note that is
77 closest to the previous one, which is often just the one you need.  For
78 example, @code{c f} goes up, and @code{c g} goes down:
79
80 @lilypond[verbatim, relative 1]
81 c f c g c
82 @end lilypond
83
84 @separate
85
86 You can make a large interval by adding octaviation quotes.  For example,
87 @code{c f,} goes down, and @code{c g'} goes up:
88
89 @lilypond[verbatim, relative 1]
90 c f, f c' c g' c, 
91 @end lilypond
92
93 @separate
94
95 To get a rest you use note name @code{r}, to skip a note use note name
96 @code{s}:
97
98 @lilypond[verbatim, relative 1]
99 r2 s4 r4
100 @end lilypond
101
102 @separate
103
104 The meter can be specified using @code{\time}:
105
106 @c \time -> \meter ?
107 @lilypond[verbatim, relative 1]
108 \time 3/4 c c c | R1 * 3/4
109 @end lilypond
110
111 @separate
112
113 The key is specified using @code{\key}:
114
115 @lilypond[verbatim, relative 0]
116 \key f \major es as bes
117 @end lilypond
118
119 @separate
120
121 Slurs are printed using parenthesis @code{()}, for phrasing slurs use
122 @code{\(} and @code{\)}.  You get a tie using @code{~}:
123
124 @lilypond[verbatim, relative 1]
125 c\( ( ) d  ~ d \) c
126 @end lilypond
127
128 @separate
129
130 A chord is made using angle brackets @code{<} and @code{>}:
131
132 @lilypond[verbatim, relative 1]
133 \oneVoice <a c> <b d> <c e>
134 @end lilypond
135
136 @separate
137
138 suddenly lilypond bit really difficult:
139 [explain about score -> \score and \notes]
140
141 long chords; simultaneous music
142 @lilypond[verbatim]
143 \paper { linewidth = -1.0 }
144 \score {
145   \context Staff \notes \relative c'' <
146     { \voiceOne a b c }
147     { \voiceTwo c d e }
148   >
149 }
150 @end lilypond
151
152 @separate
153
154 @lilypond[verbatim]
155 \paper { linewidth = -1.0 }
156 \score {
157   \context GrandStaff \notes \relative c' <
158     \context Staff=one { a' b c }
159     \context Staff=two { \clef bass c,, d e }
160   >
161 }
162 @end lilypond
163
164
165 @node Running LilyPond toet
166 @section Running LilyPond toet
167
168 This section shows how to view and print music with LilyPond.  If you
169 want to test your setup of LilyPond, or try to run an example file
170 yourself, then read this section.
171
172 The first step is to create an text file with some music.  Using your
173 favorite text-editor, create @file{test.ly} containing
174
175 @ignore
176
177 NOTE: if you're reading this, ie, the Texinfo source itself, test.ly
178 should of course contain:
179
180    \score{
181      \notes { c'4 e' g' }
182    }
183
184 @end ignore
185
186 @example
187 \score @{
188   \notes @{ c'4 e' g' @}
189 @} 
190 @end example
191
192 @unnumberedsubsec Running LilyPond on Unix
193 @cindex Unix, Running lilypond on
194 @cindex ly2dvi
195
196 To run LilyPond, you invoke ly2dvi to compile your LilyPond source file:
197
198 @quotation
199 @example
200 ly2dvi -P test.ly
201 @end example
202 @end quotation
203
204 You will see the following on your screen:
205
206 @quotation
207 @example
208 GNU LilyPond 1.4.0
209 Now processing: `/home/fred/ly/test.ly'
210 Parsing...
211 Interpreting music...[1]
212  @emph{ ... some more text ... }
213 PS output to test.ps...
214 DVI output to test.dvi...
215 @end example
216 @end quotation
217
218 The results are a ``DeVice Independent'' file
219 (@file{test.dvi}) and a PostScript file (@file{test.ps}).
220
221 @cindex DVI file
222
223 @cindex Viewing music
224 @cindex xdvi
225 @cindex .dvi
226
227 To view the @code{test.dvi} output, run Xdvi:
228
229 @quotation
230 @example
231 xdvi test.dvi
232 @end example
233 @end quotation
234
235 @c FIXME: should we say anything on xdvi-gs interaction?
236
237 You should see the following in your main Xdvi window:
238 @lilypond
239 \score {
240   \notes { c'4 e' g' }
241
242 @end lilypond
243
244 When you're satisfied with the result, you can print the
245 PostScript file:
246
247 @quotation
248 @example
249 lpr test.ps
250 @end example
251 @end quotation
252 If this does not make your printer produce a page of music, you should
253 look into installing and configuring ghostscript.  Refer to
254 GhostScript's website at @uref{http://www.ghostscript.com}.
255 @cindex GhostScript
256 @cindex @code{lpr}
257 @cindex Printing output
258
259 @cindex PostScript
260 @cindex .ps
261
262
263 @unnumberedsubsec Running LilyPond on Windows
264
265
266 On windows, you open a LilyPond shell, and then you invoke ly2dvi
267 compile your LilyPond source file, just like on Unix:
268
269 @quotation
270 @example
271 ly2dvi -P test.ly
272 @end example
273 @end quotation
274 You will see the following on your screen:
275
276 @c FIXME: leave this out, just refer to unix section?
277 @c FIXME: commands run in dos shell: we can't redirect output
278 @quotation
279 @example
280 GNU LilyPond 1.3.150
281 Now processing: `/home/tim/ly/test.ly'
282 Parsing...
283 Interpreting music...[1]
284  @emph{ ... some more text ... }
285 PS output to test.ps...
286 DVI output to test.dvi...
287 @end example
288 @end quotation
289
290 To view the @code{test.dvi} output, run Yap
291
292 @quotation
293 @example
294 yap test
295 @end example
296 @end quotation
297 You should see the following in your Yap window
298 @lilypond
299 \score {
300   \notes { c'4 e' g' }
301
302 @end lilypond
303
304 @c FIXME: talk about newer Yap versions, proper gs installation?
305 When you're satisfied with the result, you can print from within Yap
306 (File/Print).  Note that Yap may not display embedded PostScript symbols
307 such as beams and slurs.  Don't worry, they'll be printed anyway.
308
309 You can also print the PostScript file directly from the
310 command line using GSview:
311
312 @quotation
313 @example
314 gsview32 /s test.ps
315 @end example
316 @end quotation
317
318
319