1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
4 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
6 When revising a translation, copy the HEAD committish of the
7 version that you are working on. See TRANSLATION for details.
15 This section deals with general LilyPond input syntax issues,
16 rather than specific notation.
18 FIXME: don't complain about anything in this chapter. It's still
19 under heavy development.
23 * Titles and headers::
24 * Working with input files::
25 * Controlling output::
31 @section Input structure
33 The main format of input for LilyPond are text files. By convention,
34 these files end with @code{.ly}.
37 * Structure of a score::
38 * Multiple scores in a book::
43 @node Structure of a score
44 @subsection Structure of a score
48 A @code{\score} block must contain a single music expression
49 delimited by curly brackets:
57 @warning{There must be @strong{only one} outer music expression in
58 a @code{\score} block, and it @strong{must} be surrounded by
61 This single music expression may be of any size, and may contain
62 other music expressions to any complexity. All of these examples
63 are music expressions:
69 @lilypond[verbatim,quote]
76 @lilypond[verbatim,quote]
78 \new Staff { c'4 c' c' c' }
79 \new Staff { d'4 d' d' d' }
87 \new Staff @{ \flute @}
88 \new Staff @{ \oboe @}
91 \new Staff @{ \violinI @}
92 \new Staff @{ \violinII @}
98 Comments are one exception to this general rule. (For others see
99 @ref{File structure}.) Both single-line comments and comments
100 delimited by @code{%@{ .. %@}} may be placed anywhere within an
101 input file. They may be placed inside or outside a @code{\score}
102 block, and inside or outside the single music expression within a
109 @rlearning{Working on input files},
110 @rlearning{Music expressions explained},
111 @rlearning{Score is a (single) compound musical expression}.
114 @node Multiple scores in a book
115 @subsection Multiple scores in a book
118 @cindex movements, multiple
120 A document may contain multiple pieces of music and text. Examples
121 of these are an etude book, or an orchestral part with multiple
122 movements. Each movement is entered with a @code{\score} block,
130 and texts are entered with a @code{\markup} block,
140 All the movements and texts which appear in the same @code{.ly} file
141 will normally be typeset in the form of a single output file.
155 However, if you want multiple output files from the same @code{.ly}
156 file, then you can add multiple @code{\book} blocks, where each such
157 @code{\book} block will result in a separate output. If you do not
158 specify any @code{\book} block in the file, LilyPond will implicitly
159 treat the full file as a single @code{\book} block, see @ref{File
160 structure}. One important exception is within lilypond-book documents,
161 where you explicitly have to add a @code{\book} block, otherwise only
162 the first @code{\score} or @code{\markup} will appear in the output.
164 The header for each piece of music can be put inside the @code{\score}
165 block. The @code{piece} name from the header will be printed before
166 each movement. The title for the entire book can be put inside the
167 @code{\book}, but if it is not present, the @code{\header} which is at
168 the top of the file is inserted.
172 title = "Eight miniatures"
173 composer = "Igor Stravinsky"
177 \header @{ piece = "Romanze" @}
180 ..text of second verse..
183 ..text of third verse..
187 \header @{ piece = "Menuetto" @}
192 @subsection File structure
201 A @code{.ly} file may contain any number of toplevel expressions, where a
202 toplevel expression is one of the following:
206 An output definition, such as @code{\paper}, @code{\midi}, and
207 @code{\layout}. Such a definition at the toplevel changes the default
208 book-wide settings. If more than one such definition of
209 the same type is entered at the top level any definitions in the later
210 expressions have precedence.
213 A direct scheme expression, such as
214 @code{#(set-default-paper-size "a7" 'landscape)} or
215 @code{#(ly:set-option 'point-and-click #f)}.
218 A @code{\header} block. This sets the global header block. This
219 is the block containing the definitions for book-wide settings, like
220 composer, title, etc.
223 A @code{\score} block. This score will be collected with other
224 toplevel scores, and combined as a single @code{\book}.
225 This behavior can be changed by setting the variable
226 @code{toplevel-score-handler} at toplevel. The default handler is
227 defined in the init file @file{scm/@/lily@/.scm}.
230 A @code{\book} block logically combines multiple movements
231 (i.e., multiple @code{\score} blocks) in one document. If there
232 are a number of @code{\score}s, one output file will be created
233 for each @code{\book} block, in which all corresponding movements
234 are concatenated. The only reason to explicitly specify
235 @code{\book} blocks in a @code{.ly} file is if you wish to create
236 multiple output files from a single input file. One exception is
237 within lilypond-book documents, where you explicitly have to add
238 a @code{\book} block if you want more than a single @code{\score}
239 or @code{\markup} in the same example. This behavior can be
240 changed by setting the variable @code{toplevel-book-handler} at
241 toplevel. The default handler is defined in the init file
242 @file{scm/@/lily@/.scm}.
245 A compound music expression, such as
250 This will add the piece in a @code{\score} and format it in a
251 single book together with all other toplevel @code{\score}s and music
252 expressions. In other words, a file containing only the above
253 music expression will be translated into
269 This behavior can be changed by setting the variable
270 @code{toplevel-music-handler} at toplevel. The default handler is
271 defined in the init file @file{scm/@/lily@/.scm}.
274 A markup text, a verse for example
277 2. The first line verse two.
281 Markup texts are rendered above, between or below the scores or music
282 expressions, wherever they appear.
292 This can be used later on in the file by entering @code{\foo}. The
293 name of an variable should have alphabetic characters only; no
294 numbers, underscores or dashes.
298 The following example shows three things that may be entered at
303 % Don't justify the output
315 At any point in a file, any of the following lexical instructions can
319 @item @code{\version}
320 @item @code{\include}
321 @item @code{\sourcefilename}
322 @item @code{\sourcefileline}
324 A single-line comment, introduced by a leading @code{%} sign.
327 A multi-line comment delimited by @code{%@{ .. %@}}.
334 @rlearning{How LilyPond input files work}.
336 @node Titles and headers
337 @section Titles and headers
339 Almost all printed music includes a title and the composer's name;
340 some pieces include a lot more information.
345 * Reference to page numbers::
346 * Table of contents::
350 @node Creating titles
351 @subsection Creating titles
353 Titles are created for each @code{\score} block, as well as for the full
354 input file (or @code{\book} block).
356 The contents of the titles are taken from the @code{\header} blocks.
357 The header block for a book supports the following
363 The dedicatee of the music, centered at the top of the first page.
367 The title of the music, centered just below the dedication.
371 Subtitle, centered below the title.
373 @funindex subsubtitle
375 Subsubtitle, centered below the subtitle.
379 Name of the poet, flush-left below the subtitle.
383 Name of the composer, flush-right below the subtitle.
387 Meter string, flush-left below the poet.
391 Name of the opus, flush-right below the composer.
395 Name of the arranger, flush-right below the opus.
399 Name of the instrument, centered below the arranger. Also
400 centered at the top of pages (other than the first page).
404 Name of the piece, flush-left below the instrument.
406 @cindex page breaks, forcing
407 @funindex breakbefore
409 This forces the title to start on a new page (set to ##t or ##f).
413 Copyright notice, centered at the bottom of the first page. To
414 insert the copyright symbol, see @ref{Text encoding}.
418 Centered at the bottom of the last page.
422 Here is a demonstration of the fields available. Note that you
423 may use any @ref{Formatting text}, commands in the header.
425 @lilypond[quote,verbatim,line-width=11.0\cm]
428 paper-height = 10.0\cm
433 dedication = "dedicated to me"
434 title = \markup \center-align { "Title first line" "Title second line,
436 subtitle = "the subtitle,"
437 subsubtitle = #(string-append "subsubtitle LilyPond version "
440 composer = \markup \center-align { "composer" \small "(1847-1973)" }
441 texttranslator = "Text Translator"
442 meter = \markup { \teeny "m" \tiny "e" \normalsize "t" \large "e" \huge
444 arranger = \markup { \fontsize #8.5 "a" \fontsize #2.5 "r" \fontsize
445 #-2.5 "r" \fontsize #-5.3 "a" \fontsize #7.5 "nger" }
446 instrument = \markup \bold \italic "instrument"
470 As demonstrated before, you can use multiple @code{\header} blocks.
471 When same fields appear in different blocks, the latter is used.
472 Here is a short example.
476 composer = "Composer"
484 piece = "New piece" % overwrite previous one
489 If you define the @code{\header} inside the @code{\score} block, then
490 normally only the @code{piece} and @code{opus} headers will be printed.
491 Note that the music expression must come before the @code{\header}.
493 @lilypond[quote,verbatim,line-width=11.0\cm]
497 title = "title" % not printed
504 @funindex printallheaders
506 You may change this behavior (and print all the headers when defining
507 @code{\header} inside @code{\score}) by using
518 The default footer is empty, except for the first page, where the
519 @code{copyright} field from @code{\header} is inserted, and the last
520 page, where @code{tagline} from @code{\header} is added. The default
521 tagline is @qq{Music engraving by LilyPond (@var{version})}.@footnote{Nicely
522 printed parts are good PR for us, so please leave the tagline if you
525 Headers may be completely removed by setting them to false.
536 @subsection Custom titles
538 A more advanced option is to change the definitions of the following
539 variables in the @code{\paper} block. The init file
540 @file{ly/titling-init.ly} lists the default layout.
543 @funindex bookTitleMarkup
544 @item bookTitleMarkup
545 This is the title added at the top of the entire output document.
546 Typically, it has the composer and the title of the piece
548 @funindex scoreTitleMarkup
549 @item scoreTitleMarkup
550 This is the title put over a @code{\score} block. Typically, it has
551 the name of the movement (@code{piece} field).
553 @funindex oddHeaderMarkup
554 @item oddHeaderMarkup
555 This is the page header for odd-numbered pages.
557 @funindex evenHeaderMarkup
558 @item evenHeaderMarkup
559 This is the page header for even-numbered pages. If unspecified,
560 the odd header is used instead.
562 By default, headers are defined such that the page number is on the
563 outside edge, and the instrument is centered.
565 @funindex oddFooterMarkup
566 @item oddFooterMarkup
567 This is the page footer for odd-numbered pages.
569 @funindex evenFooterMarkup
570 @item evenFooterMarkup
571 This is the page footer for even-numbered pages. If unspecified,
572 the odd header is used instead.
574 By default, the footer has the copyright notice on the first, and
575 the tagline on the last page.
585 The following definition will put the title flush left, and the
586 composer flush right on a single line.
590 bookTitleMarkup = \markup {
592 \fromproperty #'header:title
593 \fromproperty #'header:composer
599 @node Reference to page numbers
600 @subsection Reference to page numbers
602 A particular place of a score can be marked using the @code{\label}
603 command, either at top-level or inside music. This label can then be
604 referred to in a markup, to get the number of the page where the marked
605 point is placed, using the @code{\page-ref} markup command.
607 @lilypond[verbatim,line-width=11.0\cm]
608 \header { tagline = ##f }
614 \pageBreak \mark A \label #'markA
619 \markup { The first score begins on page \page-ref #'firstScore "0" "?" }
620 \markup { Mark A is on page \page-ref #'markA "0" "?" }
624 The @code{\page-ref} markup command takes three arguments:
626 @item the label, a scheme symbol, eg. @code{#'firstScore};
627 @item a markup that will be used as a gauge to estimate the dimensions
629 @item a markup that will be used in place of the page number if the label
633 The reason why a gauge is needed is that, at the time markups are
634 interpreted, the page breaking has not yet occurred, so the page numbers
635 are not yet known. To work around this issue, the actual markup
636 interpretation is delayed to a later time; however, the dimensions of
637 the markup have to be known before, so a gauge is used to decide these
638 dimensions. If the book has between 10 and 99 pages, it may be "00",
639 ie. a two digit number.
648 @node Table of contents
649 @subsection Table of contents
650 A table of contents is included using the @code{\markuplines \table-of-contents}
651 command. The elements which should appear in the table of contents are
652 entered with the @code{\tocItem} command, which may be used either at
653 top-level, or inside a music expression.
656 \markuplines \table-of-contents
659 \tocItem \markup "First score"
663 \tocItem \markup "Some particular point in the first score"
668 \tocItem \markup "Second score"
676 The markups which are used to format the table of contents are defined
677 in the @code{\paper} block. The default ones are @code{tocTitleMarkup},
678 for formatting the title of the table, and @code{tocItemMarkup}, for
679 formatting the toc elements, composed of the element title and page
680 number. These variables may be changed by the user:
684 %% Translate the toc title into French:
685 tocTitleMarkup = \markup \huge \column {
686 \fill-line { \null "Table des matières" \null }
689 %% use larger font size
690 tocItemMarkup = \markup \large \fill-line {
691 \fromproperty #'toc:text \fromproperty #'toc:page
696 Note how the toc element text and page number are referred to in
697 the @code{tocItemMarkup} definition.
699 New commands and markups may also be defined to build more elaborated
702 @item first, define a new markup variable in the @code{\paper} block
703 @item then, define a music function which aims at adding a toc element
704 using this markup paper variable.
707 In the following example, a new style is defined for entering act names
708 in the table of contents of an opera:
712 tocActMarkup = \markup \large \column {
714 \fill-line { \null \italic \fromproperty #'toc:text \null }
720 #(define-music-function (parser location text) (markup?)
721 (add-toc-item! 'tocActMarkup text))
724 @lilypond[line-width=11.0\cm]
725 \header { tagline = ##f }
727 tocActMarkup = \markup \large \column {
729 \fill-line { \null \italic \fromproperty #'toc:text \null }
735 #(define-music-function (parser location text) (markup?)
736 (add-toc-item! 'tocActMarkup text))
739 \markuplines \table-of-contents
740 \tocAct \markup { Atto Primo }
741 \tocItem \markup { Coro. Viva il nostro Alcide }
742 \tocItem \markup { Cesare. Presti omai l'Egizzia terra }
743 \tocAct \markup { Atto Secondo }
744 \tocItem \markup { Sinfonia }
745 \tocItem \markup { Cleopatra. V'adoro, pupille, saette d'Amore }
752 Init files: @file{ly/@/toc@/-init@/.ly}.
756 @funindex \table-of-contents
757 @code{\table-of-contents}
762 @node Working with input files
763 @section Working with input files
766 * Including LilyPond files::
767 * Different editions from one source::
769 * Displaying LilyPond notation::
773 @node Including LilyPond files
774 @subsection Including LilyPond files
777 @cindex including files
779 A large project may be split up into separate files. To refer to
783 \include "otherfile.ly"
786 The line @code{\include "otherfile.ly"} is equivalent to pasting the
787 contents of @file{otherfile.ly} into the current file at the place
788 where the @code{\include} appears. For example, in a large
789 project you might write separate files for each instrument part
790 and create a @qq{full score} file which brings together the
791 individual instrument files. Normally the included file will
792 define a number of variables which then become available
793 for use in the full score file. Tagged sections can be
794 marked in included files to assist in making them usable in
795 different places in a score, see @ref{Different editions from
798 Files in the current working directory may be referenced by
799 specifying just the file name after the @code{\include} command.
800 Files in other locations may be included by giving either a full
801 path reference or a relative path reference (but use the UNIX
802 forward slash, /, rather than the DOS/Windows back slash, \, as the
803 directory separator.) For example, if @file{stuff.ly} is located
804 one directory higher than the current working directory, use
807 \include "../stuff.ly"
811 or if the included orchestral parts files are all located in a
812 subdirectory called @file{parts} within the current directory, use
815 \include "parts/VI.ly"
816 \include "parts/VII.ly"
820 Files which are to be included can also contain @code{\include}
821 statements of their own. These second-level
822 @code{\include} statements are not interpreted until they have
823 been brought into the main file, so the file names they specify
824 must all be relative to the directory containing the main file,
825 not the directory containing the included file.
827 Files can also be included from a directory in a search path
828 specified as an option when invoking LilyPond from the command
829 line. To compile @file{main.ly} which includes files
830 located in a subdirectory called @file{parts} by this method,
831 cd to the directory containing @file{main.ly} and enter
834 lilypond --include=parts main.ly
837 Files which are to be included in many scores may be placed in
838 the LilyPond directory @file{../ly}. (The location of this
839 directory is installation-dependent - see @rlearning{Other sources
840 of information}). These files can then be included simply by
841 naming them on an @code{\include} statement. This is how the
842 language-dependent files like @file{english.ly} are included.
844 LilyPond includes a number of files by default when you start
845 the program. These includes are not apparent to the user, but the
846 files may be identified by running @code{lilypond --verbose} from
847 the command line. This will display a list of paths and files that
848 LilyPond uses, along with much other information. Alternatively,
849 the more important of these files are discussed in @rlearning{Other
850 sources of information}. These files may be edited, but changes to
851 them will be lost on installing a new version of LilyPond.
853 Some simple examples of using @code{\include} are shown in
854 @rlearning{Scores and parts}.
858 @rlearning{Other sources of information},
859 @rlearning{Scores and parts}.
863 If an included file is given a name which is the same as one in
864 LilyPond's installation files, LilyPond's file from the
865 installation files takes precedence.
869 @node Different editions from one source
870 @subsection Different editions from one source
875 The @code{\tag} command marks music expressions with a name. These
876 tagged expressions can be filtered out later. With this mechanism it
877 is possible to make different versions of the same music source.
879 In the following example, we see two versions of a piece of music, one
880 for the full score, and one with cue notes for the instrumental part
896 The same can be applied to articulations, texts, etc.: they are
899 -\tag #@var{your-tag}
901 to an articulation, for example,
906 This defines a note with a conditional fingering indication.
909 @cindex removeWithTag
910 By applying the @code{\keepWithTag} and @code{\removeWithTag}
911 commands, tagged expressions can be filtered. For example,
915 \keepWithTag #'score @var{the music}
916 \keepWithTag #'part @var{the music}
922 @c @lilypondfile[ragged-right,quote]{tag-filter.ly}
924 The arguments of the @code{\tag} command should be a symbol
925 (such as @code{#'score} or @code{#'part}), followed by a
926 music expression. It is possible to put multiple tags on
927 a piece of music with multiple @code{\tag} entries,
930 \tag #'original-part \tag #'transposed-part @dots{}
936 Multiple rests are not merged if you create the score with both tagged
941 @subsection Text encoding
943 LilyPond uses the Pango library to format multi-lingual texts, and
944 does not perform any input-encoding conversions. This means that any
945 text, be it title, lyric text, or musical instruction containing
946 non-ASCII characters, must be utf-8. The easiest way to enter such text is
947 by using a Unicode-aware editor and saving the file with utf-8 encoding. Most
948 popular modern editors have utf-8 support, for example, vim, Emacs,
951 @c Currently not working
953 Depending on the fonts installed, the following fragment shows Hebrew
960 @li lypondfile[fontload]{utf-8.ly}
962 The @TeX{} backend does not handle encoding specially at all. Strings
963 in the input are put in the output as-is. Extents of text items in the
964 @TeX{} backend, are determined by reading a file created via the
965 @file{texstr} backend,
968 lilypond -dbackend=texstr input/les-nereides.ly
969 latex les-nereides.texstr
972 The last command produces @file{les-nereides.textmetrics}, which is
973 read when you execute
976 lilypond -dbackend=tex input/les-nereides.ly
979 Both @file{les-nereides.texstr} and @file{les-nereides.tex} need
980 suitable LaTeX wrappers to load appropriate La@TeX{} packages for
981 interpreting non-ASCII strings.
985 To use a Unicode escape sequence, use
988 #(ly:export (ly:wide-char->utf-8 #x2014))
992 @node Displaying LilyPond notation
993 @subsection Displaying LilyPond notation
995 @funindex \displayLilyMusic
996 Displaying a music expression in LilyPond notation can be
997 done using the music function @code{\displayLilyMusic}. For example,
1001 \displayLilyMusic \transpose c a, @{ c e g a bes @}
1008 @{ a, cis e fis g @}
1011 By default, LilyPond will print these messages to the console along
1012 with all the other messages. To split up these messages and save
1013 the results of @code{\display@{STUFF@}}, redirect the output to
1017 lilypond file.ly >display.txt
1022 @node Controlling output
1023 @section Controlling output
1026 * Extracting fragments of music::
1027 * Skipping corrected music::
1030 @node Extracting fragments of music
1031 @subsection Extracting fragments of music
1033 It is possible to quote small fragments of a large score directly from
1034 the output. This can be compared to clipping a piece of a paper score
1037 This is done by defining the measures that need to be cut out
1038 separately. For example, including the following definition
1046 (make-rhythmic-location 5 1 2)
1047 (make-rhythmic-location 7 3 4)))
1052 will extract a fragment starting halfway the fifth measure, ending in
1053 the seventh measure. The meaning of @code{5 1 2} is: after a 1/2 note
1054 in measure 5, and @code{7 3 4} after 3 quarter notes in measure 7.
1056 More clip regions can be defined by adding more pairs of
1057 rhythmic-locations to the list.
1059 In order to use this feature, LilyPond must be invoked with
1060 @code{-dclip-systems}. The clips are output as EPS files, and are
1061 converted to PDF and PNG if these formats are switched on as well.
1063 For more information on output formats, see @rprogram{Invoking lilypond}.
1065 @node Skipping corrected music
1066 @subsection Skipping corrected music
1069 @funindex skipTypesetting
1070 @funindex showLastLength
1072 When entering or copying music, usually only the music near the end (where
1074 are adding notes) is interesting to view and correct. To speed up
1075 this correction process, it is possible to skip typesetting of all but
1076 the last few measures. This is achieved by putting
1079 showLastLength = R1*5
1084 in your source file. This will render only the last 5 measures
1085 (assuming 4/4 time signature) of every @code{\score} in the input
1086 file. For longer pieces, rendering only a small part is often an order
1087 of magnitude quicker than rendering it completely
1089 Skipping parts of a score can be controlled in a more fine-grained
1090 fashion with the property @code{Score.skipTypesetting}. When it is
1091 set, no typesetting is performed at all.
1093 This property is also used to control output to the MIDI file. Note that
1094 it skips all events, including tempo and instrument changes. You have
1097 @lilypond[quote,fragment,ragged-right,verbatim]
1100 \set Score.skipTypesetting = ##t
1102 \set Score.skipTypesetting = ##f
1106 In polyphonic music, @code{Score.skipTypesetting} will affect all
1107 voices and staves, saving even more time.
1112 @section MIDI output
1117 MIDI (Musical Instrument Digital Interface) is a standard for
1118 connecting and controlling digital instruments. A MIDI file is a
1119 series of notes in a number of tracks. It is not an actual
1120 sound file; you need special software to translate between the
1121 series of notes and actual sounds.
1123 Pieces of music can be converted to MIDI files, so you can listen to
1124 what was entered. This is convenient for checking the music; octaves
1125 that are off or accidentals that were mistyped stand out very much
1126 when listening to the MIDI output.
1130 Many musically interesting effects, such as swing, articulation,
1131 slurring, etc., are not translated to midi.
1133 The midi output allocates a channel for each staff, and one for global
1134 settings. Therefore the midi file should not have more than 15 staves
1135 (or 14 if you do not use drums). Other staves will remain silent.
1137 Not all midi players correctly handle tempo changes in the midi
1138 output. Players that are known to work include
1139 @uref{http://@/timidity@/.sourceforge@/.net/,timidity}.
1142 * Creating MIDI files::
1144 * MIDI instrument names::
1145 * What goes into the MIDI? FIXME::
1149 @node Creating MIDI files
1150 @subsection Creating MIDI files
1152 To create a MIDI from a music piece of music, add a @code{\midi} block
1153 to a score, for example,
1161 tempoWholesPerMinute = #(ly:make-moment 72 4)
1167 The tempo can be specified using the @code{\tempo} command within the
1168 actual music, see @ref{Metronome marks}. An alternative, which does not
1169 result in a metronome mark in the printed score, is shown in the example
1170 above. In this example the tempo of quarter notes is set to 72 beats per
1173 specification can not take dotted note lengths as an argument. In this
1174 case, break the dotted notes into smaller units. For example, a tempo
1175 of 90 dotted quarter notes per minute can be specified as 270 eighth
1179 tempoWholesPerMinute = #(ly:make-moment 270 8)
1182 If there is a @code{\midi} command in a @code{\score}, only MIDI will
1183 be produced. When notation is needed too, a @code{\layout} block must
1193 @cindex layout block
1197 Ties, dynamics, and tempo changes are interpreted. Dynamic marks,
1198 crescendi and decrescendi translate into MIDI volume levels. Dynamic
1199 marks translate to a fixed fraction of the available MIDI volume
1200 range, crescendi and decrescendi make the volume vary linearly between
1201 their two extremes. The fractions can be adjusted by
1202 @code{dynamicAbsoluteVolumeFunction} in @rinternals{Voice} context.
1203 For each type of MIDI instrument, a volume range can be defined. This
1204 gives a basic equalizer control, which can enhance the quality of
1205 the MIDI output remarkably. The equalizer can be controlled by
1206 setting @code{instrumentEqualizer}, or by setting
1209 \set Staff.midiMinimumVolume = #0.2
1210 \set Staff.midiMaximumVolume = #0.8
1213 To remove dynamics from the MIDI output, insert the following lines
1214 in the @code{\midi@{@}} section.
1221 \remove "Dynamic_performer"
1229 Unterminated (de)crescendos will not render properly in the midi file,
1230 resulting in silent passages of music. The workaround is to explicitly
1231 terminate the (de)crescendo. For example,
1238 will not work properly but
1248 MIDI output is only created when the @code{\midi} command is within
1249 a @code{\score} block. If you put it within an explicitly instantiated
1250 context ( i.e. @code{\new Score} ) the file will fail. To solve this,
1251 enclose the @code{\new Score} and the @code{\midi} in a @code{\score} block.
1255 \new Score @{ @dots{}notes@dots{} @}
1262 @subsection MIDI block
1266 The MIDI block is analogous to the layout block, but it is somewhat
1267 simpler. The @code{\midi} block is similar to @code{\layout}. It can contain
1268 context definitions.
1271 @cindex context definition
1273 Context definitions follow precisely the same syntax as within the
1274 \layout block. Translation modules for sound are called performers.
1275 The contexts for MIDI output are defined in @file{ly/@/performer@/-init@/.ly}.
1278 @node MIDI instrument names
1279 @subsection MIDI instrument names
1281 @cindex instrument names
1282 @funindex Staff.midiInstrument
1284 The MIDI instrument name is set by the @code{Staff.midiInstrument}
1285 property. The instrument name should be chosen from the list in
1286 @ref{MIDI instruments}.
1289 \set Staff.midiInstrument = "glockenspiel"
1293 If the selected instrument does not exactly match an instrument from
1294 the list of MIDI instruments, the Grand Piano (@code{"acoustic grand"})
1298 @node What goes into the MIDI? FIXME
1299 @subsection What goes into the MIDI? FIXME
1302 * Repeats and MIDI::
1305 @node Repeats and MIDI
1306 @subsubsection Repeats and MIDI
1308 @cindex expanding repeats
1309 @funindex \unfoldRepeats
1311 With a little bit of tweaking, all types of repeats can be present
1312 in the MIDI output. This is achieved by applying the
1313 @code{\unfoldRepeats} music function. This function changes all
1314 repeats to unfold repeats.
1316 @lilypond[quote,verbatim,fragment,line-width=8.0\cm]
1318 \repeat tremolo 8 {c'32 e' }
1319 \repeat percent 2 { c''8 d'' }
1320 \repeat volta 2 {c'4 d' e' f'}
1329 When creating a score file using @code{\unfoldRepeats} for MIDI,
1330 it is necessary to make two @code{\score} blocks: one for MIDI
1331 (with unfolded repeats) and one for notation (with volta, tremolo,
1332 and percent repeats). For example,
1340 \unfoldRepeats @var{..music..}
1347 @subsection other midi
1349 Micro tones are also exported to the MIDI file.
1351 Figured bass has no effect on MIDI.