The
encode command was written for MS-DOS and has never been ported to other operating systems, so I have never actually used it.
The most efficient method as you suspect is to create a MusicXML file and then convert to Humdrum. This file can then be converted in two ways described below. Note that the MusicXML file should be in uncompressed format in both cases (You can uncompress in the terminal or system file viewer by renaming compressed MusicXML files to end in .zip, and then unzip the file to get the uncompressed data).
(1) You can drag-and-drop the MusicXML file onto the webpage
https://verovio.humdrum.org, then go to the File menu and select "Convert to Humdrum":
If the file does not convert to Humdrum, then there is a bug in the converter. You can report errors to the humlib issues page (after you create a free account on github):
Ideally you would isolate the error to the measure in which it occurs (i.e., a short an example as possible that still has the error).
(2) If you have a lot of MusicXML files that you want to convert in one step, you can install humlib (in linux or MacOS):
cd humlib
make
sudo make install
If you are on MacOS, then you should install Homebrew first (
https://brew.sh). For linux you may need to install the compiling tools, which would done something like this (for Fedora linux in this example):
sudo dnf groupinstall "Development Tools" "Development Libraries"
If you are using Windows, then install Windows Subsystem for Linux (WSL2), then install Ubuntu within that to run linux commands in the Ubuntu terminal (which I can elaborate further on if needed).
Then the musicxml2hum command should be available and can be run in the terminal like this:
for file in *.musicxml
do
echo Processing $file
musicxml2hum $file > $(basename $file .musicxml).krn
done
-=+Craig