]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/global.itely
Minor changes from mailist.
[lilypond.git] / Documentation / user / global.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
3
4 @c A menu is needed before every deeper *section nesting of @node's; run 
5 @c     M-x texinfo-all-menus-update
6 @c to automatically fill in these menus before saving changes
7
8 @node Global issues
9 @chapter Global issues
10
11 This section deals with general lilypond issues, rather than
12 specific notation.
13
14 @menu
15 * Input files::                 
16 * Music expressions again::     
17 * Titles and headers::          
18 * Paper and pages::             
19 * Music layout::                
20 * Multiple movements::          
21 * MIDI output::                 
22 @end menu
23
24
25 @node Input files
26 @section Input files
27
28 The main format of input for LilyPond are text files.  By convention,
29 these files end with ``@code{.ly}''.
30
31 @menu
32 * File structure (introduction)::  
33 * File structure::              
34 * Including LilyPond files::    
35 * Text encoding::               
36 @end menu
37
38
39 @node File structure (introduction)
40 @subsection File structure (introduction)
41
42 A basic example of a lilypond input file is
43
44 @example
45 \version "2.8.0"
46 \score @{
47   @{ @}     % this is a single music expression;
48             % all the music goes in here.
49   \header @{ @}
50   \layout @{ @}
51   \midi @{ @}
52 @}
53 @end example
54
55 @noindent
56 There are many variations of this basic pattern, but this
57 example serves as a useful starting place.
58
59 The major part of this manual is concerned with entering various
60 forms of music in LilyPond.  However, many music expressions are not
61 valid input on their own, for example, a @code{.ly} file containing
62 only a note
63 @example
64 c'4
65 @end example
66
67 @noindent
68 will result in a parsing error.  Instead, music should be inside other
69 expressions, which may be put in a file by themselves.  Such
70 expressions are called toplevel expressions.  The next section enumerates
71 them all.
72
73
74 @node File structure
75 @subsection File structure
76
77 A @code{.ly} file contains any number of toplevel expressions, where a
78 toplevel expression is one of the following
79
80 @itemize @bullet
81 @item
82 An output definition, such as @code{\paper}, @code{\midi}, and
83 @code{\layout}.  Such a definition at the toplevel changes the default
84 settings for the block entered.
85
86 @item
87 A @code{\header} block.  This sets the global header block.  This
88 is the block containing the definitions for book-wide settings, like
89 composer, title, etc. 
90
91 @item
92 An @code{\addquote} statement.  See @ref{Quoting other voices}
93 for more information.
94
95 @item
96 A @code{\score} block.  This score will be collected with other
97 toplevel scores, and combined as a single @code{\book}.
98
99 This behavior can be changed by setting the variable
100 @code{toplevel-score-handler} at toplevel.  The default handler is
101 defined in the init file @file{scm/@/lily@/.scm}.
102
103 The @code{\score} must begin with music, and may contain only
104 one music block.
105
106 @item
107 A @code{\book} block logically combines multiple movements
108 (i.e., multiple @code{\score} blocks) in one document.  A number of
109 @code{\scores} creates a single output file, where all movement are
110 concatenated.
111
112 This behavior can be changed by setting the variable
113 @code{toplevel-book-handler} at toplevel.  The default handler is
114 defined in the init file @file{scm/@/lily@/.scm}.
115
116 @item
117 A compound music expression, such as
118 @example
119 @{ c'4 d' e'2 @}
120 @end example
121
122 This will add the piece in a @code{\score} and format it in a
123 single book together with all other toplevel @code{\score}s and music
124 expressions.  In other words, a file containing only the above
125 music expression will be translated into
126
127 @example
128 \book @{
129   \score @{
130     \new Staff @{
131       \new Voice @{
132         @{ c'4 d' e'2 @}
133       @}
134     @}
135   @}
136         \layout @{ @}
137         \header @{ @}
138 @}
139 @end example
140  
141 This behavior can be changed by setting the variable
142 @code{toplevel-music-handler} at toplevel.  The default handler is
143 defined in the init file @file{scm/@/lily@/.scm}.
144
145 @item
146 A markup text, a verse for example
147 @example
148 \markup @{
149    2.  The first line verse two.
150 @}
151 @end example
152
153 Markup texts are rendered above, between or below the scores or music
154 expressions, wherever they appear.
155
156 @item
157 An identifier, such as
158 @example
159 foo = @{ c4 d e d @}
160 @end example
161
162 This can be used later on in the file by entering @code{\foo}.  The
163 name of an identifier should have alphabetic characters only; no
164 numbers, underscores or dashes.
165
166 @end itemize
167
168 The following example shows three things that may be entered at
169 toplevel
170
171 @example
172 \layout @{
173   % movements are non-justified by default    
174   ragged-right = ##t
175 @}
176
177 \header @{
178    title = "Do-re-mi"
179 @}
180    
181 @{ c'4 d' e2 @}
182 @end example
183
184
185 At any point in a file, any of the following lexical instructions can
186 be entered:
187
188 @itemize @bullet
189 @item @code{\version}
190 @item @code{\include}
191 @item @code{\renameinput}
192 @end itemize 
193
194
195 @node Including LilyPond files
196 @subsection Including LilyPond files
197
198 @cindex @code{\include}
199 @cindex including files
200
201 A large project may be split up into separate files.  To refer to another
202 file, use
203
204 @example
205 \include "otherfile.ly"
206 @end example
207
208 The line @code{\include "file.ly"} is equivalent to pasting the contents
209 of file.ly into the current file at the place where you have the
210 \include.  For example, for a large project you might write separate files
211 for each instrument part and create a ``full score'' file which brings
212 together the individual instrument files.
213
214 The initialization of LilyPond is done in a number of files that are
215 included by default when you start the program, normally transparent to the
216 user.  Run lilypond --verbose to see a list of paths and files that Lily
217 finds.
218
219 Files placed in directory @file{PATH/TO/share/lilypond/VERSION/ly/} (where
220 VERSION is in the form ``2.6.1'') are on the path and available to
221 @code{\include}.  Files in the
222 current working directory are available to \include, but a file of the same
223 name in LilyPond's installation takes precedence.  Files are
224 available to \include from directories in the search path specified as an
225 option when invoking @code{lilypond --include=DIR} which adds DIR to the search
226 path.
227
228 The @code{\include} statement can use full path information, but with the Unix
229 convention @code{"/"} rather than the DOS/Windows @code{"\"}.  For example,
230 if @file{stuff.ly} is located one directory higher than the current working
231 directory, use
232
233 @example
234 \include "../stuff.ly"
235 @end example
236
237
238 @node Text encoding
239 @subsection Text encoding
240
241 LilyPond uses the Pango library to format multi-lingual texts, and
242 does not perform any input-encoding conversions.  This means that any
243 text, be it title, lyric text, or musical instruction containing
244 non-ASCII characters, must be utf-8.  The easiest way to enter such text is
245 by using a Unicode-aware editor and saving the file with utf-8 encoding.  Most
246 popular modern editors have utf-8 support, for example, vim, Emacs,
247 jEdit, and GEdit do.
248
249 Depending on the fonts installed, the following fragment shows Hebrew
250 and Cyrillic lyrics,
251
252 @cindex Cyrillic
253 @cindex Hebrew
254 @cindex ASCII, non
255
256 @lilypondfile[fontload]{utf-8.ly}
257
258 The @TeX{} backend does not handle encoding specially at all.  Strings
259 in the input are put in the output as-is.  Extents of text items in the
260 @TeX{} backend, are determined by reading a file created via the
261 @file{texstr} backend,
262
263 @example
264 lilypond -b texstr input/les-nereides.ly
265 latex les-nereides.texstr
266 @end example
267
268 The last command produces @file{les-nereides.textmetrics}, which is
269 read when you execute
270
271 @example
272 lilypond -b tex input/les-nereides.ly
273 @end example
274
275 Both @file{les-nereides.texstr} and @file{les-nereides.tex} need
276 suitable LaTeX wrappers to load appropriate La@TeX{} packages for
277 interpreting non-ASCII strings.
278
279 To use a Unicode escape sequence, use
280
281 @example
282 #(ly:export (ly:wide-char->utf-8 #x2014))
283 @end example
284
285
286 @seealso
287
288 @inputfileref{input/regression,utf-8.ly}
289
290
291
292 @c  FIXME: --must-- delete/modify this before 2.8.0!!!  -gp
293 @node Music expressions again
294 @section Music expressions again
295
296 Should we include anything about this here?
297
298
299 @node Titles and headers
300 @section Titles and headers
301
302 Almost all printed music includes a title and the composer's name;
303 some pieces include a lot more information.
304
305 @menu
306 * Creating titles::             
307 * Custom titles::               
308 @end menu
309
310
311 @node Creating titles
312 @subsection Creating titles
313
314 Titles are created for each @code{\score} block, and over a
315 @code{\book}.
316
317 The contents of the titles are taken from the @code{\header} blocks.
318 The header block for a book supports the following
319 @table @code
320 @item dedication
321 The dedicatee of the music, centered at the top of the first page.
322
323 @item title
324 The title of the music, centered just below the dedication.
325
326 @item subtitle
327 Subtitle, centered below the title.
328
329 @item subsubtitle
330 Subsubtitle, centered below the subtitle.
331
332 @item poet
333 Name of the poet, flush-left below the subtitle.
334
335 @item composer
336 Name of the composer, flush-right below the subtitle.
337
338 @item meter
339 Meter string, flush-left below the poet.
340
341 @item opus
342 Name of the opus, flush-right below the composer.
343
344 @item arranger
345 Name of the arranger, flush-right below the opus.
346
347 @item instrument
348 Name of the instrument, centered below the arranger.  Also
349 centered at the top of pages (other than the first page).
350
351 @item piece
352 Name of the piece, flush-left below the instrument.
353
354 @cindex page breaks, forcing
355 @item breakbefore
356 This forces the title to start on a new page (set to ##t or ##f).
357
358 @item copyright
359 Copyright notice, centered at the bottom of the first page.  To
360 insert the copyright symbol, see @ref{Text encoding}.
361
362 @item tagline
363 Centered at the bottom of the last page.
364
365 @end table
366
367 Here is a demonstration of the fields available.  Note that you
368 may use any @ref{Text markup} commands in the header.
369
370 @lilypond[quote,verbatim,line-width=11.0\cm]
371 \paper {
372   line-width = 9.0\cm
373   paper-height = 10.0\cm
374 }
375
376 \book {
377   \header {
378     dedication = "dedicated to me"
379     title = \markup \center-align { "Title first line" "Title second line, longer" }
380     subtitle = "the subtitle,"
381     subsubtitle = #(string-append "subsubtitle LilyPond version " (lilypond-version))
382     poet = "Poet"
383     composer =  \markup \center-align { "composer" \small "(1847-1973)" }
384     texttranslator = "Text Translator"
385     meter = \markup { \teeny "m" \tiny "e" \normalsize "t" \large "e" \huge "r" }
386     arranger = \markup { \fontsize #8.5 "a" \fontsize #2.5 "r" \fontsize #-2.5 "r" \fontsize #-5.3 "a" \fontsize #7.5 "nger" }
387     instrument = \markup \bold \italic "instrument"
388     piece = "Piece"
389   }
390
391   \score {
392     { c'1 }
393     \header {
394       piece = "piece1"
395       opus = "opus1" 
396     }
397   }
398   \markup {
399       and now...
400   }
401   \score {
402     { c'1 }
403     \header {
404       piece = "piece2"
405       opus = "opus2" 
406     }
407   }
408 }
409 @end lilypond
410
411 As demonstrated before, you can use multiple @code{\header} blocks. 
412 When same fields appear in different blocks, the latter is used.  
413 Here is a short example.
414
415 @example 
416 \header @{
417   composer = "Composer"
418 @}
419 \header @{
420   title = "Title"
421 @}
422 \score @{
423   \new Staff @{ c'4 @}
424   \header @{
425     title = "New title"  % overwrite previous one
426   @}
427 @}
428 @end example
429
430 If you define the @code{\header} inside the @code{\score} block, then
431 normally only the @code{piece} and @code{opus} headers will be printed.
432 Note that the music expression must come before the @code{\header}.
433
434 @lilypond[quote,verbatim,line-width=11.0\cm]
435 \score {
436   { c'4 }
437   \header {
438     title = "title"  % not printed
439     piece = "piece"
440     opus = "opus"
441   }
442 }
443 @end lilypond
444
445 @cindex @code{printallheaders}
446 @noindent
447 You may change this behavior (and print all the headers when defining
448 @code{\header} inside @code{\score}) by using
449
450 @example
451 \paper@{
452   printallheaders=##t
453 @}
454 @end example
455
456
457 @node Custom titles
458 @subsection Custom titles
459
460 A more advanced option is to change the definitions of the following
461 variables in the @code{\paper} block.  The init file
462 @file{ly/titling-init.ly} lists the default layout.
463
464 @table @code
465 @cindex @code{bookTitleMarkup}
466 @item bookTitleMarkup
467   This is the title put over an entire @code{\book} block.  Typically,
468   it has the composer and the title of the piece
469   
470 @cindex @code{scoreTitleMarkup}
471 @item scoreTitleMarkup
472   This is the title put over a @code{\score} block within a
473 @code{\book}.  Typically, it has the name of the movement (@code{piece}
474 field).
475
476 @cindex @code{oddHeaderMarkup}
477 @item oddHeaderMarkup
478   This is the page header for odd-numbered pages. 
479
480 @cindex @code{evenHeaderMarkup}
481 @item evenHeaderMarkup
482   This is the page header for even-numbered pages.  If unspecified,
483   the odd header is used instead.
484
485   By default, headers are defined such that the page number is on the
486   outside edge, and the instrument is centered.
487
488 @cindex @code{oddFooterMarkup}
489 @item oddFooterMarkup
490   This is the page footer for odd-numbered pages. 
491   
492 @cindex @code{evenFotterMarkup}
493 @item evenFooterMarkup
494   This is the page footer for even-numbered pages.  If unspecified,
495   the odd header is used instead.
496
497   By default, the footer has the copyright notice on the first, and
498   the tagline on the last page.
499 @end table
500
501
502 @cindex \paper
503 @cindex header
504 @cindex footer
505 @cindex page layout
506 @cindex titles
507
508 The following definition will put the title flush left, and the
509 composer flush right on a single line.
510
511 @verbatim
512 \paper {
513   bookTitleMarkup = \markup {
514    \fill-line {
515      \fromproperty #'header:title
516      \fromproperty #'header:composer
517    }
518   }
519 }
520 @end verbatim
521
522
523 @refbugs
524
525 The @code{breakbefore=##t} header requires that there is a @code{piece} header as well.  It may be used as a normal header, or left  blank (@code{=""}) as in the example above, but it must be present.
526
527
528
529 @node Paper and pages
530 @section Paper and pages
531
532 This section deals with the display of music on physical paper.
533
534 @menu
535 * Paper size::                  
536 * Page formatting::             
537 @end menu
538
539
540 @node Paper size
541 @subsection Paper size
542
543 @cindex paper size
544 @cindex page size
545 @cindex @code{papersize}
546
547 To change the paper size, there are two commands,
548 @example
549 #(set-default-paper-size "a4")
550 \paper @{
551   #(set-paper-size "a4")
552 @}
553 @end example
554
555 The first command sets the size of all pages.  The second command sets the size
556 of the pages that the @code{\paper} block applies to -- if the @code{\paper}
557 block is at the top of the file, then it will apply to all pages.  If the
558 @code{\paper} block is inside a @code{\book}, then the paper size will only
559 apply to that book.
560
561 Support for the following paper sizes are included by default,
562 @code{a6}, @code{a5}, @code{a4}, @code{a3}, @code{legal}, @code{letter},
563 @code{11x17} (also known as tabloid).
564
565 Extra sizes may be added by editing the definition for
566 @code{paper-alist} in the initialization file @file{scm/paper.scm}.
567
568 @cindex orientation
569 @cindex landscape
570
571 If the symbol @code{landscape} is supplied as an argument to
572 @code{set-default-paper-size}, the pages will be rotated by 90 degrees,
573 and wider line widths will be set correspondingly.
574
575 @example
576 #(set-default-paper-size "a6" 'landscape)
577 @end example 
578
579
580 @node Page formatting
581 @subsection Page formatting
582
583 @cindex page formatting
584 @cindex margins
585 @cindex header, page
586 @cindex footer, page
587
588 LilyPond will do page layout, set margins, and add headers and
589 footers to each page.
590
591 The default layout responds to the following settings in the
592 @code{\paper} block.
593
594 @cindex @code{\paper}
595
596 @quotation
597 @table @code
598 @cindex @code{first-page-number}
599 @item first-page-number
600 The value of the page number of the first page.  Default is@tie{}1.
601
602 @cindex @code{printfirst-page-number}
603 @item printfirst-page-number
604 If set to true, will print the page number in the first page.  Default is
605 false.
606
607 @cindex @code{print-page-number}
608 @item print-page-number
609 If set to false, page numbers will not be printed.
610
611 @cindex @code{paper-width}
612 @item paper-width
613 The width of the page.
614
615 @cindex @code{paper-height}
616 @item paper-height
617 The height of the page.
618
619 @cindex @code{top-margin}
620 @item top-margin
621 Margin between header and top of the page.
622
623 @cindex @code{bottom-margin}
624 @item bottom-margin
625 Margin between footer and bottom of the page.
626
627 @cindex @code{left-margin}
628 @item left-margin
629 Margin between the left side of the page and the beginning of the music.
630
631 @cindex @code{line-width}
632 @item line-width
633 The length of the systems.
634
635 @cindex @code{head-separation}
636 @item head-separation
637 Distance between the top-most music system and the page header.
638
639 @cindex @code{foot-separation}
640 @item foot-separation
641 Distance between the bottom-most music system and the page footer.
642
643 @cindex @code{page-top-space}
644 Distance from the top of the printable area to the center of the first
645 staff. This only works for staves which are vertically small. Big staves
646 are set with the top of their bounding box aligned to the top of the
647 printable area.
648
649 @cindex @code{ragged-bottom}
650 @item ragged-bottom
651 If set to true, systems will not be spread across the page.
652
653 This should be set to true for pieces that have only two or three
654 systems per page, for example orchestral scores.
655  
656 @cindex @code{ragged-last-bottom}
657 @item ragged-last-bottom
658 If set to false, systems will be spread to fill the last page.
659
660 Pieces that amply fill two pages or more should have this set to
661 true.
662
663 @cindex @code{system-count}
664 @item system-count
665 This variable, if set, specifies into how many lines a score should be
666 broken.
667
668 @cindex @code{between-system-space}
669 @item between-system-space
670 This dimensions determines the distance between systems.  It is the
671 ideal distance between the center of the bottom staff of one system
672 and the center of the top staff of the next system.
673
674 Increasing this will provide a more even appearance of the page at the
675 cost of using more vertical space.
676
677 @cindex @code{between-system-padding}
678 @item between-system-padding
679 This dimension is the minimum amount of white space that will always
680 be present between the bottom-most symbol of one system, and the
681 top-most of the next system.
682
683 Increasing this will put systems whose bounding boxes almost touch
684 farther apart.
685
686
687 @cindex @code{horizontal-shift}
688 @item horizontal-shift
689 All systems (including titles and system separators) are shifted by
690 this amount to the right. Page markup, such as headers and footers are
691 not affected by this. The purpose of this variable is to make space
692 for instrument names at the left.
693
694 @cindex @code{after-title-space}
695 @item after-title-space
696 Amount of space between the title and the first system.
697
698 @cindex @code{after-title-space}
699 @item before-title-space 
700 Amount of space between the last system of the previous piece and the
701 title of the next.
702
703 @cindex @code{between-title-space}
704 @item between-title-space
705 Amount of space between consecutive titles (e.g., the title of the
706 book and the title of a piece).
707
708 @cindex @code{printallheaders}
709 @item printallheaders
710 Setting this to #t will print all headers for each \score in a
711 \book.  Normally only the piece and opus \headers are printed.
712
713 @cindex @code{systemSeparatorMarkup}
714 @item systemSeparatorMarkup
715 This contains a markup object, which will be inserted between
716 systems.  This is often used for orchestral scores.
717
718 The markup command @code{\slashSeparator} is provided as a sensible
719 default,  for example
720
721 @lilypond[ragged-right]
722 \paper {
723   systemSeparatorMarkup = \slashSeparator
724 }
725
726 \relative { c1 \break c1 }
727 @end lilypond
728
729
730 @end table
731 @end quotation
732
733 Example:
734
735 @example
736 \paper@{
737   paper-width = 2\cm
738   top-margin = 3\cm
739   bottom-margin = 3\cm
740   ragged-last-bottom = ##t
741 @}
742 @end example
743
744 You can also define these values in Scheme.  In that case @code{mm},
745 @code{in}, @code{pt}, and @code{cm} are variables defined in
746 @file{paper-defaults.ly} with values in millimeters.  That's why the
747 value has to be multiplied in the example
748
749 @example
750 \paper @{
751   #(define bottom-margin (* 2 cm)) 
752 @}
753 @end example
754
755 @cindex copyright
756 @cindex tagline
757
758 The default footer is empty, except for the first page, where the
759 @code{copyright} field from @code{\header} is inserted, and the last
760 page, where @code{tagline} from @code{\header} is added.  The default
761 tagline is ``Music engraving by LilyPond (@var{version})''.@footnote{Nicely
762 printed parts are good PR for us, so please leave the tagline if you
763 can.}
764
765 The header and footer are created by the functions @code{make-footer}
766 and @code{make-header}, defined in @code{\paper}.  The default
767 implementations are in @file{scm/@/page@/-layout@/.scm}.
768
769 The page layout itself is done by two functions in the
770 @code{\paper} block, @code{page-music-height} and
771 @code{page-make-stencil}.  The former tells the line-breaking algorithm
772 how much space can be spent on a page, the latter creates the actual
773 page given the system to put on it.
774
775
776 @refbugs
777
778 The option right-margin is defined but doesn't set the right margin
779 yet.  The value for the right margin has to be defined adjusting the
780 values of @code{left-margin} and @code{line-width}.
781
782 The default page header puts the page number and the @code{instrument}
783 field from the @code{\header} block on a line.
784
785
786
787 @node Music layout
788 @section Music layout
789
790 This section deals with the manner in which the music is printed
791 within the boundaries defined by the @code{\paper} block.
792
793 The global paper layout is determined by three factors: the page layout, the
794 line breaks, and the spacing.  These all influence each other.  The
795 choice of spacing determines how densely each system of music is set.
796 This influences where line breaks are chosen, and thus ultimately, how
797 many pages a piece of music takes.
798
799 Globally spoken, this procedure happens in three steps: first,
800 flexible distances (``springs'') are chosen, based on durations.  All
801 possible line breaking combinations are tried, and the one with the
802 best results -- a layout that has uniform density and requires as
803 little stretching or cramping as possible -- is chosen.
804
805 After spacing and linebreaking, the systems are distributed across
806 pages, taking into account the size of the page, and the size of the
807 titles.
808
809 @menu
810 * Setting global staff size::   
811 * Selecting notation font size::  
812 * Score layout::                
813 * Vertical spacing::            
814 * Vertical spacing of piano staves::  
815 * Horizontal spacing::          
816 * Line length::                 
817 * Line breaking::               
818 * Page breaking::               
819 @end menu
820
821
822 @node Setting global staff size
823 @subsection Setting global staff size
824
825 @cindex font size, setting
826 @cindex staff size, setting
827 @cindex @code{layout} file
828
829 To set the global staff size, use @code{set-global-staff-size}.
830
831 @example
832 #(set-global-staff-size 14)
833 @end example
834
835 @noindent
836 This sets the global default size to 14pt staff height and scales all
837 fonts accordingly.
838
839 The Feta font provides musical symbols at eight different
840 sizes.  Each font is tuned for a different staff size: at a smaller size
841 the font becomes heavier, to match the relatively heavier staff lines.
842 The recommended font sizes are listed in the following table:
843
844 @quotation
845 @multitable @columnfractions .15 .2 .22 .2
846
847 @item @b{font name}
848 @tab @b{staff height (pt)}
849 @tab @b{staff height (mm)}
850 @tab @b{use}
851
852 @item feta11
853 @tab 11.22
854 @tab 3.9 
855 @tab pocket scores
856
857 @item feta13
858 @tab 12.60
859 @tab 4.4
860 @tab
861  
862 @item feta14
863 @tab 14.14
864 @tab 5.0
865 @tab 
866
867 @item feta16
868 @tab 15.87
869 @tab 5.6
870 @tab 
871
872 @item feta18
873 @tab 17.82
874 @tab 6.3
875 @tab song books
876
877 @item feta20
878 @tab 20
879 @tab 7.0
880 @tab standard parts 
881
882 @item feta23
883 @tab 22.45 
884 @tab 7.9
885 @tab 
886
887 @item feta26
888 @tab 25.2 
889 @tab 8.9
890 @tab
891 @c modern rental material?
892
893 @end multitable
894 @end quotation
895
896 These fonts are available in any sizes.  The context property
897 @code{fontSize} and the layout property @code{staff-space} (in
898 @internalsref{StaffSymbol}) can be used to tune the size for individual
899 staves.  The sizes of individual staves are relative to the global size.
900
901 @example
902
903 @end example
904
905 @seealso
906
907 This manual: @ref{Selecting notation font size}.
908
909
910 @node Selecting notation font size
911 @subsection Selecting notation font size
912
913 The easiest method of setting the font size of any context, is by
914 setting the @code{fontSize} property.
915
916 @lilypond[quote,fragment,relative=1,verbatim]
917 c8
918 \set fontSize = #-4
919 c f
920 \set fontSize = #3
921 g
922 @end lilypond
923
924 @noindent
925 It does not change the size of variable symbols, such as beams or
926 slurs.
927
928 Internally, the @code{fontSize} context property will cause the
929 @code{font-size} property to be set in all layout objects.  The value
930 of @code{font-size} is a number indicating the size relative to the
931 standard size for the current staff height.  Each step up is an
932 increase of approximately 12% of the font size.  Six steps is exactly a
933 factor two.  The Scheme function @code{magstep} converts a
934 @code{font-size} number to a scaling factor.
935
936 @lilypond[quote,fragment,relative=1,verbatim]
937 c8
938 \override NoteHead #'font-size = #-4
939 c f
940 \override NoteHead #'font-size = #3
941 g
942 @end lilypond
943
944 LilyPond has fonts in different design sizes.  The music fonts for
945 smaller sizes are chubbier, while the text fonts are relatively wider.
946 Font size changes are achieved by scaling the design size that is
947 closest to the desired size.  The standard font size (for
948 @code{font-size} equals 0), depends on the standard staff height.  For
949 a 20pt staff, a 10pt font is selected.
950
951 The @code{font-size} property can only be set on layout objects that
952 use fonts. These are the ones supporting the
953 @internalsref{font-interface} layout interface.
954
955 @refcommands
956
957 The following commands set @code{fontSize} for the current voice:
958
959 @cindex @code{\tiny}
960 @code{\tiny}, 
961 @cindex @code{\small}
962 @code{\small}, 
963 @cindex @code{\normalsize}
964 @code{\normalsize}.
965
966
967 @node Score layout
968 @subsection Score layout
969
970 @cindex @code{\layout}
971
972 While @code{\paper} contains settings that relate to the page formatting
973 of the whole document, @code{\layout} contains settings for score-specific
974 layout.
975
976 @example
977 \layout @{
978   indent = 2.0\cm
979   \context @{ \Staff
980     \override VerticalAxisGroup #'minimum-Y-extent = #'(-6 . 6)
981   @}
982   \context @{ \Voice
983     \override TextScript #'padding = #1.0
984     \override Glissando #'thickness = #3
985   @}
986 @}
987 @end example
988
989
990 @seealso
991
992 This manual: @ref{Changing context default settings}
993
994
995 @node Vertical spacing
996 @subsection Vertical spacing
997
998 @cindex vertical spacing
999 @cindex distance between staves
1000 @cindex staff distance
1001 @cindex between staves, distance
1002 @cindex staves per page
1003 @cindex space between staves
1004
1005 The height of each system is determined automatically.  To prevent
1006 systems from bumping into each other, some minimum distances are set.
1007 By changing these, you can put staves closer together, and thus put
1008 more systems onto one page.
1009
1010 Normally staves are stacked vertically.  To make staves maintain a
1011 distance, their vertical size is padded.  This is done with the
1012 property @code{minimum-Y-extent}.  It takes a pair of numbers, so
1013 if you want to make it smaller than its default @code{#'(-4 . 4)},
1014 then you could set. When applied to a
1015 @internalsref{VerticalAxisGroup}, it controls the size of a horizontal
1016 line, such as a staff or a line of lyrics.  
1017
1018 @example
1019 \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)
1020 @end example
1021
1022 @noindent
1023 This sets the vertical size of the current staff to 3 staff spaces on
1024 either side of the center staff line.  The value @code{(-3 . 3)} is
1025 interpreted as an interval, where the center line is the 0, so the
1026 first number is generally negative.  The staff can be made larger at
1027 the bottom by setting it to @code{(-6 . 4)}.
1028
1029 The spacing of staves in a system may also be tuned per system.  This is
1030 done with the command
1031
1032 @example
1033 \overrideProperty
1034 #"Score.NonMusicalPaperColumn"
1035 #'line-break-system-details
1036 #'((alignment-extra-space . 15))
1037 @end example
1038
1039 @noindent
1040 at the line break before the system to be changed. The distance
1041 @code{15} is distributed over all staves that have a fixed distance
1042 alignment.  For example,
1043
1044 @lilypond[ragged-right, fragment, relative=2, staffsize=13]
1045 \new StaffGroup <<
1046   \new Staff { 
1047     c1\break 
1048         
1049     \overrideProperty
1050     #"Score.NonMusicalPaperColumn"
1051     #'line-break-system-details
1052     #'((fixed-alignment-extra-space . 15))
1053
1054     c\break 
1055   }
1056   \new Staff { c c }
1057 >>
1058 @end lilypond
1059
1060 The distance for @code{alignment-extra-space} may also be negative.
1061
1062
1063 To change the amount of space between systems, use
1064 @code{between-system-space}.  A score with only one staff is still
1065 considered to have systems, so setting @code{between-system-space} will
1066 be much more useful than changing @code{minimum-Y-extent} of a Staff
1067 context.
1068
1069 @example
1070 \paper @{
1071   between-system-space = 10\mm
1072 @}
1073 @end example
1074
1075 If you simply want to tell LilyPond ``fit as much as possible onto
1076 these pages, then expand to fill any available space on the pages,''
1077 then use the following
1078
1079 @example
1080 \paper @{
1081   between-system-padding = #1
1082   ragged-bottom=##f
1083   ragged-last-bottom=##f
1084 @}
1085 @end example
1086
1087
1088 @c let's wait for a some comments before writing more.
1089
1090 The vertical spacing on a page can also be changed for each system individually.
1091 Some examples are found in the example file
1092 @inputfileref{input/regression/,page-spacing.ly}.
1093
1094 When setting @code{annotatespacing} in the @code{\paper} block LilyPond
1095 will graphically indicate the dimensions of properties that may be set
1096 for page spacing,
1097
1098 @lilypond[verbatim]
1099 #(set-default-paper-size "a7" 'landscape)
1100 \paper { annotatespacing = ##t }
1101 { c4 }
1102 @end lilypond
1103
1104 @noindent
1105 All units dimensions are measured in staff spaces. The pairs
1106 (@var{a},@var{b}) are intervals, where @var{a} is the lower edge and
1107 @var{b} the upper edge of the interval.
1108
1109 @seealso
1110
1111 Internals: Vertical alignment of staves is handled by the
1112 @internalsref{VerticalAlignment} object. The context parameters
1113 specifying  the vertical extent are described in connection with 
1114 the @internalsref{Axis_group_engraver}.
1115
1116 Example files: @inputfileref{input/regression/,page-spacing.ly},
1117 @inputfileref{input/regression/,alignment-vertical-spacing.ly}.
1118
1119
1120
1121
1122 @node Vertical spacing of piano staves
1123 @subsection Vertical spacing of piano staves
1124
1125 The distance between staves of a @internalsref{PianoStaff} cannot be
1126 computed during formatting.  Rather, to make cross-staff beaming work
1127 correctly, that distance has to be fixed beforehand.
1128  
1129 The distance of staves in a @code{PianoStaff} is set with the
1130 @code{forced-distance} property of the
1131 @internalsref{VerticalAlignment} object, created in
1132 @internalsref{PianoStaff}.
1133
1134 It can be adjusted as follows
1135 @example
1136 \new PianoStaff \with @{
1137   \override VerticalAlignment #'forced-distance = #7
1138 @} @{
1139   ...
1140 @}
1141 @end example
1142
1143 @noindent
1144 This would bring the staves together at a distance of 7 staff spaces,
1145 measured from the center line of each staff.
1146
1147 The difference is demonstrated in the following example,
1148 @lilypond[quote,verbatim]
1149 \relative c'' <<
1150   \new PianoStaff \with {
1151     \override VerticalAlignment #'forced-distance = #7
1152   } <<
1153     \new Staff { c1 }
1154     \new Staff { c }
1155   >>
1156   \new PianoStaff <<
1157     \new Staff { c }
1158     \new Staff { c }
1159   >>
1160 >>    
1161 @end lilypond
1162
1163
1164 It is also possible to change the distance between for each system
1165 individually.  This is done by including the command 
1166
1167 @example
1168 \overrideProperty
1169 #"Score.NonMusicalPaperColumn"
1170 #'line-break-system-details
1171 #'((fixed-alignment-extra-space . 15))
1172 @end example
1173
1174 @noindent
1175 at the line break before the system to be changed. The distance
1176 @code{15} is distributed over all staves that have a fixed distance
1177 alignment.  For example,
1178
1179 @lilypond[ragged-right, fragment, relative=2, staffsize=13]
1180 \new PianoStaff <<
1181   \new Staff { 
1182     c1\break 
1183         
1184     \overrideProperty
1185     #"Score.NonMusicalPaperColumn"
1186     #'line-break-system-details
1187     #'((fixed-alignment-extra-space . 15))
1188
1189     c\break 
1190   }
1191   \new Staff { c c }
1192 >>
1193 @end lilypond
1194
1195 The distance for @code{fixed-alignment-extra-space} may also be
1196 negative.
1197
1198 @seealso
1199
1200 Example files: @inputfileref{input/regression/,alignment-vertical-spacing.ly}.
1201
1202 @node Horizontal spacing
1203 @subsection Horizontal Spacing
1204
1205 The spacing engine translates differences in durations into stretchable
1206 distances (``springs'') of differring lengths.  Longer durations get
1207 more space, shorter durations get less.  The shortest durations get a
1208 fixed amount of space (which is controlled by
1209 @code{shortest-duration-space} in the @internalsref{SpacingSpanner}
1210 object).  The longer the duration, the more space it gets: doubling a
1211 duration adds a fixed amount (this amount is controlled by
1212 @code{spacing-increment}) of space to the note.
1213
1214 For example, the following piece contains lots of half, quarter, and
1215 8th notes; the eighth note is followed by 1 note head width (NHW). 
1216 The quarter note is followed by 2 NHW, the half by 3 NHW, etc.
1217
1218 @lilypond[quote,fragment,verbatim,relative=1]
1219 c2 c4. c8 c4. c8 c4. c8 c8
1220 c8 c4 c4 c4
1221 @end lilypond
1222
1223 Normally, @code{spacing-increment} is set to 1.2 staff space, which is
1224 approximately the width of a note head, and
1225 @code{shortest-duration-space} is set to 2.0, meaning that the
1226 shortest note gets 2.4 staff space (2.0 times the
1227 @code{spacing-increment}) of horizontal space.  This space is counted
1228 from the left edge of the symbol, so the shortest notes are generally
1229 followed by one NHW of space.
1230
1231 If one would follow the above procedure exactly, then adding a single
1232 32nd note to a score that uses 8th and 16th notes, would widen up the
1233 entire score a lot.  The shortest note is no longer a 16th, but a 32nd,
1234 thus adding 1 NHW to every note.  To prevent this, the shortest
1235 duration for spacing is not the shortest note in the score, but rather
1236 the one which occurs most frequently.
1237
1238
1239 The most common shortest duration is determined as follows: in every
1240 measure, the shortest duration is determined.  The most common shortest
1241 duration is taken as the basis for the spacing, with the stipulation
1242 that this shortest duration should always be equal to or shorter than
1243 an 8th note.  The shortest duration is printed when you run
1244 @code{lilypond} with the @code{--verbose} option.
1245
1246 These durations may also be customized.  If you set the
1247 @code{common-shortest-duration} in @internalsref{SpacingSpanner}, then
1248 this sets the base duration for spacing.  The maximum duration for this
1249 base (normally an 8th), is set through @code{base-shortest-duration}.
1250
1251 @cindex @code{common-shortest-duration}
1252 @cindex @code{base-shortest-duration}
1253 @cindex @code{stem-spacing-correction}
1254 @cindex @code{spacing}
1255
1256 Notes that are even shorter than the common shortest note are
1257 followed by a space that is proportional to their duration relative to
1258 the common shortest note.  So if we were to add only a few 16th notes
1259 to the example above, they would be followed by half a NHW:
1260
1261 @lilypond[quote,fragment,verbatim,relative=2]
1262 c2 c4. c8 c4. c16[ c] c4. c8 c8 c8 c4 c4 c4
1263 @end lilypond
1264
1265
1266 In the introduction (see @ref{Engraving}), it was explained that stem
1267 directions influence spacing.  This is controlled with the
1268 @code{stem-spacing-correction} property in the
1269 @internalsref{NoteSpacing}, object.  These are generated for every
1270 @internalsref{Voice} context.  The @code{StaffSpacing} object
1271 (generated in @internalsref{Staff} context) contains the same property
1272 for controlling the stem/bar line spacing.  The following example shows
1273 these corrections, once with default settings, and once with
1274 exaggerated corrections:
1275
1276 @lilypond[quote,ragged-right]
1277 {
1278   c'4 e''4 e'4 b'4 |
1279   b'4 e''4 b'4 e''4|
1280   \override Staff.NoteSpacing #'stem-spacing-correction = #1.5
1281   \override Staff.StaffSpacing #'stem-spacing-correction = #1.5
1282   c'4 e''4 e'4 b'4 |
1283   b'4 e''4 b'4 e''4|      
1284 }
1285 @end lilypond
1286
1287 Proportional notation is supported; see @ref{Proportional notation}.
1288
1289 By default, spacing in tuplets depends on various non-duration
1290 factors (such as accidentals, clef changes, etc).  To disregard
1291 such symbols and force uniform equal-duration spacing, use
1292 @code{Score.SpacingSpanner #'uniform-stretching}.  This
1293 property can only be changed at the beginning of a score,
1294
1295 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1296 \new Score \with {
1297   \override SpacingSpanner #'uniform-stretching = ##t
1298 } <<
1299   \new Staff{
1300     \times 4/5 {
1301       c8 c8 c8 c8 c8
1302     }
1303     c8 c8 c8 c8
1304   }
1305   \new Staff{
1306     c8 c8 c8 c8
1307     \times 4/5 {
1308       c8 c8 c8 c8 c8
1309     }
1310   }
1311 >>
1312 @end lilypond
1313
1314
1315 When @code{strict-note-spacing} is set, notes are spaced without
1316 regard for clefs, bar lines, and grace notes,
1317
1318 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1319 \override Score.SpacingSpanner #'strict-note-spacing = ##t 
1320 \new Staff { c8[ c \clef alto c \grace { c16[ c] } c8 c c]  c32[ c32] }
1321 @end lilypond
1322
1323
1324 @seealso
1325
1326 Internals: @internalsref{SpacingSpanner}, @internalsref{NoteSpacing},
1327 @internalsref{StaffSpacing}, @internalsref{SeparationItem}, and
1328 @internalsref{SeparatingGroupSpanner}.
1329
1330 @refbugs
1331
1332 Spacing is determined on a score wide basis.  If you have a score that
1333 changes its character (measured in durations) halfway during the
1334 score, the part containing the longer durations will be spaced too
1335 widely.
1336
1337 There is no convenient mechanism to manually override spacing.  The
1338 following work-around may be used to insert extra space into a score.
1339 @example
1340  \once \override Score.SeparationItem #'padding = #1
1341 @end example
1342
1343 No work-around exists for decreasing the amount of space.
1344
1345
1346 @node Line length
1347 @subsection Line length
1348
1349 @cindex page breaks
1350 @cindex breaking pages
1351
1352 @cindex @code{indent}
1353 @cindex @code{line-width}
1354 @cindex @code{ragged-right}
1355
1356 @c Although line-width can be set in \layout, it should be set in paper
1357 @c block, to get page layout right.
1358 @c Setting indent in \paper block makes not much sense, but it works.
1359
1360 @c Bit verbose and vague, use examples?
1361 The most basic settings influencing the spacing are @code{indent} and
1362 @code{line-width}.  They are set in the @code{\layout} block.  They
1363 control the indentation of the first line of music, and the lengths of
1364 the lines.
1365
1366 If @code{ragged-right} is set to true in the @code{\layout} block, then
1367 the lines are justified at their natural length.  This is useful for
1368 short fragments, and for checking how tight the natural spacing is.
1369
1370 @cindex page layout
1371 @cindex vertical spacing
1372
1373 The option @code{raggedlast} is similar to @code{ragged-right}, but
1374 only affects the last line of the piece.  No restrictions are put on
1375 that line.  The result is similar to formatting text paragraphs.  In a
1376 paragraph, the last line simply takes its natural length.
1377 @c Note that for text there are several options for the last line.
1378 @c While Knuth TeX uses natural length, lead typesetters use the same
1379 @c stretch as the previous line.  eTeX uses \lastlinefit to
1380 @c interpolate between both these solutions.
1381
1382
1383 @node Line breaking
1384 @subsection Line breaking
1385
1386 @cindex line breaks
1387 @cindex breaking lines
1388
1389 Line breaks are normally computed automatically.  They are chosen so
1390 that lines look neither cramped nor loose, and that consecutive lines
1391 have similar density.
1392
1393 Occasionally you might want to override the automatic breaks; you can
1394 do this by specifying @code{\break}.  This will force a line break at
1395 this point.  Line breaks can only occur at places where there are bar
1396 lines.  If you want to have a line break where there is no bar line,
1397 you can force an invisible bar line by entering @code{\bar
1398 ""}.  Similarly, @code{\noBreak} forbids a line break at a 
1399 point.
1400
1401
1402 @cindex regular line breaks
1403 @cindex four bar music. 
1404
1405 For line breaks at regular intervals use @code{\break} separated by
1406 skips and repeated with @code{\repeat}:
1407 @example
1408 << \repeat unfold 7 @{
1409          s1 \noBreak s1 \noBreak
1410          s1 \noBreak s1 \break @}
1411    @emph{the real music}
1412 >> 
1413 @end example
1414
1415 @noindent
1416 This makes the following 28 measures (assuming 4/4 time) be broken every
1417 4 measures, and only there.
1418
1419 @refcommands
1420
1421 @code{\break}, and @code{\noBreak}.
1422 @cindex @code{\break}
1423 @cindex @code{\noBreak}
1424
1425 @seealso
1426
1427 Internals: @internalsref{BreakEvent}.
1428
1429 A linebreaking configuration can now be saved as a @code{.ly} file
1430 automatically.  This allows vertical alignments to be stretched to
1431 fit pages in a second formatting run.  This is fairly new and
1432 complicated; see @inputfileref{input/regression/,page-layout-twopass.ly}
1433 for details.
1434
1435
1436 @node Page breaking
1437 @subsection Page breaking
1438
1439 The default page breaking may be overriden by inserting
1440 @code{\pageBreak} or @code{\noPageBreak} commands.  These commands are
1441 analogous to @code{\break} and @code{\noBreak}.  They should be
1442 inserted at a bar line.  These commands force and forbid a page-break
1443 from happening.  Of course, the @code{\pageBreak} command also forces
1444 a line break.
1445
1446 Page breaks are computed by the @code{page-breaking} function in the
1447 @code{\paper} block. 
1448
1449 To force a new page for a new piece (in a collection of pieces or a
1450 piece in several movements), use @code{breakbefore} in the header.
1451
1452 @example
1453 \header@{
1454   breakbefore = ##t
1455   piece = ""
1456 @}
1457 @end example
1458
1459 @refcommands
1460
1461 @cindex @code{\pageBreak}
1462 @code{\pageBreak}
1463 @cindex @code{\noPageBreak} 
1464 @code{\noPageBreak} 
1465
1466
1467 @refbugs
1468
1469 The @code{breakbefore=##t} header requires that there is a @code{piece} header as well.  It may be used as a normal header, or left  blank (@code{=""}) as in the example above, but it must be present.
1470
1471
1472
1473 @node Multiple movements
1474 @section Multiple movements
1475
1476 @cindex bibliographic information
1477 @cindex titles
1478 @cindex composer
1479 @cindex Music engraving by LilyPond
1480
1481 A document may contain multiple pieces of music and texts.  Examples
1482 of these are an etude book, or an orchestral part with multiple
1483 movements.  Each movement is entered with a @code{\score} block,
1484
1485 @example
1486 \score @{
1487   @var{..music..}
1488 @}
1489 @end example
1490
1491 and texts are entered with a @code{\markup} block,
1492
1493 @example
1494 \markup @{
1495   @var{..text..}
1496 @}
1497 @end example
1498
1499 @cindex @code{\book}
1500
1501 The movements and texts are combined together in a @code{\book} block,
1502 like
1503
1504 @example
1505 \book @{
1506   \score @{
1507     @var{..}
1508   @}
1509   \markup @{
1510     @var{..}
1511   @}
1512   \score @{
1513     @var{..}
1514   @}
1515 @}
1516 @end example
1517
1518
1519 The header for each piece of music can be put inside the @code{\score}
1520 block.  The @code{piece} name from the header will be printed before
1521 each movement.  The title for the entire book can be put inside the
1522 @code{\book}, but if it is not present, the @code{\header} which is at
1523 the top of the file is inserted.
1524
1525 @cindex Engraved by LilyPond
1526 @cindex signature line
1527
1528 @example 
1529 \book @{
1530   \header @{
1531     title = "Eight miniatures" 
1532     composer = "Igor Stravinsky"
1533   @}
1534   \score @{
1535     @dots{}
1536     \header @{ piece = "Romanze" @}
1537   @}
1538   \markup @{
1539      ..text of second verse..
1540   @}
1541   \markup @{
1542      ..text of third verse..
1543   @}
1544   \score @{
1545     @dots{}
1546     \header @{ piece = "Menuetto" @}
1547   @}
1548 @}
1549 @end example
1550
1551
1552
1553 @node MIDI output
1554 @section MIDI output
1555
1556 @cindex Sound
1557 @cindex MIDI
1558
1559 MIDI (Musical Instrument Digital Interface) is a standard for
1560 connecting and controlling digital instruments.  A MIDI file is a
1561 series of notes in a number of tracks.  It is not an actual
1562 sound file; you need special software to translate between the
1563 series of notes and actual sounds.
1564
1565 Pieces of music can be converted to MIDI files, so you can listen to
1566 what was entered.  This is convenient for checking the music; octaves
1567 that are off or accidentals that were mistyped stand out very much
1568 when listening to the MIDI output.
1569
1570 @refbugs
1571
1572 Many musically interesting effects, such as swing, articulation,
1573 slurring, etc., are not translated to midi.
1574
1575 The midi output allocates a channel for each staff, and one for global
1576 settings.  Therefore the midi file should not have more than 15 staves
1577 (or 14 if you do not use drums).  Other staves will remain silent.
1578
1579 Not all midi players correctly handle tempo changes in the midi
1580 output.  Players that are known to work include
1581 @uref{http://@/timidity@/.sourceforge@/.net/,timidity}.
1582
1583 @menu
1584 * Creating MIDI files::         
1585 * MIDI block::                  
1586 * MIDI instrument names::       
1587 @end menu
1588
1589 @node Creating MIDI files
1590 @subsection Creating MIDI files 
1591
1592 To create a MIDI from a music piece of music, add a @code{\midi} block
1593 to a score, for example,
1594
1595 @example 
1596 \score @{
1597   @var{...music...}
1598   \midi @{ \tempo 4=72 @}
1599 @}
1600 @end example 
1601
1602 The tempo is specified using the @code{\tempo} command.  In this
1603 example the tempo of quarter notes is set to 72 beats per minute.
1604
1605
1606 If there is a @code{\midi} command in a @code{\score}, only MIDI will
1607 be produced.  When notation is needed too, a @code{\layout} block must
1608 be added
1609
1610 @example 
1611 \score @{
1612   @var{...music...}
1613   \midi @{ \tempo 4=72 @}
1614   \layout @{ @}
1615 @}
1616 @end example 
1617 @cindex layout block
1618
1619
1620
1621 Ties, dynamics, and tempo changes are interpreted.  Dynamic marks,
1622 crescendi and decrescendi translate into MIDI volume levels.  Dynamic
1623 marks translate to a fixed fraction of the available MIDI volume
1624 range, crescendi and decrescendi make the volume vary linearly between
1625 their two extremes.  The fractions can be adjusted by
1626 @code{dynamicAbsoluteVolumeFunction} in @internalsref{Voice} context.
1627 For each type of MIDI instrument, a volume range can be defined.  This
1628 gives a basic equalizer control, which can enhance the quality of
1629 the MIDI output remarkably.  The equalizer can be controlled by
1630 setting @code{instrumentEqualizer}.
1631
1632 To remove dynamics from the MIDI output, insert the following lines
1633 in the @code{\midi@{@}} section.
1634
1635 @example
1636 \midi @{
1637   ...
1638   \context @{
1639     \Voice
1640     \remove "Dynamic_performer"
1641     \remove "Span_dynamic_performer"
1642   @}
1643 @}
1644 @end example
1645
1646
1647 @refbugs
1648
1649 Unterminated (de)crescendos will not render properly in the midi file,
1650 resulting in silent passages of music.  The workaround is to explicitly
1651 terminate the (de)crescendo.  For example,
1652
1653 @example
1654 @{ a\< b c d\f @}
1655 @end example
1656
1657 @noindent
1658 will not work properly but
1659
1660 @example
1661 @{ a\< b c d\!\f @}
1662 @end example
1663
1664 @noindent
1665 will.
1666
1667
1668 @node MIDI block
1669 @subsection MIDI block
1670 @cindex MIDI block
1671
1672
1673 The MIDI block is analogous to the layout block, but it is somewhat
1674 simpler.  The @code{\midi} block can contain
1675 @cindex MIDI block
1676
1677 @itemize @bullet
1678   @item a @code{\tempo} definition, and
1679   @item context definitions.
1680 @end itemize
1681
1682 A number followed by a period is interpreted as a real number, so
1683 for setting the tempo for dotted notes, an extra space should be
1684 inserted, for example
1685
1686 @example
1687 \midi @{ \tempo 4 . = 120 @} 
1688 @end example
1689
1690
1691 @cindex context definition
1692
1693 Context definitions follow precisely the same syntax as within the
1694 \layout block.  Translation modules for sound are called performers.
1695 The contexts for MIDI output are defined in @file{ly/@/performer@/-init@/.ly}.
1696
1697
1698 @node MIDI instrument names
1699 @subsection MIDI instrument names
1700
1701 @cindex instrument names
1702 @cindex @code{Staff.midiInstrument}
1703
1704 The MIDI instrument name is set by the @code{Staff.midiInstrument}
1705 property.  The instrument name should be chosen from the list in
1706 @ref{MIDI instruments}.
1707
1708 @example
1709 \set Staff.midiInstrument = "glockenspiel"
1710 @var{...notes...}
1711 @end example
1712
1713 If the selected instrument does not exactly match an instrument from
1714 the list of MIDI instruments, the Grand Piano (@code{"acoustic grand"})
1715 instrument is used.
1716