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.
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.
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.
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.
Question: I know my soundcard has instruments other than the first 128 General MIDI sounds. How do I select them?
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.
The following list includes the features that will covered in regular installments to this series. Thanks for reading and come back soon!