4.3.1 Invoking midi2ly

midi2ly translates a Type 1 MIDI file to a LilyPond source file.

MIDI (Music Instrument Digital Interface) is a standard for digital instruments: it specifies cabling, a serial protocol and a file format. The MIDI file format is a de facto standard format for exporting music from other programs, so this capability may come in useful when importing files from a program that has a converter for a direct format.

midi2ly converts tracks into Staff and channels into Voice contexts. Relative mode is used for pitches, durations are only written when necessary.

It is possible to record a MIDI file using a digital keyboard, and then convert it to ‘.ly’. However, human players are not rhythmically exact enough to make a MIDI to LY conversion trivial. When invoked with quantizing (‘-s’ and ‘-d’ options) midi2ly tries to compensate for these timing errors, but is not very good at this. It is therefore not recommended to use midi2ly for human-generated midi files.

It is invoked from the command-line as follows,

midi2ly [option]… midi-file

Note that by ‘command-line’, we mean the command line of the operating system. See Converting from other formats, for more information about this.

The following options are supported by midi2ly.

-a, --absolute-pitches

Print absolute pitches.

-d, --duration-quant=DUR

Quantize note durations on DUR.

-e, --explicit-durations

Print explicit durations.

-h, --help

Show summary of usage.

-k, --key=acc[:minor]

Set default key. acc > 0 sets number of sharps; acc < 0 sets number of flats. A minor key is indicated by :1.

-o, --output=file

Write output to file.

-s, --start-quant=DUR

Quantize note starts on DUR.

-t, --allow-tuplet=DUR*NUM/DEN

Allow tuplet durations DUR*NUM/DEN.

-v, --verbose

Be verbose.

-V, --version

Print version number.

-w, --warranty

Show warranty and copyright.

-x, --text-lyrics

Treat every text as a lyric.

Known issues and warnings

Overlapping notes in an arpeggio will not be correctly rendered. The first note will be read and the others will be ignored. Set them all to a single duration and add phrase markings or pedal indicators.

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

LilyPond — Usage v2.17.97 (development-branch).