[ << General input and output ] | [Top][Contents][Index] | [ Spacing issues >> ] |
[ < Unsupported notation for MIDI ] | [ Up : Creating MIDI output ] | [ Controlling MIDI dynamics > ] |
3.6.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.8
\score { … music … \layout { } \midi { } }
Note: A \score
block that contains music and a
\midi
block but no \layout
block produces a
MIDI output file only. No notation gets printed.
A \midi
block at the top level can be used to change
MIDI settings globally; however, the generation of an actual MIDI
file only happens when a \midi
block is part of a
\score
block.
Similarly, a \layout
block at the top level affects
layout settings globally but does not influence whether printed
output is produced or not.
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.
Footnotes
(8)
Note that there also exists a markup command
called \score
that doesn’t produce MIDI output, even if a
\midi
block is present. See Scores within markup.
[ << General input and output ] | [Top][Contents][Index] | [ Spacing issues >> ] |
[ < Unsupported notation for MIDI ] | [ Up : Creating MIDI output ] | [ Controlling MIDI dynamics > ] |