]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/introduction.itely
Remove empty line after @seealso.
[lilypond.git] / Documentation / user / introduction.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond-learning.tely
3 @ignore
4     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5
6     When revising a translation, copy the HEAD committish of the
7     version that you are working on.  See TRANSLATION for details.
8 @end ignore
9
10 @c \version "2.11.61"
11
12 @node Introduction
13 @chapter Introduction
14
15 This chapter introduces readers to LilyPond and the
16 documentation.
17
18 @menu
19 * Background::
20 * About the documentation::
21 @end menu
22
23
24 @node Background
25 @section Background
26
27 This section covers the overall goals and architecture of
28 LilyPond.
29
30 @menu
31 * Engraving::
32 * Automated engraving::
33 * What symbols to engrave?::
34 * Music representation::
35 * Example applications::
36 @end menu
37
38
39 @node Engraving
40 @unnumberedsubsec Engraving
41
42 @cindex engraving
43 @cindex typography, music
44 @cindex music typography
45 @cindex plate engraving
46 @cindex music engraving
47
48 The art of music typography is called @emph{(plate) engraving}.
49 The term derives from the traditional process of music printing.
50 Just a few decades ago, sheet music was made by cutting and
51 stamping the music into a zinc or pewter plate in mirror image.
52 The plate would be inked, the depressions caused by the cutting
53 and stamping would hold ink.  An image was formed by pressing
54 paper to the plate.  The stamping and cutting was completely done
55 by hand.  Making a correction was cumbersome, if possible at all,
56 so the engraving had to be perfect in one go.  Engraving was a
57 highly specialized skill; a craftsman had to complete around five
58 years of training before earning the title of master engraver, and
59 another five years of experience were necessary to become truly
60 skilled.
61
62 Nowadays, all newly printed music is produced with computers.
63 This has obvious advantages; prints are cheaper to make, and
64 editorial work can be delivered by email.  Unfortunately, the
65 pervasive use of computers has also decreased the graphical
66 quality of scores.  Computer printouts have a bland, mechanical
67 look, which makes them unpleasant to play from.
68
69
70 @c introduce illustrating aspects of engraving, font...
71 The images below illustrate the difference between traditional
72 engraving and typical computer output, and the third picture shows
73 how LilyPond mimics the traditional look.  The left picture shows
74 a scan of a flat symbol from an edition published in 2000.  The
75 center depicts a symbol from a hand-engraved Bärenreiter edition
76 of the same music.  The left scan illustrates typical flaws of
77 computer print: the staff lines are thin, the weight of the flat
78 symbol matches the light lines and it has a straight layout with
79 sharp corners.  By contrast, the Bärenreiter flat has a bold,
80 almost voluptuous rounded look.  Our flat symbol is designed
81 after, among others, this one.  It is rounded, and its weight
82 harmonizes with the thickness of our staff lines, which are also
83 much thicker than lines in the computer edition.
84
85 @multitable @columnfractions .125 .25 .25 .25 .125
86 @item @tab
87 @ifnotinfo
88 @iftex
89 @image{henle-flat-gray,,4cm}
90 @end iftex
91 @ifnottex
92 @image{henle-flat-gray,,,png}
93 @end ifnottex
94
95 @tab
96 @iftex
97 @image{baer-flat-gray,,4cm}
98 @end iftex
99 @ifnottex
100 @image{baer-flat-gray,,,png}
101 @end ifnottex
102
103 @tab
104 @iftex
105 @image{lily-flat-bw,,4cm}
106 @end iftex
107 @ifnottex
108 @image{lily-flat-bw,,,png}
109 @end ifnottex
110 @end ifnotinfo
111 @ifinfo
112 @image{lilypond/henle-flat-bw,,,png} @image{lilypond/baer-flat-bw,,,png}
113 @image{lilypond/lily-flat-bw,,,png}
114 @end ifinfo
115
116 @item @tab
117 Henle (2000)
118 @tab
119 Bärenreiter (1950)
120 @tab
121 LilyPond Feta font (2003)
122
123 @end multitable
124
125
126 @cindex musical symbols
127 @cindex font
128 @cindex blackness
129 @cindex balance
130
131 @c introduce illustrating aspects of engraving, spacing...
132 In spacing, the distribution of space should reflect the durations
133 between notes.  However, many modern scores adhere to the
134 durations with mathematical precision, which leads to poor
135 results.  In the next example a motive is printed twice: once
136 using exact mathematical spacing, and once with corrections.  Can
137 you spot which fragment is which?
138
139 @cindex optical spacing
140 @c file spacing-optical.
141 @c need to include it here,  because we want two images.
142 @lilypond
143 \paper {
144   ragged-right = ##t
145   indent = #0.0
146 }
147
148 music = {
149    c'4 e''4 e'4 b'4 |
150    \stemDown
151    b'8[ e'' a' e'']
152    \stemNeutral
153    e'8[ e'8 e'8 e'8]
154 }
155
156 \score
157 {
158   \music
159   \layout {
160     \context {
161       \Staff
162       \override NoteSpacing #'stem-spacing-correction = #0.6
163     }
164   }
165 }
166 @end lilypond
167
168 @lilypond
169 \paper {
170   ragged-right = ##t
171   indent = #0.0
172 }
173
174 music = {
175    c'4 e''4 e'4 b'4 |
176    \stemDown
177    b'8[ e'' a' e'']
178    \stemNeutral
179    e'8[ e'8 e'8 e'8]
180 }
181 \score
182 {
183   \music
184   \layout {
185     \context {
186       \Staff
187       \override NoteSpacing #'stem-spacing-correction = #0.0
188       \override NoteSpacing #'same-direction-correction = #0.0
189       \override StaffSpacing #'stem-spacing-correction = #0.0
190     }
191   }
192 }
193 @end lilypond
194
195 @cindex regular rhythms
196 @cindex regular spacing
197 @cindex spacing, regular
198
199 Each bar in the fragment only uses notes that are played in a
200 constant rhythm.  The spacing should reflect that.  Unfortunately,
201 the eye deceives us a little; not only does it notice the distance
202 between note heads, it also takes into account the distance
203 between consecutive stems.  As a result, the notes of an
204 up-stem/@/down-stem combination should be put farther apart, and
205 the notes of a down-stem/@/up-stem combination should be put
206 closer together, all depending on the combined vertical positions
207 of the notes.  The upper two measures are printed with this
208 correction, the lower two measures without, forming
209 down-stem/@/up-stem clumps of notes.
210
211
212 Musicians are usually more absorbed with performing than with
213 studying the looks of a piece of music, so nitpicking about
214 typographical details may seem academical.  But it is not.  In
215 larger pieces with monotonous rhythms, spacing corrections lead to
216 subtle variations in the layout of every line, giving each one a
217 distinct visual signature.  Without this signature all lines would
218 look the same, and they become like a labyrinth.  If a musician
219 looks away once or has a lapse in concentration, the lines might
220 lose their place on the page.
221
222 Similarly, the strong visual look of bold symbols on heavy staff
223 lines stands out better when the music is far away from the
224 reader, for example, if it is on a music stand.  A careful
225 distribution of white space allows music to be set very tightly
226 without cluttering symbols together.  The result minimizes the
227 number of page turns, which is a great advantage.
228
229 This is a common characteristic of typography.  Layout should be
230 pretty, not only for its own sake, but especially because it helps
231 the reader in her task.  For performance material like sheet
232 music, this is of double importance: musicians have a limited
233 amount of attention.  The less attention they need for reading,
234 the more they can focus on playing the music.  In other words,
235 better typography translates to better performances.
236
237 These examples demonstrate that music typography is an art that is
238 subtle and complex, and that producing it requires considerable
239 expertise, which musicians usually do not have.  LilyPond is our
240 effort to bring the graphical excellence of hand-engraved music to
241 the computer age, and make it available to normal musicians.  We
242 have tuned our algorithms, font-designs, and program settings to
243 produce prints that match the quality of the old editions we love
244 to see and love to play from.
245
246
247 @node Automated engraving
248 @unnumberedsubsec Automated engraving
249
250 @cindex engraving, automated
251 @cindex automated engraving
252
253 How do we go about implementing typography?  If craftsmen need
254 over ten years to become true masters, how could we simple hackers
255 ever write a program to take over their jobs?
256
257 The answer is: we cannot.  Typography relies on human judgment of
258 appearance, so people cannot be replaced completely.  However,
259 much of the dull work can be automated.  If LilyPond solves most
260 of the common situations correctly, this will be a huge
261 improvement over existing software.  The remaining cases can be
262 tuned by hand.  Over the course of years, the software can be
263 refined to do more and more things automatically, so manual
264 overrides are less and less necessary.
265
266 When we started, we wrote the LilyPond program entirely in the C++
267 programming language; the program's functionality was set in stone
268 by the developers.  That proved to be unsatisfactory for a number
269 of reasons:
270
271 @itemize
272
273 @item When LilyPond makes mistakes, users need to override
274 formatting decisions.  Therefore, the user must have access to the
275 formatting engine.  Hence, rules and settings cannot be fixed by
276 us at compile-time but must be accessible for users at run-time.
277
278 @item Engraving is a matter of visual judgment, and therefore a
279 matter of taste.  As knowledgeable as we are, users can disagree
280 with our personal decisions.  Therefore, the definitions of
281 typographical style must also be accessible to the user.
282
283 @item Finally, we continually refine the formatting algorithms, so
284 we need a flexible approach to rules.  The C++ language forces a
285 certain method of grouping rules that do not match well with how
286 music notation works.
287
288 @end itemize
289
290 @cindex Scheme programming language
291
292 These problems have been addressed by integrating an interpreter
293 for the Scheme programming language and rewriting parts of
294 LilyPond in Scheme.  The current formatting architecture is built
295 around the notion of graphical objects, described by Scheme
296 variables and functions.  This architecture encompasses formatting
297 rules, typographical style and individual formatting decisions.
298 The user has direct access to most of these controls.
299
300 Scheme variables control layout decisions.  For example, many
301 graphical objects have a direction variable that encodes the
302 choice between up and down (or left and right).  Here you see two
303 chords, with accents and arpeggios.  In the first chord, the
304 graphical objects have all directions down (or left).  The second
305 chord has all directions up (right).
306
307 @lilypond[quote,ragged-right]
308 \new Score \with {
309    \override SpacingSpanner #'spacing-increment = #3
310    \override TimeSignature #'transparent = ##t
311 } \relative c' {
312    \stemDown <e g b>4_>-\arpeggio
313    \override Arpeggio #'direction = #RIGHT
314    \stemUp <e g b>4^>-\arpeggio
315 }
316 @end lilypond
317
318 @cindex score formatting
319 @cindex formatting a score
320 @cindex formatting rules
321
322 @noindent
323 The process of formatting a score consists of reading and writing
324 the variables of graphical objects.  Some variables have a preset
325 value.  For example, the thickness of many lines -- a
326 characteristic of typographical style -- is a variable with a
327 preset value.  You are free to alter this value, giving your score
328 a different typographical impression.
329
330 @lilypond[quote,ragged-right]
331 fragment = {
332    \clef bass f8 as8
333    c'4-~ c'16 as g f e16 g bes c' des'4
334 }
335 <<
336    \new Staff \fragment
337    \new Staff \with {
338       \override Beam #'thickness = #0.3
339       \override Stem #'thickness = #0.5
340       \override Bar #'thickness = #3.6
341       \override Tie #'thickness = #2.2
342       \override StaffSymbol #'thickness = #3.0
343       \override Tie #'extra-offset = #'(0 .  0.3)
344       }
345       \fragment
346 >>
347 @end lilypond
348
349 Formatting rules are also preset variables: each object has
350 variables containing procedures.  These procedures perform the
351 actual formatting, and by substituting different ones, we can
352 change the appearance of objects.  In the following example, the
353 rule which note head objects are used to produce their symbol is
354 changed during the music fragment.
355
356 @lilypond[quote,ragged-right]
357 #(set-global-staff-size 30)
358
359 #(define (mc-squared grob orig current)
360   (let* ((interfaces (ly:grob-interfaces grob))
361          (pos (ly:grob-property grob 'staff-position)))
362     (if (memq 'note-head-interface interfaces)
363         (begin
364           (ly:grob-set-property! grob 'stencil ly:text-interface::print)
365           (ly:grob-set-property! grob 'font-family 'roman)
366           (ly:grob-set-property! grob 'text
367             (make-raise-markup -0.5
368               (case pos
369                 ((-5) (make-simple-markup "m"))
370                 ((-3) (make-simple-markup "c "))
371                 ((-2) (make-smaller-markup (make-bold-markup "2")))
372                 (else (make-simple-markup "bla")))))))))
373
374 \new Voice \relative c' {
375    \stemUp
376    \set autoBeaming = ##f
377    \time 2/4
378    <d f g>4
379    \once \override NoteHead #'stencil = #ly:note-head::brew-ez-stencil
380    \once \override NoteHead #'font-size = #-7
381    \once \override NoteHead #'font-family = #'sans
382    \once \override NoteHead #'font-series = #'bold
383    <d f g>
384    \once \override NoteHead #'style = #'cross
385    <d f g>
386    \applyOutput #'Voice #mc-squared
387    <d f g>
388    <<
389       { d8[ es-( fis^^ g] fis2-) }
390       \repeat unfold 5 { \applyOutput #'Voice #mc-squared s8 }
391    >>
392 }
393 @end lilypond
394
395
396 @node What symbols to engrave?
397 @unnumberedsubsec What symbols to engrave?
398
399 @cindex engraving
400 @cindex typography
401 @cindex engraver
402 @cindex plug-in
403
404 The formatting process decides where to place symbols.  However,
405 this can only be done once it is decided @emph{what} symbols
406 should be printed, in other words what notation to use.
407
408 Common music notation is a system of recording music that has
409 evolved over the past 1000 years.  The form that is now in common
410 use dates from the early renaissance.  Although the basic form
411 (i.e., note heads on a 5-line staff) has not changed, the details
412 still evolve to express the innovations of contemporary notation.
413 Hence, it encompasses some 500 years of music.  Its applications
414 range from monophonic melodies to monstrous counterpoints for
415 large orchestras.
416
417 How can we get a grip on such a many-headed beast, and force it
418 into the confines of a computer program?  Our solution is to break
419 up the problem of notation (as opposed to engraving, i.e.,
420 typography) into digestible and programmable chunks: every type of
421 symbol is handled by a separate module, a so-called plug-in.  Each
422 plug-in is completely modular and independent, so each can be
423 developed and improved separately.  Such plug-ins are called
424 @code{engraver}s, by analogy with craftsmen who translate musical
425 ideas to graphic symbols.
426
427 In the following example, we see how we start out with a plug-in
428 for note heads, the @code{Note_heads_engraver}.
429
430 @lilypond[quote,ragged-right]
431 \include "engraver-example.ily"
432
433 \score {
434   \topVoice
435   \layout {
436     \context {
437       \Voice
438       \remove "Stem_engraver"
439       \remove "Phrasing_slur_engraver"
440       \remove "Slur_engraver"
441       \remove "Script_engraver"
442       \remove "Beam_engraver"
443       \remove "Auto_beam_engraver"
444     }
445     \context {
446       \Staff
447       \remove "Accidental_engraver"
448       \remove "Key_engraver"
449       \remove "Clef_engraver"
450       \remove "Bar_engraver"
451       \remove "Time_signature_engraver"
452       \remove "Staff_symbol_engraver"
453       \consists "Pitch_squash_engraver"
454     }
455   }
456 }
457 @end lilypond
458
459 @noindent
460 Then a @code{Staff_symbol_engraver} adds the staff
461
462 @lilypond[quote,ragged-right]
463 \include "engraver-example.ily"
464
465 \score {
466   \topVoice
467   \layout {
468     \context {
469       \Voice
470       \remove "Stem_engraver"
471       \remove "Phrasing_slur_engraver"
472       \remove "Slur_engraver"
473       \remove "Script_engraver"
474       \remove "Beam_engraver"
475       \remove "Auto_beam_engraver"
476     }
477     \context {
478       \Staff
479       \remove "Accidental_engraver"
480       \remove "Key_engraver"
481       \remove "Clef_engraver"
482       \remove "Bar_engraver"
483       \consists "Pitch_squash_engraver"
484       \remove "Time_signature_engraver"
485     }
486   }
487 }
488 @end lilypond
489
490 @noindent
491 the @code{Clef_engraver} defines a reference point for the staff
492
493 @lilypond[quote,ragged-right]
494 \include "engraver-example.ily"
495
496 \score {
497   \topVoice
498   \layout {
499     \context {
500       \Voice
501       \remove "Stem_engraver"
502       \remove "Phrasing_slur_engraver"
503       \remove "Slur_engraver"
504       \remove "Script_engraver"
505       \remove "Beam_engraver"
506       \remove "Auto_beam_engraver"
507     }
508     \context {
509       \Staff
510       \remove "Accidental_engraver"
511       \remove "Key_engraver"
512       \remove "Bar_engraver"
513       \remove "Time_signature_engraver"
514     }
515   }
516 }
517 @end lilypond
518
519 @noindent
520 and the @code{Stem_engraver} adds stems.
521
522 @lilypond[quote,ragged-right]
523 \include "engraver-example.ily"
524
525 \score {
526   \topVoice
527   \layout {
528     \context {
529       \Voice
530       \remove "Phrasing_slur_engraver"
531       \remove "Slur_engraver"
532       \remove "Script_engraver"
533       \remove "Beam_engraver"
534       \remove "Auto_beam_engraver"
535     }
536     \context {
537       \Staff
538       \remove "Accidental_engraver"
539       \remove "Key_engraver"
540       \remove "Bar_engraver"
541       \remove "Time_signature_engraver"
542     }
543   }
544 }
545 @end lilypond
546
547 @noindent
548 The @code{Stem_engraver} is notified of any note head coming
549 along.  Every time one (or more, for a chord) note head is seen, a
550 stem object is created and connected to the note head.  By adding
551 engravers for beams, slurs, accents, accidentals, bar lines, time
552 signature, and key signature, we get a complete piece of notation.
553
554 @lilypond[quote,ragged-right]
555 \include "engraver-example.ily"
556 \score { \topVoice }
557 @end lilypond
558
559 @cindex polyphony
560 @cindex engraving multiple voices
561 @cindex contexts
562
563 This system works well for monophonic music, but what about
564 polyphony?  In polyphonic notation, many voices can share a staff.
565
566 @lilypond[quote,ragged-right]
567 \include "engraver-example.ily"
568 \new Staff << \topVoice \\ \botVoice >>
569 @end lilypond
570
571 In this situation, the accidentals and staff are shared, but the
572 stems, slurs, beams, etc., are private to each voice.  Hence,
573 engravers should be grouped.  The engravers for note heads, stems,
574 slurs, etc., go into a group called @q{Voice context,} while the
575 engravers for key, accidental, bar, etc., go into a group called
576 @q{Staff context.}  In the case of polyphony, a single Staff
577 context contains more than one Voice context.  Similarly, multiple
578 Staff contexts can be put into a single Score context.  The Score
579 context is the top level notation context.
580
581
582 @seealso
583 Internals Reference: @rinternals{Contexts}.
584
585
586 @lilypond[quote,ragged-right]
587 \include "engraver-example.ily"
588 \score {
589    <<
590       \new Staff << \topVoice \\ \botVoice >>
591       \new Staff << \pah \\ \hoom >>
592    >>
593 }
594 @end lilypond
595
596
597 @node Music representation
598 @unnumberedsubsec Music representation
599
600 @cindex syntax
601 @cindex recursive structures
602
603 Ideally, the input format for any high-level formatting system is
604 an abstract description of the content.  In this case, that would
605 be the music itself.  This poses a formidable problem: how can we
606 define what music really is? Instead of trying to find an answer,
607 we have reversed the question.  We write a program capable of
608 producing sheet music, and adjust the format to be as lean as
609 possible.  When the format can no longer be trimmed down, by
610 definition we are left with content itself.  Our program serves as
611 a formal definition of a music document.
612
613 The syntax is also the user-interface for LilyPond, hence it is
614 easy to type:
615
616 @example
617 @{
618   c'4 d'8
619 @}
620 @end example
621
622 @noindent
623 to create a quarter note C1 (middle C) and an eighth note D1 (D
624 above middle C).
625
626 @lilypond[quote]
627 {
628   c'4 d'8
629 }
630 @end lilypond
631
632 On a microscopic scale, such syntax is easy to use.  On a larger
633 scale, syntax also needs structure.  How else can you enter
634 complex pieces like symphonies and operas?  The structure is
635 formed by the concept of music expressions: by combining small
636 fragments of music into larger ones, more complex music can be
637 expressed.  For example
638
639 @lilypond[quote,verbatim,fragment,relative=1]
640 f4
641 @end lilypond
642
643 @noindent
644 Simultaneous notes can be constructed by enclosing them with
645 @code{<<} and @code{>>}:
646
647 @example
648 <<c4 d4 e4>>
649 @end example
650
651 @lilypond[quote,fragment,relative=1]
652 \new Voice { <<c4 d4 e>> }
653 @end lilypond
654
655 @noindent
656 This expression is put in sequence by enclosing it in curly braces
657 @code{@{@tie{}@dots{}@tie{}@}}:
658
659 @example
660 @{ f4 <<c4 d4 e4>> @}
661 @end example
662
663 @lilypond[quote,relative=1,fragment]
664 { f4 <<c d e4>> }
665 @end lilypond
666
667 @noindent
668 The above is also an expression, and so it may be combined again
669 with another simultaneous expression (a half note) using
670 @code{<<}, @code{\\}, and @code{>>}:
671
672 @example
673 << g2 \\ @{ f4 <<c4 d4 e4>> @} >>
674 @end example
675
676 @lilypond[quote,fragment,relative=2]
677 \new Voice { << g2 \\ { f4 <<c d e>> } >> }
678 @end lilypond
679
680 Such recursive structures can be specified neatly and formally in
681 a context-free grammar.  The parsing code is also generated from
682 this grammar.  In other words, the syntax of LilyPond is clearly
683 and unambiguously defined.
684
685 User-interfaces and syntax are what people see and deal with most.
686 They are partly a matter of taste, and also subject of much
687 discussion.  Although discussions on taste do have their merit,
688 they are not very productive.  In the larger picture of LilyPond,
689 the importance of input syntax is small: inventing neat syntax is
690 easy, while writing decent formatting code is much harder.  This
691 is also illustrated by the line-counts for the respective
692 components: parsing and representation take up less than 10% of
693 the source code.
694
695
696 @node Example applications
697 @unnumberedsubsec Example applications
698
699 @cindex simple examples
700 @cindex examples, simple
701
702 We have written LilyPond as an experiment of how to condense the
703 art of music engraving into a computer program.  Thanks to all
704 that hard work, the program can now be used to perform useful
705 tasks.  The simplest application is printing notes.
706
707 @lilypond[quote,relative=1]
708 {
709   \time 2/4
710   c4 c g'4 g a4 a g2
711 }
712 @end lilypond
713
714 @noindent
715 By adding chord names and lyrics we obtain a lead sheet.
716
717 @lilypond[quote,ragged-right]
718 <<
719    \chords { c2 c f2 c }
720    \new Staff
721    \relative c' {
722      \time 2/4
723      c4 c g' g a a g2
724    }
725    \addlyrics { twin -- kle twin -- kle lit -- tle star }
726 >>
727 @end lilypond
728
729 Polyphonic notation and piano music can also be printed.  The
730 following example combines some more exotic constructs.
731
732 @lilypond[quote]
733 \header {
734   title = "Screech and boink"
735   subtitle = "Random complex notation"
736   composer = "Han-Wen Nienhuys"
737 }
738
739 \score {
740   \context PianoStaff <<
741     \new Staff = "up" {
742       \time 4/8
743       \key c \minor
744       << {
745         \revert Stem #'direction
746         \change Staff = down
747         \set subdivideBeams = ##t
748         g16.[
749           \change Staff = up
750           c'''32
751           \change Staff = down
752           g32
753           \change Staff = up
754           c'''32
755           \change Staff = down
756           g16]
757         \change Staff = up
758         \stemUp
759         \set followVoice = ##t
760         c'''32([ b''16 a''16 gis''16 g''32)]
761       } \\ {
762         s4 \times 2/3 { d'16[ f' g'] } as'32[ b''32 e'' d'']
763       } \\ {
764         s4 \autoBeamOff d''8.. f''32
765       } \\ {
766         s4 es''4
767       } >>
768     }
769
770     \new Staff = "down" {
771       \clef bass
772       \key c \minor
773       \set subdivideBeams = ##f
774       \override Stem  #'french-beaming = ##t
775       \override Beam  #'thickness = #0.3
776       \override Stem  #'thickness = #4.0
777       g'16[ b16 fis16 g16]
778       << \makeClusters {
779         as16 <as b>
780         <g b>
781         <g cis>
782       } \\ {
783         \override Staff.Arpeggio  #'arpeggio-direction =#down
784         <cis, e, gis, b, cis>4\arpeggio
785       }
786     >> }
787   >>
788   \midi {
789     \context {
790       \Score
791       tempoWholesPerMinute = #(ly:make-moment 60 8)
792     }
793   }
794   \layout {
795     \context {
796       \Staff
797       \consists Horizontal_bracket_engraver
798     }
799   }
800 }
801 @end lilypond
802
803 The fragments shown above have all been written by hand, but that
804 is not a requirement.  Since the formatting engine is mostly
805 automatic, it can serve as an output means for other programs that
806 manipulate music.  For example, it can also be used to convert
807 databases of musical fragments to images for use on websites and
808 multimedia presentations.
809
810 This manual also shows an application: the input format is text,
811 and can therefore be easily embedded in other text-based formats
812 such as @LaTeX{}, HTML, or in the case of this manual, Texinfo.
813 By means of a special program, the input fragments can be replaced
814 by music images in the resulting PDF or HTML output files.  This
815 makes it easy to mix music and text in documents.
816
817
818 @node About the documentation
819 @section About the documentation
820
821 This section explains the different portions of the documentation.
822
823 @cindex Learning Manual
824 @cindex Music Glossary
825 @cindex Notation Reference
826 @cindex Application Usage
827 @cindex Snippet List
828 @cindex Internals Reference
829
830 @c leave these lines wrapping around.  It's some texinfo 4.12 thing. -gp
831 @c This is actually a limitation of texi2html. -jm
832 @menu
833 * About the Learning Manual::  this manual introduces LilyPond, giving in-depth explanations of how to create notation.
834 * About the Music Glossary::  this manual explains musical terms and gives translations of terms in other languages.
835 * About the Notation Reference::  this manual is the main portion of the documentation.  It provides detailed information about creating notation.  This book assumes that the reader knows basic material covered in the Learning Manual and is familiar with the English musical terms presented in the Musical Glossary.
836 * About the Application Usage::  this discusses the actual programs and operating system-specific issues.
837 * About the Snippet List::  this is a collection of short LilyPond examples.
838 * About the Internals Reference::  this document gives reference information about LilyPond's internal structures, which is required for constructing tweaks.
839 * Other documentation::         there are a few other portions of the documentation, such as News items and the mailist archives.
840 @end menu
841
842
843 @node About the Learning Manual
844 @unnumberedsubsec About the Learning Manual
845
846 @cindex Learning Manual
847
848 This book explains how to begin learning LilyPond, as well as
849 explaining some key concepts in easy terms.  You should read these
850 chapters in a linear fashion.
851
852 There is a paragraph @strong{See also} at the end of each section,
853 which contains cross-references to other sections: you should not
854 follow these cross-references at first reading; when you have read all
855 of the Learning Manual, you may want to read some sections again and
856 follow cross-references for further reading.
857
858 @itemize
859
860 @item
861 @ref{Introduction}: explains the background and overall goal of
862 LilyPond.
863
864 @item
865 @ref{Tutorial}: gives a gentle introduction to typesetting music.
866 First time users should start here.
867
868 @item
869 @ref{Fundamental concepts}: explains some general concepts about
870 the LilyPond file format.  If you are not certain where to place a
871 command, read this chapter!
872
873 @item
874 @ref{Tweaking output}: shows how to change the default engraving
875 that LilyPond produces.
876
877 @item
878 @ref{Working on LilyPond projects}: discusses practical uses of
879 LilyPond and how to avoid some common problems.  Read this before
880 undertaking large projects!
881
882 @end itemize
883
884 The Learning Manual also contains appendices which are not part of the
885 recommended linear reading.  They may be useful for later
886 viewing:
887
888 @itemize
889
890 @item
891 @ref{Templates}: shows ready-made templates of LilyPond pieces.
892 Just cut and paste a template into a file, add notes, and you're
893 done!
894
895 @item
896 @ref{Scheme tutorial}: presents a short introduction to Scheme,
897 the programming language that music functions use.  This is
898 material for advanced tweaks; many users never touch Scheme at
899 all.
900
901 @end itemize
902
903
904 @node About the Music Glossary
905 @unnumberedsubsec About the Music Glossary
906
907 @cindex Music Glossary
908 @cindex idiom
909 @cindex jargon
910 @cindex terminology
911 @cindex foreign languages
912 @cindex language
913
914 @rglosnamed{Top,Music glossary}
915 this explains musical terms, and includes translations to various
916 languages.  If you are not familiar with music notation or music
917 terminology (especially if you are a non-native English speaker),
918 it is highly advisable to consult the glossary.
919
920
921 @node About the Notation Reference
922 @unnumberedsubsec About the Notation Reference
923
924 @cindex Notation Reference
925 @cindex appendices
926 @cindex reference charts
927 @cindex charts, reference
928
929 This book explains all the LilyPond commands which produce
930 notation.  It assumes that readers are familiar with the concepts
931 in the Learning Manual.
932
933 @itemize
934
935 @item
936 @ruser{Musical notation}:
937 discusses topics grouped by notation construct.  This section
938 gives details about basic notation that will be useful in almost
939 any notation project.
940
941 @item
942 @ruser{Specialist notation}:
943 discusses topics grouped by notation construct.  This section
944 gives details about special notation that will only be useful for
945 particular instrument (or vocal) groups.
946
947 @item
948 @ruser{General input and output}:
949 discusses general information about LilyPond input files and
950 controlling output.
951
952 @item
953 @ruser{Spacing issues}:
954 discusses issues which affect the global output, such as selecting
955 paper size or specifying page breaks.
956
957 @item
958 @ruser{Changing defaults}:
959 explains how to tweak LilyPond to produce exactly the notation you
960 want.
961
962 @item
963 @ruser{Interfaces for programmers}:
964 explains how to create music functions with scheme.
965
966 @end itemize
967
968 The Notation Reference also contains appendices with useful
969 reference charts.
970
971 @itemize
972
973 @item
974 @ruser{Literature list}:
975 contains a set of useful reference books for those who wish to
976 know more on notation and engraving.
977
978 @item
979 @ruser{Notation manual tables}:
980 are a set of tables showing the chord names, MIDI instruments, a
981 list of color names, and the Feta font.
982
983 @item
984 @ruser{Cheat sheet}:
985 is a handy reference of the most common LilyPond commands.
986
987 @item
988 @ruser{LilyPond command index}:
989 an index of all LilyPond @code{\commands}.
990
991 @item
992 @ruser{LilyPond index}:
993 a complete index.
994
995 @end itemize
996
997
998 @node About the Application Usage
999 @unnumberedsubsec About the Application Usage
1000
1001 @cindex Application Usage
1002 @cindex integrating LilyPond with other programs
1003
1004 This book explains how to execute the programs and how to integrate
1005 LilyPond notation with other programs.
1006
1007 @itemize
1008
1009 @item
1010 @rprogram{Install}:
1011 explains how to install LilyPond, including compilation if
1012 desired.
1013
1014 @item
1015 @rprogram{Setup}:
1016 describes how to configure your computer for optimum LilyPond
1017 usage, such as using special environments for certain text
1018 editors.
1019
1020 @item
1021 @rprogram{Running LilyPond}:
1022 shows how to run LilyPond and its helper programs.  In addition,
1023 this section explains how to upgrade input files from previous
1024 versions of LilyPond.
1025
1026 @item
1027 @rprogram{LilyPond-book}:
1028 explains the details behind creating documents with in-line music
1029 examples, like this manual.
1030
1031 @item
1032 @rprogram{Converting from other formats}:
1033 explains how to run the conversion programs.  These programs are
1034 supplied with the LilyPond package, and convert a variety of music
1035 formats to the @code{.ly} format.
1036
1037 @end itemize
1038
1039
1040 @node About the Snippet List
1041 @unnumberedsubsec About the Snippet List
1042
1043 @cindex snippets
1044 @cindex LSR
1045 @cindex Snippet List
1046 @cindex LilyPond Snippet Repository
1047
1048 @rlsrnamed{Top,LilyPond Snippet List}: this shows a
1049 selected set of LilyPond snippets from the
1050 @uref{http://lsr@/.dsi@/.unimi@/.it,LilyPond Snippet Repository}
1051 (LSR).  All the snippets are in the public domain.
1052
1053 Please note that this document is not an exact subset of LSR.  LSR
1054 is running a stable LilyPond version, so any snippet which
1055 demonstrates new features of a development version must be added
1056 separately.  These are stored in @file{input/new/} in the LilyPond
1057 source tree.
1058
1059 The list of snippets for each subsection of the Notation Reference are
1060 also linked from the @strong{See also} portion.
1061
1062
1063 @node About the Internals Reference
1064 @unnumberedsubsec About the Internals Reference
1065
1066 @cindex Internals Reference
1067
1068 @rinternalsnamed{Top,Internals Reference}: this is a set
1069 of heavily cross linked HTML pages which document the nitty-gritty
1070 details of each and every LilyPond class, object, and function.
1071 It is produced directly from the formatting definitions in the
1072 source code.
1073
1074 Almost all formatting functionality that is used internally is
1075 available directly to the user.  For example, most variables that
1076 control thickness values, distances, etc., can be changed in input
1077 files.  There are a huge number of formatting options, and all of
1078 them are described in this document.  Each section of the Notation
1079 Reference has a @b{See also} subsection, which refers to the
1080 generated documentation.  In the HTML document, these subsections
1081 have clickable links.
1082
1083
1084 @node Other documentation
1085 @unnumberedsubsec Other documentation
1086
1087 There are a number of other sources of information which may be
1088 very valuable.
1089
1090 @itemize
1091
1092 @item
1093 @ifhtml
1094 @ifset bigpage
1095 @uref{../topdocs/NEWS.html,News}:
1096 @end ifset
1097 @ifclear bigpage
1098 @uref{../../topdocs/NEWS.html,News}:
1099 @end ifclear
1100 @end ifhtml
1101 @ifnothtml
1102 News:
1103 @end ifnothtml
1104 this is a summary of important changes
1105 and new features in LilyPond since the previous version.
1106
1107 @item @uref{http://lists.gnu.org/archive/html/lilypond-user/, The
1108 lilypond-user mailist archives}: this is a collection of previous
1109 emails sent to the user list.  Many questions have been asked
1110 multiple times; there is a very good chance that if you have a
1111 question, the answer might be found in these archives.
1112
1113 @item @uref{http://lists.gnu.org/archive/html/lilypond-devel/, The
1114 lilypond-devel mailist archives}: this is a collection of previous
1115 emails sent to the developer's list.  The discussion here is more
1116 technical; if you have an advanced question about lilypond
1117 internals, the answer might be in these archives.
1118
1119 @item Embedded music fragments: in all HTML documents that have
1120 music fragments embedded, the exact LilyPond input that was used
1121 to produce that image can be viewed by clicking the image.
1122
1123 @item Init files: the location of the documentation files that are
1124 mentioned here can vary from system to system.  On occasion, this
1125 manual refers to initialization and example files.  Throughout this
1126 manual, we refer to input files relative to the top-directory of the
1127 source archive.  For example, @file{input/@/lsr/@/dirname/@/bla@/.ly}
1128 may refer to the file
1129 @file{lilypond@/2.x.y/@/input/@/lsr/@/dirname/@/bla@/.ly}.  On binary
1130 packages for the UNIX platform, the documentation and examples can
1131 typically be found somewhere below
1132 @file{/usr/@/share/@/doc/@/lilypond/}.  Initialization files, for
1133 example @file{scm/@/lily@/.scm}, or @file{ly/@/engraver@/-init@/.ly},
1134 are usually found in the directory @file{/usr/@/share/@/lilypond/}.
1135 For more details, see @ref{Other sources of information}.
1136
1137 @end itemize
1138