xml2abc is a command line utility that translates MusicXML into ABC+ notation.
The folowing elements are translated:
notes, rests, tuplets, beams, ties, key signatures, time signatures, tempo markings,
lyrics, grace notes, slurs, wedges, dynamics, barlines, several note ormanments,
text annotations, chord symbols, repeats, voltas, clefs, mapping voices to staves with
groupnames, partnames, braces and brackets. Midi instruments are assigned
to all voices.
From the header work title, movement title, composer and credit fields are translated.
All other notation is discarded.
The latin-1 and utf-8 character sets are supported.
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 xml2abc.py [-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 -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).
Stand alone win32 executable: xml2abc.exe-63.zip
New: xml2abc-js: translate a MusicXML file to ABC in your browser. Select a local MusicXML file on your computer and save the ABC translation. A preview of the score is also shown, using abc2svg. No server processing is involved. All data and computations remain local on your computer. More info about the abc2svg is on: abc2svg.
abc2xml converts ABC to MusicXML. Docs and download from abc2xml.
Shortcomings in xml2abc:
- In MusciXML slurs can span staves. As far as I know this cannot be expressed in ABC. The script only translates slurs that remain within one voice.
- MusicXML allocates chords, text, wedges and dynamics to specific staves. The script translates these elements into the first voice belonging to the specified staff. Key changes are translated to all voices of the specified staff.
- Absolute positioning instructions in wedges and slurs are ignored.
- MusciXML can have separate names for parts and part-groups. The translation puts a part-group name, when present, in front of the partname with a colon as separator.
- Many notational elements are not translated.