Next: What goes into the MIDI output?, Previous: Creating MIDI files, Up: MIDI output
A \midi
block must appear within a score block if MIDI output
is required. It is analogous to the layout block, but somewhat
simpler. Often, the \midi
block is left empty, but it
can contain context rearrangements, new context definitions or code
to set the values of properties. For example, the following will
set the initial tempo exported to a MIDI file without causing a tempo
indication to be printed:
\score { ...music... \midi { \context { \Score tempoWholesPerMinute = #(ly:make-moment 72 4) } } }
In this example the tempo is set to 72 quarter note beats per minute. This kind of tempo specification cannot take a dotted note length as an argument. If one is required, break the dotted note into smaller units. For example, a tempo of 90 dotted quarter notes per minute can be specified as 270 eighth notes per minute:
tempoWholesPerMinute = #(ly:make-moment 270 8)
Context definitions follow precisely the same syntax as those
within a \layout
block. Translation modules for sound are
called performers. The contexts for MIDI output are defined in
../ly/performer-init.ly,
see Other sources of information.
For example, to remove the effect of dynamics
from the MIDI output, insert the following lines in the
\midi{ }
block.
\midi { ... \context { \Voice \remove "Dynamic_performer" } }
MIDI output is created only when a \midi
block is included
within a score block defined with a \score
command. If it
is placed within an explicitly instantiated score context (i.e.
within a \new Score
block) the file will fail. To solve
this, enclose the \new Score
and the \midi
commands
in a \score
block.
\score { \new Score { ...notes... } \midi { } }
This page is for LilyPond-2.11.58 (development-branch).
Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.
Your suggestions for the documentation are welcome.
Other languages: espaƱol.