Next: , Previous: Invoking convert-ly, Up: Converting from other formats



7.2 Invoking midi2ly

Midi2ly translates a MIDI input 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 you want to import files from a program that has no converter for its native format.

Midi2ly will convert 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. 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.

Hackers who know about signal processing are invited to write a more robust midi2ly. midi2ly is written in Python, using a module written in C to parse the MIDI files.

It is invoked as follows:

             midi2ly [option]... midi-file

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.

Read comments on this page, or add one.

This page is for LilyPond-2.2.6 (stable-branch).

Report errors to <bug-lilypond@gnu.org>.