1 @c -*- coding: latin-1; mode: texinfo; -*-
8 MIDI (Musical Instrument Digital Interface) is a standard for
9 connecting and controlling digital instruments. A MIDI file is a
10 series of notes in a number of tracks. It is not an actual
11 sound file; you need special software to translate between the
12 series of notes and actual sounds.
14 Pieces of music can be converted to MIDI files, so you can listen to
15 what was entered. This is convenient for checking the music; octaves
16 that are off or accidentals that were mistyped stand out very much
17 when listening to the MIDI output.
21 Many musically interesting effects, such as swing, articulation,
22 slurring, etc., are not translated to midi.
24 The midi output allocates a channel for each staff, and one for global
25 settings. Therefore the midi file should not have more than 15 staves
26 (or 14 if you do not use drums). Other staves will remain silent.
28 Not all midi players correctly handle tempo changes in the midi
29 output. Players that are known to work include
30 @uref{http://@/timidity@/.sourceforge@/.net/,timidity}.
37 * Creating MIDI files::
39 * MIDI instrument names::
42 @node Creating MIDI files
43 @section Creating MIDI files
45 To create a MIDI from a music piece of music, add a @code{\midi} block
46 to a score, for example,
51 \midi @{ \tempo 4=72 @}
55 The tempo is specified using the @code{\tempo} command. In this
56 example the tempo of quarter notes is set to 72 beats per minute.
59 If there is a @code{\midi} command in a @code{\score}, only MIDI will
60 be produced. When notation is needed too, a @code{\layout} block must
66 \midi @{ \tempo 4=72 @}
74 Ties, dynamics, and tempo changes are interpreted. Dynamic marks,
75 crescendi and decrescendi translate into MIDI volume levels. Dynamic
76 marks translate to a fixed fraction of the available MIDI volume
77 range, crescendi and decrescendi make the volume vary linearly between
78 their two extremes. The fractions can be adjusted by
79 @code{dynamicAbsoluteVolumeFunction} in @internalsref{Voice} context.
80 For each type of MIDI instrument, a volume range can be defined. This
81 gives a basic equalizer control, which can enhance the quality of
82 the MIDI output remarkably. The equalizer can be controlled by
83 setting @code{instrumentEqualizer}.
91 The MIDI block is analogous to the layout block, but it is somewhat
92 simpler. The @code{\midi} block can contain
96 @item a @code{\tempo} definition, and
97 @item context definitions.
100 A number followed by a period is interpreted as a real number, so
101 for setting the tempo for dotted notes, an extra space should be
102 inserted, for example
105 \midi @{ \tempo 4 . = 120 @}
109 @cindex context definition
111 Context definitions follow precisely the same syntax as within the
112 \layout block. Translation modules for sound are called performers.
113 The contexts for MIDI output are defined in @file{ly/@/performer@/-init@/.ly}.
116 @node MIDI instrument names
117 @section MIDI instrument names
119 @cindex instrument names
120 @cindex @code{Staff.midiInstrument}
122 The MIDI instrument name is set by the @code{Staff.midiInstrument}
123 property. The instrument name should be chosen from the list in
124 @ref{MIDI instruments}.
127 \set Staff.midiInstrument = "glockenspiel"
131 If the selected instrument does not exactly match an instrument from
132 the list of MIDI instruments, the Grand Piano (@code{"acoustic grand"})