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