MusicXML-to-Humdrum batch converter

Click on the following button to select multiple MusicXML files from your computer to convert to Humdrum.

Files will be saved in the browser's download folder. The first time you use the batch converter, you will probably see a pop-up window asking for permission to download multiple files.

After clicking on "Allow", the rest of the converted files will be downloaded.

The MusicXML files must be uncompressed (.xml or .musicxml, not .mxl). If you have compressed MusicXML files, then rename them to end in .zip and uncompress them usually by double clicking on the zip file in the system file browser).


Batch conversion of MusicXML files via URLs

Alternatively paste a list of URLs to MusicXML files in the box below. After clicking on the "Convert URLs" button, they will be converted to Humdrum data and saved in your Download folder (place one URL on each line).

Two Turkish songs are given as an example. For Github hosted files, you can give a link to the webpage for the file (first link in the demo above) or more properly a link to the raw data (the first example URL will be converted into the raw link form automatically).


Convert MusicXML files in Verovio Humdrum Viewer (non batch)

You can also convert MusicXML files one at a time in Verovio Humdrum Viewer (VHV):
1

Drag-and-drop the MusicXML file onto the VHV page. This will display the MusicXML text in the text editor and do a direct rendering of the music notation on the right side of the page. You can alternatively copy-and-paste the MusicXML text into the text editor.

2

Click on the File→Convert to Humdrum menu item to convert to Humdrum. The Humdrum conversion should be displayed in the text editor, replacing the MusicXML text. Then you can either choose File→Save editor contents to save to a file in your Downloads folder, or copy-and-paste the Humdrum data to another location.

3 If the notation turns pink after selecting "Convert to Humdrum", then there is an error in the converter. Errors can be reported to the humlib issues page on Github. A sample file containing the error is required, and preferably as a short excerpt from the problem file that retains the same error.

Batch conversion on the command-line

To batch convert MusicXML files in a terminal, you can install humlib:

	git clone https://github.com/craigsapp/humlib
	cd humlib
	make
	sudo make install

On MacOS, first install Homebrew to download command-line compiling tools from Apple.

On Windows, install Windows Subsystem for Linux (WSL2), and then install Ubuntu linux.

In Linux/unix, compiling tools are probably already installed. Try "which gcc" to see if the terminal can locate the gcc compiler. If not then install. In RedHat/Fedora linux, use the following command to install compiling tools:

	 sudo dnf groupinstall "Development Tools" "Development Libraries"
In Ubuntu, Mint and Debian versions of linux, install compiling tools with this command:
	 sudo apt install build-essential 
After installing humlib tools, the musicxml2hum tool should be available. Run the following for-loop in a directory containing MusicXML files:
	for file in *.xml *.musicxml
	do
		echo Processing $file
		musicxml2hum "$file" > $(echo "$file" | sed "s/\.[^.]*$/.krn/")
	done