MIDIFile Tutorial for ArtWonk & MusicWonk

How to read, play and manipulate a MIDI (.mid) file.


ArtWonk is not a MIDI file player, and those who are looking to simply play and/or edit MIDI files should look to other programs. What ArtWonk can do, and it is a unique and extremely powerful tool, is deconstruct MIDI files, enabling you to use the file data - notes, velocities, program changes, control changes, etc. - as clock and sequence data available to the full range of ArtWonk modules. Once you have this, you will be able to manipulate the original MIDI music infinitely beyond what a "normal" sequencer editor can provide.

And if you really want to, you can simply play back the deconstructed MIDI file. In fact this is a very good way to determine if you have properly deconstructed the file.

For this tutorial, we will start with a standard MIDI file of JS Bach's Little Fuge. Here is the .mid file, you should be able to click on it to hear it as it was originally recorded:

littlef.mid

In order to work with MIDI you should have some familiarity with the MIDI Data and File specifications, which go beyond the scope of this tutorial. If you want basic or refresher information on MIDI, the MIDI Information page at Harmony Central is a good place to start. Also, here is some specific information on MIDI Files from the excellent MIDI Technical Fanatic's Brainwashing Center.

In order to use the MIDIFile module, you first need to import the component parts of the file. MIDI Files are recorded as time based data in Tracks and Channels. The time based data is the MIDI message. This can be Note on/off, Velocity values, Control change (such as Volume or Mod Wheel) data, Program Changes, Pitch Bend values, and so on.

Playable MIDI files will always have 1 or more Tracks, and the Tracks will always contain from 1 to 16 Channels. Within the Channels will be the actual MIDI data, which can be virtually any mix of any number of MIDI messages.

You will need to load the .mid file into the ArtWonk MIDI File Import tool, found in the top line Files Menu. This tool loads the MIDI file and separates the various data streams, so you can then load the separated data sequences into the MIDIFile module, properly synchronized and available as standard ArtWonk module data, which any other module can access and manipulate.

The MIDIFile Import tool shows Tracks on the left, with selection buttons for the 16 Channels in the middle, and the data for each Track/Channel selected on the right:

Click on the Track; it will highlight and the Channel selection option buttons will become available for each MIDI channel that was recorded on that particular track. Click on the Channel selection option, and the recorded data will show up on the right.

The two images above illustrate the two types of MIDI File you are likely to run into. The one on the left has only 1 track, with multiple channels. Clicking on the 4 available Channel buttons will display the data recorded for each of the Channels. The image on the right shows 4 separate tracks, with only 1 (different) Channel for each Track. Selecting the different Tracks will show a different Channel option button, and the data for that channel will be in the right pane. Not all MIDI files are so neatly recorded. You can have any number of Tracks, and each Track can have multiple Channels of data. However it is recorded, you can use Import tool to access the separate Track/Channel/Data streams.

The image on the left, with a single Track and 4 available Channels is the .mid file we will be using here.

Looking at the right pane in the left image above, notice the different data types, and the numbers in brackets, which indicate how many values are in each data type sequence.

The first sequence is MIDI Key [854] and the second is Velocity [1708]. This is a typical pitch data sequence, with a pitch value (MIDI Key), an Note-On (Velocity), and Note-Off (Velocity=0). Thus, there are exactly twice as many Vel values as Key values.

Note that while the MIDI standard defines separate Note-On and Note-Off messages, it also allows Note-Off to be a Note-On with a velocity value of 0. To simplify things, the import tool translates all Note-Off messages into Note-On-0. This allows you to use the Velocity stream directly as a Clock signal: Note-On velocity is Clock-On, and Note-On-0 is Clock Off.

While you can have any number of other data type streams (Volume, Mod Wheel and Pitch Bend are common), General MIDI files are often reduced to the pitch data plus a few setup parameters that show a "sequence" of only 1 value, such as the above:

Program Change [1]
07H 7 Volume [1]
0AH 10 Pan [1]

This indicates these are setup parameters. In most cases you will be using your own setup values, and you don't need to save these 1-step sequences; although sometimes you need to initially, in order to find out what the original recording used.

(The numbers to the left of Volume and Pan are the Control Message numbers in hexadecimal and decimal.)

To save the imported sequences, first click on the data sequence in the right pane so it is highlighted, then click on the Save button. You will get the standard Windows File Save dialog, with a name suggested. You can and probably should modify this to be sure all names are unique. Save each of the sequences that you want to import into ArtWonk. In this example, the Vel and Key sequences for each of the 4 Channels will be saved.

After the sequences have been saved, create a MIDIFile module, found in the MIDI In group. Click on the module's upper right Properties button to load the file data into the module. Since there will be 8 data files loaded, click on the More button until there are 8 file load lines:

Note that the Label is automatically set to the data type: Key, Vel, etc. While as always you are allowed to make up your own rules with ArtWonk, generally you should load all data files of a particular sequence into a single MIDIFile module. This will insure that the data stays in sync, and everything starts and ends at the proper place.

The MIDIFile module does not store the sequence data; it only stores the file locations. So you always need to have the data files available when you run a patch using them. As with most ArtWonk files, if it cannot find the data in its original location, it will look in the same directory as the patch, so a patch that uses MIDIFile data is portable as long as you keep the patch file and the data files in the same location.

Once you have the MIDIFile module set up with Vel and Key and whatever other tracks you intend to use, it can then be used as a clock/sequencer for other modules. In the simplest case, you can drive a MIDIVoice module with it directly.


Click for full size image.

[Return to Tutorial Page]