How can I make my MIDI file 'compatible' with many different computers?

Posted by: Alyssa - PG Music

How can I make my MIDI file 'compatible' with many different computers? - 09/11/18 12:36 PM

71. How can I make my MIDI file 'compatible' with many different computers, so that it plays the way it was intended for a wide audience?

There are general recommendations for folks who write 'canned' MIDI files for use by 'just about anybody', for example MIDI files that you downloaded from the internet. If these recommendations aren't followed, then the MIDI file might not play properly on some computers.

General MIDI

Your file should be compatible with the minimum General MIDI specifications. General MIDI defines 128 patches, Program # 0-127. You should not use controller 0 or 32 (Bank Select MSB and LSB), since patches on higher banks are not defined in the GM spec. If you have a synth/sound card that happens to have some nice sounding patches on a higher bank, this doesn't mean that everyone else will have these same patches. Use only the 128 patches on 'Bank 0'. If the patch is not in the General MIDI list, other synths might play a different instrument than expected, or nothing at all.

General MIDI also defines 128 controllers, however to be GM compatible a synth only needs to recognize a few basic controllers: 1 (Modulation), 6 (Data Entry MSB), 7 (Volume), 10 (Pan), 11 (Expression), 38 (Data Entry LSB), 64 (sustain pedal), 100 (Registered Parameter Number MSB), 101 (Registered Parameter Number LSB), 121 (All controllers off), and 123 (All notes off). Controllers 6, 38, 100, and 101 are used for tuning and pitch bends. Some sound cards/synths may not respond to other controllers that you have in your file. For more information on the General MIDI specifications, see the MIDI Manufacturers Association.

Reset messages

Reset messages should be included in your file. The strategy is to put MIDI messages at the beginning of each MIDI file, which 'set everything to default', just in case the PREVIOUS song that the synth played did not do the polite thing and return all the channels to their default positions.

Also, to be a good citizen, you put MIDI messages at the end of each MIDI file, which set all the channels to default settings, just in case the NEXT song played doesn't bother to initialize the synthesizer. For instance, say you make a MIDI file that uses CTRL 7 (volume) or CTRL 11 (expression) to fade the ending to silence. If the next song you play doesn't initialize volume and expression, you may notice some tracks not playing, because they are still turned down to nothing from the last MIDI file that played. That's why it is nice to reset all the volumes/pans/etc maybe a beat or a bar after the song has played its last note.

Most sequencers, including Band-in-a-Box® and RealBand, automatically send quite a few reset-type messages at the beginning and end of play, but they don't necessarily cover all the bases, and you might find players that don't automatically send out all the stuff you would desire.

Many folks, if writing General MIDI files, will put the short GM Reset command at the beginning of the file, in the countoff region, so the synth has a few hundred milliseconds to completely initialize itself before it begins to play notes in the song. Some synths reset practically instantly, and others can take a moment to think about it. The GM Reset message is: F0 7E 7F 09 01 F7.

GM Reset is SUPPOSED to initialize all of a synth's settings to default, but there is no guarantee that all GM synthesizers really do that. Also, folks often use much nicer expensive synthesizers which are not General MIDI synths, but are set up to respond to a GM Patch map. In such a case, the synth might act like a great-sounding GM synth in most respects, but ignore the GM Reset command.

So 'belt and suspenders' will also send a group of messages to specifically initialize the common parameters, just in case the GM Reset doesn't do the right thing.

There are 'everything' type messages that are often included, such as the All Sounds Off (CTL 120), Reset All Controllers (CTL 121), and All Notes Off (CTL 123). However, it's the same deal - though these commands are commonly recognized by most synths, if a manufacturer doesn't recognize these messages, nobody is going to put them in jail for it.

So the final 'belt and suspenders' level is a series of controller messages to set Pan to 0 (actually 64 in absolute MIDI numbers, but most sequencers display Pan as -64 to + 63), set Bank Select LSB and MSB to 0, set Modulation to 0, set Volume to 100 (at the end of song. At beginning of song, set to desired initial volume of the track), set Sustain Pedal OFF, etc.

Some folks will make up a short dummy sequence with all these init messages for all channels, then splice the dummy sequence to the beginning and end of each file they make.

Many sequencers, including Band-in-a-Box® and RealBand, write a lot of that stuff to the MIDI file when you export a MIDI file. But there could be cases where you might want to check what is getting written, and decide if there is something else you would want in there.