Guide to converting MIDI music into Pulp

I wanted to post this last year as a guide to convert MIDI formatted songs into Pulp, however I left it incomplete as I haven't fully grasped some of the concepts behind the format (and music as a whole) and how I would write about my workflow in converting midi in pulp. I believe I'm confident enough now to describe this process.

Another reason is that I found out about another tool that would simplify this whole process. Though, I now think this process might give you a more desired result. This guide relies on 4mat's xm2pulp, and will demonstrate how to ("properly") convert midis to tracker music using OpenMPT as these are very different formats.

A few disclaimers before proceeding, this may not work with all midis and results will vary with the tempo and the density of the notes played at the same time.


1­.­ ­Minimizing channels and tracks

The first (and most important) step is to simplify your midi into something more feasible. Pulp only uses 5 channels for each instrument which are referred to them as "Voices": Sine, square, sawtooth, and noise; this order as it'll become important when ordering channels.

If you have access to the song you're trying to convert in a DAW, create a copy where you'll arrange them into these 5 channels. If not, then you can just import them into your favorite DAW (make sure that it identifies each track, as I had some troubles importing them in LMMS and had to re-export them from another one) and trim them from there. It's important to keep each track playing one note at a time.

Once you have all of your tracks condensed, export each channel into a separate MIDI file.


2.­ ­Importing them to OpenMPT

Before Importing, you need a tracker module (in this case a .xm file) to use it as a template, in order to place each channel to. You can create one yourself with OpenMPT, with 256 rows (doesn't work well with 512) and 6 channels (the converter will ignore the 6th channel) and set the ticks/row to 6; Or you could use this template which also contains my poor attempt at mimicking some instruments in pulp.
template.xm.zip (3.1 KB)

Set your pattern length in your MIDI file import settings to the same length as the xm file


Important: Before importing your midi files, adjust the "Quantize" option in the MIDI import settings depending on the factors I mentioned earlier: if your song has a lower pacing and fewer notes, you may want to lower the value and save some space in each pattern; If it has a higher pacing and more notes playing, increase the value.

There's no correct value as midis are different from trackers, but if a single midi channel ends up using multiple channels or has a bpm higher than 255, you'll have to adjust it where it just right and doesn’t go over than 255 bpm. Importing a midi file may be outputted in openMPT as .mptm which may leave the bpm unchanged, so make sure you change the compatibility settings to "FastTracker 2" in order to see the actual bpm.


From here, import your midi file (starting from the sine), select the entire channel, copy it, and paste it to the xm file; repeat until you have all the channels inside the XM file.

If the midi is longer, it'll create a new pattern inside the order list, create a new pattern in the order list of the template and repeat the same process (some midis may have repeating patterns, empty patterns or shorter patterns if left blank or aren't used very often. In that case leave them empty, but try to keep the same order as the rest of the midis).


Notice: If a single channel midi has more than one channel, it means that there's more than one note playing at the same time, try listening to each channel and move some the pattern data whenever a row it's off note; if It's mostly blank you may delete it. This is why it was important that each track only plays one note at a time before exporting them in the first step.


Lastly, set the bpm of the .xm file to the matching speed as the midi files (if you haven’t already from the previous beginning of this step).

Export every two patterns into a single xm file, if it ends up taking more than two patterns. Pulp only uses the equivalent of two patterns of 256 notes for a single song.


3.­­ ­Using xm2pulp

To use xm2pulp, you need to have python installed. I won't go through the process of installing python as it depends on your system, but you should be able to set it up here. Once you have it, download xm2pulp if you haven't already, and extract it. Move your XM file in the same folder.

From here run this command with your file.

python xm2pulp.py xmfile.xm

In some cases, you may find this error even if you followed every step in this guide:

    patternnote[i][z][q] = getbyte()
    ~~~~~~~~~~~~~~^^^
IndexError: list index out of range

For some reason, I managed to get around it by re-exporting the XM file on another tracker software like milkytracker, just load it and save it as such. I don’t know if this is a problem with OpenMPT or the music converter that has some specific requirements from the format.

Now you can import your outputted JSON file (should say song.json) and import it to your pulp project. If the json crashes your editor, it means that it was not properly formatted. Open song.json with any text editor and remove any double-digit zeroes with a single digit (or add a comma between the zeroes).


Notice: After importing your track in Pulp, check for any empty space right at the end of the track. As the Pulp editor doesn’t check for the length of a track and cuts remaining length, leaving a pause after the song ends.


Since Pulp has a limit of 32 “bars“ you have to figure out a way to play each song on top of the other. In my case, I create a recursive function that plays on after the other, though let me know if you have a different approach to this:

on songloop to
   once "song1" then
      once "song2" then
         call "songloop"
      end
   end
end

And thats about it, you probably could follow the first step and import the full-size midi in the other tool, but this one gives me more control on the process.

Regardless, I just wanted to share this process on how I do it.

3 Likes

THANK YOU SO MUCH you're really a superstar for putting this together.

1 Like