Soundcard info page and links
Software info page and links
How to setup and optimize your PC for DAW apps.
Helpful Articles.
Recording and mixing tips.
Product reviews and comments.
Links to other great resources.
Press Releases.
Press Releases.
Email www.pcrecording.com.

PCRECORDING.COM - MIDI introduction

This article is authored by and submitted courtesy of Kelly Craven.

Music Instrument Digital Interface

MIDI is an acronym for Musical Instrument Digital Interface. Back a few years ago a few musical instrument manufacturers got together and decided to work together. Devices at the time were keyboards, sound modules and drum machines. Ultimately, MIDI was born. The devices above became standardized to MIDI ― a protocol for sending data between devices regardless of what those devices may be. There was little thought given to computers at the time.

Fortunately, computers and MIDI have become a perfect marriage because computers are very capable of sending/receiving data. Through sequencing software you can record and control every aspect of MIDI playback, and then some, without knowing much of anything about the MIDI protocol. (Be glad those days are gone.)

All you need to know is what you want to do. Well, that and how it is done in your sequencer. Never underestimate the help docs for finding hidden features - - some sequencers have interfaces that appear to be designed to hide even the most basic functionality, like recording a MIDI track. Learn the ins and outs of your sequencer; let it do the MIDI work for you, so you can concentrate on the good stuff.

The following article is presented in a question and answer format. Additional topics will be added in the coming weeks as indicated by the list below.

General MIDI

Question: How can I be sure my files will sound the same on someone elseís machine?

Answer: Only use sounds available on all machines.

Solution: The easiest way to guarantee this is to use only General MIDI (GM) Instruments. If you have a soundcard in a PC you can be pretty sure a GM Soundset is available.

Before the General MIDI Standard was accepted there was no universal set of instruments (sounds) that were always available. MIDI was a protocol for data transfer, period. MIDI files played on you own setup might sound great, but you had no idea what it would sound like if you sent your MIDI file to a friend. If they didnít have exactly the same setup as yours it probably sounded pretty bad. A bass might play the guitar part; strings could be horns; drums might be all piano; you might hear nothing at all. It was a major problem.

General MIDI attempts to solve this problem by giving us a set of instruments that we know will always be available. All GM instruments are in Bank 0 and are numbered 0 to 127, plus there is a Standard Drumset. The only real limitations are that you are stuck with a pretty generic soundset and the sound quality can vary drastically among soundcards and sound modules. As long as you take these limitations into consideration you will be fine.

There are loads of great sounding soundcards out there today, each with its own extra features added to overcome the inherent limitations of GM. That something could be more instruments, onboard effects, and/or many more drum sets, depending on the card. Unfortunately, these extra non-GM features put us back where we started if we expect our files to sound the same on all machines. As long as you do not intend to share your files you have nothing to worry about and are free to be as creative as you want.

Moreover, GM isnít the only, or the best, game in town for insuring consistent playback. Other methods, such as the MIDI DownLoadable Sample standard (DLS), and SoundFonts, have been developed that allow supplying the sounds of the instruments themselves. By using one of these methods you are not limited to the standard GM set. You are not limited to any sound, period. You supply the custom sounds. They can be anything. These methods are very innovative and have gained wide acceptance, but unless you know the system or soundcard supports these features you should not depend on them. Nevertheless, they are truly the best way to insure that your MIDI files will be heard as you expect them to be heard. This subject could fill a book ― or website.

Suggestions:

  1. Use only patch numbers between 0 and 127, and only on bank 0, if you want to be guaranteed that your files sound nearly the same on all machines. Use just the GM soundset.
  2. Seriously look into using DLS or SoundFonts if you want to use custom sounds without sacrificing continuity across systems.

Polyphony

Question: My notes stop playing early and sometimes notes donít play at all. Why, and what can I do about it?

Answer: You are running out of polyphony.

Solution: Donít play more notes than your soundcard can handle.

This is a "duh!" solution when you know what the problem is, but it is not always obvious that this is the problem.

Simply put, polyphony is the number of notes that can be sounding at one time. Older cards can play 16 or 32 notes, with newer cards allowing much higher note count. Drums may or may not be included in the advertised polyphony, but will never the less be a factor. When you play more notes than your soundcard is capable of something has got to give. Keep in mind that most of the time drums have a higher priority than melodic instruments. You will lose notes on the melodic instruments first. Also, most cards give priorities based on MIDI channel, meaning the higher the MIDI channel the more likely you are to loose notes in those tracks first.

