more music software


xml2abc is a command line utility that translates MusicXML into ABC+ notation.

Parts of MusicXML that lie beyond the scope of the ABC standard 2.1 are not translated. For example: Tablature, specific layout information, slurs spanning staves etc.
The program translates all examples in the set from MakeMusic. The translated examples produce reasonable score when typeset with abcm2ps. In Mandoline, one of the samples, you can compare the output of xml2abc (via abcm2ps) with that of MuseScore 1.2. Another example from the set produces this score: Ave_Maria (Schubert). (see also the generated ABC of Mandoline_abc and Ave_Maria_abc)


When you have Python installed:

> python [-h] [-u] [-m] [-c C] [-d D] [-v V] [-n CPL] [-b BPL] [-o DIR] [-x] [-p FMT]  [ ...]

When you use the Win32 executable:

> xml2abc.exe [-h] [-u] [-m] [-c C] [-d D] [-v V] [-n CPL] [-b BPL] [-o DIR] [-x] [-p FMT] file1 [file2 ...]

Translates all .xml files (MusicXML) or compressed .mxl files in the file list to ABC-notation. Output goes to stdout unless the -o option is given. Wildcards in file names are expanded.
Option -h prints help message with explanation of the options
Option -u turns off repeat translation and unfolds simple repeats instead.
Option -m output commands for midi volume and -panning and the channel number when it is different from the voice number. These commands are output in addition to the midi program number which is always output when it is present in the xml file.
Option -c C sets the filter level of the credit filter. This filter tries to eliminate redundant T: fields. The level C goes from 0 (default) to 6 (no filtering). A higher level does less filtering. The default filters as much as possible and only includes the xml credit elements if no title of movement-title is found. Level 6 does no filtering and includes all xml credit elements as T: fields.
Option -d D sets the unit length for the ABC output to L:1/D. This overrides the computation of the optimal unit length per voice.
Option -v V. The default (V=0) translates volta backets in all voices. V=1 prevents abcm2ps to write volta brackets on all but the first voice. (A %%repbra 0 command is added to each voice that hides its volta's.) When V=2 abcm2ps only typesets volta brackets on the first voice of each xml-part. When V=3 the volta brackets are only translated for the first abc voice, which has the same effect on the output of abcm2ps as V=1, but the abc code is not suited for abc2midi.
Option -n CPL sets the maximum line length for ABC output to CPL characters. The default is 100 chars per line. An integer number of bars, at least one, is always output. How many bars fit into the maximum line length is calculated from the note line, not from the lyric lines. Line- and page breaks in MusicXML are translated to '$' after the previous barline [or volta number]
Option -b BPL sets the number of bars per line. Every line of ABC will have BPL bars (measures). When both -n and -b options are given -b is ignored.
Option -o DIR translates every .xml file to a separate .abc file with the same name into directory DIR. For example, -o. puts all abc files into the same directory where the input files reside.
Option -x disables translation of xml line breaks. No abc score line breaks ($) will be output.
Option --v1 allocates all XML staff directions to the first voice of the staff. Normally a staff direction is allocated to the voice of the next note after the direction (if any).
Option --noped disables translation of xml pedal elements.
Option -p FMT, FMT=scale,pageheight,pagewidth,leftmargin,rightmargin,topmargin,botmargin. The specified pageformat parameters are included in the generated abc code as pseudo instructions (%%scale, %%pageheight etc.) For example: -p 0.7,25,15,1.2,1.2,1.2,1.2 sets the scale to 0.7, the page height to 25 cm, the page width to 15 cm and all margins to 1.2 cm. After -p should follow 7 (floating point) numbers separated by comma's and without any spaces! Alle measures are in centimeter (cm). The scale value is the same as used by abcm2ps, i.e. a floating point number somewhere around 1.0
Option -pf (this is option -p without number list) Enables the translation of xml page format specifications into abc page format instructions (%%pageheight etc).


The python script: (the change log)

Stand alone win32 executable:

bug reports, remarks to: