3.5.3 The MIDI block

To create a MIDI output file from a LilyPond input file, insert a \midi block, which can be empty, within the \score block;

\score {
  … music …
  \layout { }
  \midi { }

Note: A \score block that, as well as the music, contains only a \midi block (i.e., without the \layout block), will only produce MIDI output files. No notation will be printed.

The default output file extension (.midi) can be changed by using the -dmidi-extension option with the lilypond command:

lilypond -dmidi-extension=mid MyFile.ly

Alternatively, add the following Scheme expression before the start of either the \book, \bookpart or \score blocks. See File structure.

#(ly:set-option 'midi-extension "mid")

See also

Notation Reference: File structure, Creating output file metadata.

Installed Files: ‘scm/midi.scm’.

Known issues and warnings

There are fifteen MIDI channels available and one additional channel (#10) for drums. Staves are assigned to channels in sequence, so a score that contains more than fifteen staves will result in the extra staves sharing (but not overwriting) the same MIDI channel. This may be a problem if the sharing staves have conflicting, channel-based, MIDI properties – such as different MIDI instruments – set.

Other languages: català, español, français, italiano.
About automatic language selection.

LilyPond — Notation Reference v2.19.81 (development-branch).