Suggestions:

  1. Donít play too many notes. Keep tabs of how many notes should be sounding. Through selective shortening of notes you can usually get the note count down without sacrificing the overall sound.
  2. Donít use Control Change #64, the sustain pedal. It is unbelievably easy to cause many more notes to be playing than you can hear when you use the sustain pedal. The sustain pedal continues to have an effect for instance, on sounds that will fade out eventually, like piano. Even after the sound has faded out the notes are still playing according to the soundcard as long as the sustain pedal is down. Fortunately, notes that canít be heard arenít missed when stolen. Unfortunately, there is no guarantee the stolen notes will be the silent ones. The lost notes could be from another instrument that you can hear on another track. The worst case is if you have a soundcard that deals with polyphony problems by not playing any more notes at all until the note count drops below the limit. In that case, you may not be hearing anything but no new notes will play either.
  3. Donít stack notes. A trick used extensively (mostly older files) to fatten sound is to play more than one note of a value at the same time on the same track. The result can be anything from a really lush full sound to no obvious difference from a single note except maybe a little flanging. In all cases you are playing those notes, which cuts down on total polyphony. If you want a fatter sound, but polyphony is a concern, donít stack notes. Change sounds.
  4. Beware of overlapping notes. Some sequencers have a playtime randomization feature that can add a human feel to tracks. This is especially useful if the notes have been previously quantized. After randomization, check your tracks to make sure that the end of one note has not been moved unexpectedly past the start of another note. This situation could be enough to cause polyphony problems, but not likely unless you had polyphony problems in the first place ― or were very close. More likely the note "off" of one note is cutting off the sound of the next note, so you only hear a little blip of the second note. Shorten the first note so that it doesnít overlap the next note. Not all cards support overlapping notes so you may not know you have a problem.
  5. Think of the minimum system your MIDI files might be played on. If you have a newer soundcard that supports 256-note polyphony you may never hear a problem, but if you play your file on an older card you may get lost notes. 32 notes at a time is a good rule of thumb.
  6. Take note release time into account. A MIDI note doesnít always end when the note off is played. Release time is that time that the note keeps playing after the note off is played (take your finger off the key and the sound slowly fades out). Long release times can cause lost notes long before you think you should be having problems. This problem is almost exactly like stacked. If your card doesnít support overlapping notes youíll never run into this. Generally, the solution is to shorten the release time of the sounds, but since you may not have access to this parameter (some cards support changing this parameter via MIDI controllers) you should look for other solutions, such as shortening the note duration or changing sounds.

Patch Changes

Question: How do I select different sounds?

Answer: You select different sounds, instruments or patches, by playing MIDI patch change events and sometimes with MIDI bank selects.

Solution: To set or change sounds you will need to insert MIDI patch change events into each track of you MIDI file. (bank selects are discussed later)

Every MIDI file needs to have patch changes to select the desired instruments that are to be heard when playing back the file. Itís a good idea, and should be required of every file, to have a patch change for each track (one per MIDI channel), even if you hear the instrument you want without them. MIDI files that have no patch changes are dependent on the current state of the soundcard or synthesizer which may or may not be what you expect.

At startup, a set of default instruments are waiting to be played. If you turn your computer on and play a MIDI file that doesnít have any patch changes you will most likely hear piano for all instruments, and drums. But, if you play a MIDI file that changes the sounds and you go back and play the file that doesnít have any patch changes it will use the sounds used by the last file. You might end up with your piano tracks using the gunshot sound effect.

Suggestions:

  1. Always setup each track with patch change. Donít assume what state your soundcard will be in.
  2. You only need one patch change per MIDI channel, so if you have multiple tracks that use the same channel you only need to put patch changes in one track.
  3. Itís not necessary for patch changes to be at the beginning of the track. Itís only required that they be played before any notes.
  4. Beware: Some popular sequencing software will automatically move the first patch change in a track to the very beginning of the track if there are no notes preceding them in the track. If you have multiple tracks on the same MIDI channel itís a good idea to have patch changes only in one of those tracks to prevent the software from changing the playtime of you patch changes.

Bank selects:

Question: I know my soundcard has instruments other than the first 128 General MIDI sounds. How do I select them?
Answer: This is done through Bank Selects.

Some soundcards contain sets of instruments or sounds in groupings called banks. Each bank can contain up to 128 patches (instruments). Banks are used so you arenít limited to 128 total patches, the limit if you use just patch changes alone. Banks donít have to have all 128 patches; there might be only one patch in a bank. Really, a bank doesnít have to have any available patches, but that kind of make it useless. You may be lucky and get a fallback sound, but you might get silence.

General MIDI Instruments are in Bank 0 by design. If you donít send any bank selects you are suppose to default to Bank 0, when the soundcard is initialized, if the General MIDI Specification is adhered to. If you want to select any of those other sounds on your soundcard you will need to send it a bank select.

