3.6.9 Enhancing MIDI output

The default MIDI output is basic but can be improved by setting MIDI instruments and various \midi block properties.

Additional scripts allow to fine-tune the way dynamics, articulations and rhythm are rendered in MIDI: the ‘articulate’ script and the ‘swing’ script.


The ‘articulate’ script

To use the ‘articulate’ script add the appropriate \include command at the top of the input file;

\include "articulate.ly"

The script creates MIDI output into appropriately ‘time-scaled’ notes to match many articulation and tempo indications. Engraved output however, will also be altered to literally match the MIDI output.

\score {
  \articulate <<
    … music …
  >>
  \midi { }
}

The \articulate command enables abbreviatures (such as trills and turns) to be processed. A full list of supported items can be found in the script itself. See ‘ly/articulate.ly’.

See also

Learning Manual: Other sources of information.

Notation Reference: Score layout.

Installed Files: ‘ly/articulate.ly’.

Note: The ‘articulate’ script may shorten chords, which might not be appropriate for some types of instrument, such as organ music. Notes that do not have any articulations attached to them may also be shortened; so to allow for this, restrict the use of the \articulate function to shorter segments of music, or modify the values of the variables defined in the ‘articulate’ script to compensate for the note-shortening behavior.


The ‘swing’ script

The ‘swing’ script provides additional functions allowing for regular durations to be played with an inequal rhythm. The most obvious example is ‘swing’ intepretation commonly found in jazz music where binary eighth notes should be played in a ternary fashion; however additional interpretations are also supported.

This script has to be \include-d at the beginning of the input file:

\include "swing.ly"

Three commands are provided:

Note: As with the ‘articulate’ script, all swing commands are also rendered in the engraved output, which results in irregular note spacing. This can be avoided by using them only in a \score block dedicated to MIDI output, rather than to printed music.

Additional help and information is included in the script file: see ‘ly/swing.ly’.

See also

Learning Manual: Other sources of information.

Notation Reference: Rhythms.

Installed Files: ‘ly/swing.ly’.

Known issues and warnings


LilyPond — Notation Reference v2.24.4 (stable-branch).