Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1542)

Delta Between Two Patch Sets: Documentation/learning/tutorial.itely

Issue 1056041: Doc: LM: Reformat ly code. (Closed)
Left Patch Set: Created 13 years, 11 months ago
Right Patch Set: Make requested changes. Created 13 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 @c -*- coding: utf-8; mode: texinfo; -*- 1 @c -*- coding: utf-8; mode: texinfo; -*-
2 2
3 @ignore 3 @ignore
4 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH 4 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5 5
6 When revising a translation, copy the HEAD committish of the 6 When revising a translation, copy the HEAD committish of the
7 version that you are working on. For details, see the Contributors' 7 version that you are working on. For details, see the Contributors'
8 Guide, node Updating translation committishes.. 8 Guide, node Updating translation committishes..
9 @end ignore 9 @end ignore
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 @qq{Compiling} is the term used for processing an input file in 48 @qq{Compiling} is the term used for processing an input file in
49 LilyPond format to produce output file(s). Output files are 49 LilyPond format to produce output file(s). Output files are
50 generally PDF (for printing or viewing), MIDI (for playing), and 50 generally PDF (for printing or viewing), MIDI (for playing), and
51 PNG (for online use). LilyPond input files are simple text files. 51 PNG (for online use). LilyPond input files are simple text files.
52 52
53 This example shows a simple input file: 53 This example shows a simple input file:
54 54
55 @example 55 @example
56 \version "@w{@version{}}" 56 \version "@w{@version{}}"
57 @{ 57 @{
58 c'4 e' g' e' 58 c' e' g' e'
59 @} 59 @}
60 @end example 60 @end example
61 61
62 The graphical output is: 62 The graphical output is:
63 63
64 @c in this case we don't want verbatim 64 @c in this case we don't want verbatim
65 @lilypond[quote] 65 @lilypond[quote]
66 { 66 {
67 c'4 e' g' e' 67 c' e' g' e'
68 } 68 }
69 @end lilypond 69 @end lilypond
70 70
71 @warning{Notes and lyrics in LilyPond input must always be 71 @warning{Notes and lyrics in LilyPond input must always be
72 surrounded by @w{@strong{@{ curly braces @}}}. The braces 72 surrounded by @w{@strong{@{ curly braces @}}}. The braces
73 should also be surrounded by a space unless they are at the 73 should also be surrounded by a space unless they are at the
74 beginning or end of a line to avoid ambiguities. They may 74 beginning or end of a line to avoid ambiguities. They may
75 be omitted in some examples in this manual, but don't forget them 75 be omitted in some examples in this manual, but don't forget them
76 in your own music! For more information about the display of 76 in your own music! For more information about the display of
77 examples in the manual, see @ref{How to read the manuals}.} 77 examples in the manual, see @ref{How to read the manuals}.}
78 78
79 In addition, LilyPond input is @strong{case sensitive}. 79 In addition, LilyPond input is @strong{case sensitive}.
80 @w{@samp{@{ c4 d e @}}} is valid input; @w{@samp{@{ C4 D E @}}} 80 @w{@samp{@{ c d e @}}} is valid input; @w{@samp{@{ C D E @}}} will
81 will produce an error message. 81 produce an error message.
Graham Percival (old account) 2010/05/02 16:01:33 Please don't confuse the issue here; leave these c
Mark Polesky 2010/05/02 20:13:05 I just don't like seeing the statement: `{ c d e
82 82
83 83
84 @smallspace 84 @smallspace
85 85
86 @subheading Producing output 86 @subheading Producing output
87 87
88 @cindex PDF file 88 @cindex PDF file
89 @cindex viewing music 89 @cindex viewing music
90 @cindex text editors 90 @cindex text editors
91 91
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 @cindex simple notation 165 @cindex simple notation
166 @cindex notation, simple 166 @cindex notation, simple
167 167
168 LilyPond will add some notation elements automatically. In the 168 LilyPond will add some notation elements automatically. In the
169 next example, we have only specified four pitches, but LilyPond 169 next example, we have only specified four pitches, but LilyPond
170 has added a clef, time signature, and rhythms. 170 has added a clef, time signature, and rhythms.
171 171
172 @lilypond[verbatim,quote] 172 @lilypond[verbatim,quote]
173 { 173 {
174 c'4 e' g' e' 174 c' e' g' e'
Graham Percival (old account) 2010/05/02 16:01:33 Please don't add the 4 to this example.
175 } 175 }
176 @end lilypond 176 @end lilypond
177 177
178 @noindent 178 @noindent
179 This behavior may be altered, but in most cases these automatic 179 This behavior may be altered, but in most cases these automatic
180 values are useful. 180 values are useful.
181 181
182 182
183 @subheading Pitches 183 @subheading Pitches
184 184
(...skipping 17 matching lines...) Expand all
202 In this mode, the octave is chosen automatically by assuming the 202 In this mode, the octave is chosen automatically by assuming the
203 following note is always to be placed closest to the previous 203 following note is always to be placed closest to the previous
204 note, i.e., it is to be placed in the octave which is within three 204 note, i.e., it is to be placed in the octave which is within three
205 staff spaces of the previous note. We begin by entering the most 205 staff spaces of the previous note. We begin by entering the most
206 elementary piece of music, a @notation{scale}, in which every note 206 elementary piece of music, a @notation{scale}, in which every note
207 is within just one staff space of the previous note. 207 is within just one staff space of the previous note.
208 208
209 @lilypond[verbatim,quote] 209 @lilypond[verbatim,quote]
210 % set the starting point to middle C 210 % set the starting point to middle C
211 \relative c' { 211 \relative c' {
212 c4 d e f 212 c d e f
Graham Percival (old account) 2010/05/02 16:01:33 Again, no durations yet; they haven't been introdu
Mark Polesky 2010/05/02 20:13:05 Percent-sign comments and octave quotes haven't be
213 g4 a b c 213 g a b c
214 } 214 }
215 @end lilypond 215 @end lilypond
216 216
217 The initial note is @notation{middle C}. Each successive note is 217 The initial note is @notation{middle C}. Each successive note is
218 placed closest to the previous note -- in other words, the first 218 placed closest to the previous note -- in other words, the first
219 @code{c} is the closest C to middle C. This is followed by the 219 @code{c} is the closest C to middle C. This is followed by the
220 closest D to the previous note. We can create melodies which have 220 closest D to the previous note. We can create melodies which have
221 larger intervals, still using only @code{\relative} mode: 221 larger intervals, still using only @code{\relative} mode:
222 222
223 @lilypond[verbatim,quote] 223 @lilypond[verbatim,quote]
224 \relative c' { 224 \relative c' {
225 d4 f a g 225 d f a g
Graham Percival (old account) 2010/05/02 16:01:33 Durations not introduced yet.
226 c4 b f d 226 c b f d
227 } 227 }
228 @end lilypond 228 @end lilypond
229 229
230 @noindent 230 @noindent
231 It is not necessary for the first note of the melody to start on 231 It is not necessary for the first note of the melody to start on
232 the note which specifies the starting pitch. In the previous 232 the note which specifies the starting pitch. In the previous
233 example, the first note -- the @code{d} -- is the closest D to 233 example, the first note -- the @code{d} -- is the closest D to
234 middle C. 234 middle C.
235 235
236 By adding (or removing) quotes @code{'} or commas @code{,} from 236 By adding (or removing) quotes @code{'} or commas @code{,} from
237 the @q{@w{@code{@bs{}relative c'}}} command, we can change the 237 the @q{@w{@code{@bs{}relative c'}}} command, we can change the
238 starting octave: 238 starting octave:
239 239
240 @lilypond[verbatim,quote] 240 @lilypond[verbatim,quote]
241 % one octave above middle C 241 % one octave above middle C
242 \relative c'' { 242 \relative c'' {
243 e4 c a c 243 e c a c
Graham Percival (old account) 2010/05/02 16:01:33 No durs yet.
244 } 244 }
245 @end lilypond 245 @end lilypond
246 246
247 Relative mode can be confusing initially, but is the easiest way 247 Relative mode can be confusing initially, but is the easiest way
248 to enter most melodies. Let us see how this relative calculation 248 to enter most melodies. Let us see how this relative calculation
249 works in practice. Starting from a B, which is on the middle line 249 works in practice. Starting from a B, which is on the middle line
250 in a treble clef, you can reach a C, D and E within 3 staff spaces 250 in a treble clef, you can reach a C, D and E within 3 staff spaces
251 going up, and an A, G and F within 3 staff spaces going down. So 251 going up, and an A, G and F within 3 staff spaces going down. So
252 if the note following a B is a C, D or E it will be assumed to be 252 if the note following a B is a C, D or E it will be assumed to be
253 above the B, and an A, G or F will be assumed to be below. 253 above the B, and an A, G or F will be assumed to be below.
254 254
255 @lilypond[verbatim,quote] 255 @lilypond[verbatim,quote]
256 \relative c'' { 256 \relative c'' {
257 b4 c % c is 1 staff space up, so is the c above 257 b c % c is 1 staff space up, so is the c above
Graham Percival (old account) 2010/05/02 16:01:33 No durs yet.
258 b4 d % d is 2 up or 5 down, so is the d above 258 b d % d is 2 up or 5 down, so is the d above
259 b4 e % e is 3 up or 4 down, so is the e above 259 b e % e is 3 up or 4 down, so is the e above
260 b4 a % a is 6 up or 1 down, so is the a below 260 b a % a is 6 up or 1 down, so is the a below
261 b4 g % g is 5 up or 2 down, so is the g below 261 b g % g is 5 up or 2 down, so is the g below
262 b4 f % f is 4 up or 3 down, so is the f below 262 b f % f is 4 up or 3 down, so is the f below
263 } 263 }
264 @end lilypond 264 @end lilypond
265 265
266 Exactly the same happens even when any of these notes are 266 Exactly the same happens even when any of these notes are
267 sharpened or flattened. @notation{Accidentals} are 267 sharpened or flattened. @notation{Accidentals} are
268 @strong{totally ignored} in the calculation of relative position. 268 @strong{totally ignored} in the calculation of relative position.
269 Precisely the same staff space counting is done from a note at any 269 Precisely the same staff space counting is done from a note at any
270 other position on the staff. 270 other position on the staff.
271 271
272 To add intervals that are larger than three staff spaces, we can 272 To add intervals that are larger than three staff spaces, we can
273 raise the @notation{octave} by adding a single quote @code{'} (or 273 raise the @notation{octave} by adding a single quote @code{'} (or
274 apostrophe) to the note name. We can lower the octave by adding a 274 apostrophe) to the note name. We can lower the octave by adding a
275 comma @code{,} to the note name. 275 comma @code{,} to the note name.
276 276
277 @lilypond[verbatim,quote] 277 @lilypond[verbatim,quote]
278 \relative c'' { 278 \relative c'' {
279 a4 a, c' f, 279 a a, c' f,
Graham Percival (old account) 2010/05/02 16:01:33 No durs yet.
280 g4 g'' a,, f' 280 g g'' a,, f'
281 } 281 }
282 @end lilypond 282 @end lilypond
283 283
284 @noindent 284 @noindent
285 To change a note by two (or more!) octaves, we use multiple 285 To change a note by two (or more!) octaves, we use multiple
286 @code{''} or @code{,,} -- but be careful that you use two single 286 @code{''} or @code{,,} -- but be careful that you use two single
287 quotes @code{''} and not one double quote @code{"}@tie{}! 287 quotes @code{''} and not one double quote @code{"}@tie{}!
288 @c " - keeps quotes in order for context-sensitive editor -td 288 @c " - keeps quotes in order for context-sensitive editor -td
289 289
290 @subheading Durations (rhythms) 290 @subheading Durations (rhythms)
(...skipping 10 matching lines...) Expand all
301 Music Glossary: @rglos{beam}, @rglos{duration}, 301 Music Glossary: @rglos{beam}, @rglos{duration},
302 @rglos{whole note}, @rglos{half note}, @rglos{quarter note}, 302 @rglos{whole note}, @rglos{half note}, @rglos{quarter note},
303 @rglos{dotted note}. 303 @rglos{dotted note}.
304 304
305 The @notation{duration} of a note is specified by a number after 305 The @notation{duration} of a note is specified by a number after
306 the note name: @code{1} for a @notation{whole note}, @code{2} for 306 the note name: @code{1} for a @notation{whole note}, @code{2} for
307 a @notation{half note}, @code{4} for a @notation{quarter note} and 307 a @notation{half note}, @code{4} for a @notation{quarter note} and
308 so on. @notation{Beams} are added automatically. 308 so on. @notation{Beams} are added automatically.
309 309
310 If you do not specify a duration, the previous duration is used 310 If you do not specify a duration, the previous duration is used
311 for the next note. The duration of the first note in every 311 for the next note. The duration of the first note defaults to a
312 @code{@{ @var{music} @}} block should always be specified 312 quarter note.
313 explicitly.
314 313
Graham Percival (old account) 2010/05/02 16:01:33 We should still state the default.
Mark Polesky 2010/05/02 20:13:05 Oops! I meant to change that back but I forgot.
315 @lilypond[verbatim,quote] 314 @lilypond[verbatim,quote]
316 \relative c'' { 315 \relative c'' {
317 a1 316 a1
318 a2 a4 a8 a 317 a2 a4 a8 a
319 a16 a a a a32 a a a a64 a a a a a a a a2 318 a16 a a a a32 a a a a64 a a a a a a a a2
320 } 319 }
321 @end lilypond 320 @end lilypond
322 321
323 To create @notation{dotted notes}, add a dot @code{.} to the 322 To create @notation{dotted notes}, add a dot @code{.} to the
324 duration number. The duration of a dotted note must be stated 323 duration number. The duration of a dotted note must be stated
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 changes. Second, it describes the version of LilyPond needed to 475 changes. Second, it describes the version of LilyPond needed to
477 compile the file. 476 compile the file.
478 477
479 If the version statement is omitted from an input file, LilyPond will print 478 If the version statement is omitted from an input file, LilyPond will print
480 a warning during the compilation of the file. 479 a warning during the compilation of the file.
481 480
482 @item 481 @item
483 @strong{Case sensitive}: 482 @strong{Case sensitive}:
484 it matters whether you enter a letter in lower case (e.g. 483 it matters whether you enter a letter in lower case (e.g.
485 @w{@code{a, b, s, t}}) or upper case (e.g. @w{@code{A, B, S, T}}). 484 @w{@code{a, b, s, t}}) or upper case (e.g. @w{@code{A, B, S, T}}).
486 Notes are lower case: @w{@samp{@{ c4 d e @}}} is valid input; 485 Notes are lower case: @w{@samp{@{ c d e @}}} is valid input;
487 @w{@samp{@{ C4 D E @}}} will produce an error message. 486 @w{@samp{@{ C D E @}}} will produce an error message.
Graham Percival (old account) 2010/05/02 16:01:33 Please don't add a 4 here; don't confuse the issue
488 487
489 @item 488 @item
490 @strong{Whitespace insensitive}: 489 @strong{Whitespace insensitive}:
491 it does not matter how many spaces (or tabs or new lines) you add. 490 it does not matter how many spaces (or tabs or new lines) you add.
492 @w{@samp{@{ c4 d e @}}} means the same thing as 491 @w{@samp{@{ c4 d e @}}} means the same thing as
493 @w{@samp{@{ c4 @tie{} @tie{} @tie{} d e @}}} and: 492 @w{@samp{@{ c4 @tie{} @tie{} @tie{} d e @}}} and:
494 493
495 @example 494 @example
496 @{ c4 d 495 @{ c4 d
497 e @} 496 e @}
498 @end example 497 @end example
499 498
500 @noindent 499 @noindent
501 Of course, the previous example is hard to read. A good rule of 500 Of course, the previous example is hard to read. A good rule of
502 thumb is to indent code blocks with either a tab or two spaces: 501 thumb is to indent code blocks with two spaces:
503 502
504 @example 503 @example
505 @{ 504 @{
506 c4 d e 505 c4 d e
Graham Percival (old account) 2010/05/02 16:01:33 This 4 is ok.
507 @} 506 @}
508 @end example 507 @end example
509 508
510 However, whitespace @emph{is} required to separate many 509 However, whitespace @emph{is} required to separate many
511 syntactical elements from others. In other words, whitespace can 510 syntactical elements from others. In other words, whitespace can
512 always be @emph{added}, but not always @emph{eliminated}. Since 511 always be @emph{added}, but not always @emph{eliminated}. Since
513 missing whitespace can give rise to strange errors, it is 512 missing whitespace can give rise to strange errors, it is
514 advisable to always insert whitespace before and after every 513 advisable to always insert whitespace before and after every
515 syntactic element, for example, before and after every curly 514 syntactic element, for example, before and after every curly
516 brace. 515 brace.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 669
671 Many people learn programs by trying and fiddling around with the 670 Many people learn programs by trying and fiddling around with the
672 program. This is also possible with LilyPond. If you click on a 671 program. This is also possible with LilyPond. If you click on a
673 picture in the HTML version of this manual, you will see the exact 672 picture in the HTML version of this manual, you will see the exact
674 LilyPond input that was used to generate that image. Try it on 673 LilyPond input that was used to generate that image. Try it on
675 this image: 674 this image:
676 675
677 @c no verbatim here 676 @c no verbatim here
678 @lilypond[quote] 677 @lilypond[quote]
679 \relative c'' { 678 \relative c'' {
680 c4-\markup { 679 c4-\markup { \bold \huge { Click here. } }
Graham Percival (old account) 2010/05/02 16:01:33 This isn't a verbatim example, so why change it?
Mark Polesky 2010/05/02 20:13:05 On principle.
681 \bold \huge { Click here. }
682 }
683 } 680 }
684 @end lilypond 681 @end lilypond
685 682
686 By cutting and pasting everything in the @qq{ly snippet} section, 683 By cutting and pasting everything in the @qq{ly snippet} section,
687 you have a starting template for experiments. To see exactly the 684 you have a starting template for experiments. To see exactly the
688 same output (line-width and all), copy everything from @qq{Start 685 same output (line-width and all), copy everything from @qq{Start
689 cut-&-pastable section} to the bottom of the file. 686 cut-&-pastable section} to the bottom of the file.
690 687
691 688
692 @ignore 689 @ignore
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 Learning manual's @ref{Tweaking output}. 729 Learning manual's @ref{Tweaking output}.
733 730
734 @item 731 @item
735 @strong{Before undertaking a large project}: read the Usage 732 @strong{Before undertaking a large project}: read the Usage
736 document's @rprogram{Suggestions for writing files}. 733 document's @rprogram{Suggestions for writing files}.
737 734
738 @end itemize 735 @end itemize
739 736
740 737
741 738
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b