A bank select is usually a combination of two MIDI Controller events followed by a MIDI Patch Change. The MIDI Controllers are always CC#0 and CC#32, the Patch Change. Some sequencers hide this from the user by allowing bank and patch selection from a track properties dialog or some special other way, but in the end there will be some combination of CC#0 and/or CC#32, and a Patch Change.

The normal method consists of three MIDI events, CC#0, CC#32, and a Patch Change. The CC#0 is the Most Significant Byte (MSB) and CC#32 is the Least Significant Byte (LSB). All this really means is that the values of these two controllers are added together in a way as to make a single number used for the bank select.

The MSB is multiplied by 128 and the result is added to the LSB. If it wasnít done this way there would be a limit of 128 banks. Using this method there is a limit of 16,384 banks. Thatís lots of banks. In reality, most synthesizers and soundcards only respond to the MSB (CC#0) event. The LSB (CC#32) always has a value of 0. For example, to select any Instrument in Bank A on a Roland synthesizer you would need to send a CC#0, value 81, CC#32, value 0, and the Patch Change.

The MIDI Spec is a little ambiguous in its defining of the implementation of bank selects ? leaving manufacturers to interpret the handling of bank select in slightly different ways. Better sequencers will give you a choice about which method to use. You may need to experiment to find the right method for your soundcard. Fortunately, most synthesizers respond to the ďNormal Bank Select MethodĒ described above, making the method choice a little easier. (I have no idea where this name, ďNormalĒ, came from. Itís not any more normal than any of the others.)

A user should not insert any other MIDI events between the controllers and patch change, and they should always be played in the order mentioned. They should not have exactly the same timestamp because events with the same time stamp are not guaranteed to always play in the same order in some sequencers, as events are stored in the MIDI files.

The values you should use to select different banks should be defined or listed in the docs for your specific synthesizer or soundcard. If they are listed in decimal (base 10) as a single number-not divided into MSB and LSB-you will need to figure out the MSB and LSB yourself. Donít worry; itís not that hard. Divide the number by 128. The whole number you get is the MSB and the remainder is the LSB. Technically, Roland Bank A is in bank 10368, decimal (10368 / 128 = 81, remainder 0).

Just to add to any confusion, you may see banks listed in hexadecimal (81 = 0x51). To convert hexadecimal into decimal, multiply the first digit by 16 and add the second digit ((5 * 16) + 1 = 81). Letís hope you donít need to do this.

Most other bank select methods are variations of the normal way. Some synthesizers respond to only CC#0; others respond to only CC#32. Some Roland synthesizers use bank 81 to toggle between two banks. Some synthesizers donít use this method at all. This is the kind of information that you can only get from your docs.

One relatively popular non-standard bank select method is to use standard patch changes to select banks. For example, some Ensoniq synthesizers use any patch value 100 or higher as a bank select. Synthesizers that do this do not comply with the General MIDI standard.

Yamaha XG Synthesizers uses special SYSEX messages for bank selects, and for stacking sounds. You should consult the Yamaha docs for more on XG. Yamaha does comply with the General MIDI Standard though when in GM mode.

Suggestions:

  1. Always include a bank select when you setup your tracks if you know the soundcard or synthesizer responds to them. Doing this will prevent your sounds from being in the wrong bank because a previously played file used a bank select on that channel.
  2. Even if your soundcard doesnít respond to them itís a good ideal to include bank selects for bank 0, if you know your files are going to be played on systems that do respond to bank selects.
  3. Use CC#0:0, CC#32:0, and a Patch Change to put the voices back into the General MIDI soundset. Donít assume the state of your soundcard. This is not a substitute for sending a GM Reset event though.
  4. Use the CC#0 - CC#32 - Patch Change normal method unless you specifically know you need one of the other methods. Most synthesizers respond to the normal method, but most of the ones that donít usually handle the extra events silently. There is usually no harm done unless you just happen to have a synthesizer that responds to one of these controllers in a very non-standard way.
  5. Always keep Bank Select events in proper order to prevent possible misinterpretation by the soundcard. Some soundcards do funny things when they receive a single CC#0 event and never receive a CC#32. They might not accept any more patch changes at all until they get that missing CC#32. Of course this would be bad behavior, but why take a chance?
  6. Allow time for the new instruments to be called up. When you play a bank select series of events give as much time as is necessary to make sure the sound is properly called up before playing any notes. Patches are usually called up very quickly, within split seconds, but donít play a bank and patch change and expect to always hear the correct sound immediately on every synthesizer. You might get a glitch in the sound or no sound at all for a few seconds.
  7. All suggestions about Patch Changes apply to bank selects as well. After all, you are just selecting a different set of sounds.

The following list includes the features that will covered in regular installments to this series. Thanks for reading and come back soon!

  1. Drums
  2. Initial setup
  3. Pan
  4. Volume
  5. Pitchbend range

Home