3.5.2 MIDI block

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 {
    \tempo 4 = 72
  }
}

In this example the tempo is set to 72 quarter note beats per minute. \tempo is actually a music command for setting properties during the interpretation of music: in the context of output definitions like a \midi block, as a matter of courtesy those are reinterpreted as if they were context modifications.

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.

\score {
  { …notes… }
  \midi { }
}

Other languages: English, deutsch, español, français, 日本語.
About automatic language selection.

LilyPond — Guida alla Notazione