[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3 Converting from other formats

Music can be entered also by importing it from other formats. This chapter documents the tools included in the distribution to do so. There are other tools that produce LilyPond input, for example GUI sequencers and XML converters. Refer to the website for more details.

These are separate programs from lilypond itself, and are run on the command line; see Command-line usage for more information. If you have MacOS 10.3 or 10.4 and you have trouble running some of these scripts, e.g. convert-ly, see (web)MacOS X section ‘MacOS X’ in General Information.

Known issues and warnings

We unfortunately do not have the resources to maintain these programs; please consider them “as-is”. Patches are appreciated, but bug reports will almost certainly not be resolved.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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 (internals)Staff section ‘Staff’ in Internals Reference and channels into (internals)Voice section ‘Voice’ in Internals Reference 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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.2 Invoking musicxml2ly

MusicXML is an XML dialect for representing music notation.

musicxml2ly extracts notes, articulations, score structure and lyrics from ‘part-wise’ MusicXML files then writes them to a ‘.ly’ file. It is run from the command-line as follows;

 
musicxml2ly [option]… file.xml

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

If ‘-’ is used instead of file.xml, musicxml2ly reads all input directly from the command line.

The following options are supported by musicxml2ly:

-a, --absolute

convert pitches in absolute mode.

--fb --fretboards

converts <frame> events to a separate FretBoard voice instead of markups.

-h, --help

print usage and a summary of all the available command line options.

-l, --language=LANG

use LANG for pitch names, e.g. deutsch for note names in German.

--loglevel=LOGLEVEL

Sets the output verbosity to LOGLEVEL. Possible values are NONE, ERROR, WARNING, PROGRESS (default) and DEBUG.

--lxml

use the lxml.etree Python package for XML-parsing; uses less memory and cpu time.

-m, --midi

activate the midi block in the .ly file.

--nb, --no-beaming

do not convert beaming information, use LilyPond’s automatic beaming instead.

--nd, --no-articulation-directions

do not convert directions (^, _ or -) for articulations, dynamics, etc.

--nrp, --no-rest-positions

do not convert exact vertical position of rests.

--nsb, --no-system-breaks

ignore system breaks.

--npl, --no-page-layout

do not convert the exact page layout and breaks (shortcut for --nsb --npb --npm options).

--npb, --no-page-breaks

ignore page breaks.

--npm, --no-page-margins

ignore page margins.

--nsd, --no-stem-directions

ignore stem directions from MusicXML, use lilypond’s automatic stemming instead.

-o, --output=FILE

set the output filename to FILE. If file is ‘-’, the output will be printed to stdout. If not given, xmlfile.ly will be used instead.

-r, --relative

convert pitches in relative mode (default).

--transpose=TOPITCH

the interval between pitch c and TOPITCH to transpose by.

--sm, --shift-meter=BEATS/BEATTYPE

change the length|duration of notes as a function of a given time signature to make the score look faster or slower, (e.g. 4/4 or 2/2).

--tc, --tab-clef=TABCLEFNAME

switch between two versions of tab clefs (tab and moderntab).

--sn --string-numbers=t[rue]/f[alse]

deactivate string number stencil with --string-numbers false. Default is true.

-v, --verbose

be verbose.

--version

show version number and exit.

-z, --compressed

input file is a zip-compressed MusicXML file.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.3 Invoking abc2ly

Note: This is not currently supported and may eventually be removed from future versions of LilyPond.

ABC is a fairly simple ASCII based format. It is described at the ABC site:

http://www.walshaw.plus.com/abc/learn.html.

abc2ly translates from ABC to LilyPond. It is invoked as follows:

 
abc2ly [option]… abc-file

The following options are supported by abc2ly:

-b, --beams=None

preserve ABC’s notion of beams

-h, --help

this help

-o, --output=file

set output filename to file.

-s, --strict

be strict about success

--version

print version information.

There is a rudimentary facility for adding LilyPond code to the ABC source file. For example;

 
%%LY voices \set autoBeaming = ##f

This will cause the text following the keyword ‘voices’ to be inserted into the current voice of the LilyPond output file.

Similarly,

 
%%LY slyrics more words

will cause the text following the ‘slyrics’ keyword to be inserted into the current line of lyrics.

Known issues and warnings

The ABC standard is not very ‘standard’. For extended features (e.g., polyphonic music) different conventions exist.

Multiple tunes in one file cannot be converted.

ABC synchronizes words and notes at the beginning of a line; abc2ly does not.

abc2ly ignores the ABC beaming.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.4 Invoking etf2ly

Note: This is not currently supported and may eventually be removed from future versions of LilyPond.

ETF (Enigma Transport Format) is a format used by Coda Music Technology’s Finale product. etf2ly will convert part of an ETF file to a ready-to-use LilyPond file.

It is invoked from the command-line as follows;

 
etf2ly [option]… etf-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 etf2ly:

-h, --help

this help

-o, --output=FILE

set output filename to FILE

--version

version information

Known issues and warnings

The list of articulation scripts is incomplete. Empty measures confuse etf2ly. Sequences of grace notes are ended improperly.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.5 Other formats

LilyPond itself does not come with support for any other formats, but some external tools can also generate LilyPond files. These are listed in (web)Easier editing section ‘Easier editing’ in General Information.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by gub on July 13, 2020 using texi2html 1.82.

Andere talen: català, deutsch, español, français, magyar, italiano, 日本語.
Gebruik van automatische taalkeuze.