Fundamentals

Now we can get in a little closer to the beast.  Since all this electronic equipment is really a bunch of little computers talking to each other, we need to realize that computers talk "binary" as their language.  Binary meaning two states.  In this case either on or off, or with numbers, 1 or 0.  Therefore, the switching going on inside a computer can be represented by this simple numbering scheme.

Each of the MIDI messages is a few 8-bit bundles of data such as 10010001.  That is really hard to read.  It is better, if we split it in half, 1001  0001.  This is a binary number, where each digit (including the zeros) are place holders for powers of 2, and we count from right to left just like regular decimal numbers.  Let's look at our example:  128  64  32  16  8  4  2  1 are the powers of two values of each place holder digit, if that place holder happens to be a "one".  If it is a "zero", no count.  The first digit is always either one or zero.  Two to the zero power is 1. Let's add up our example.  The first digit is a 1. That says it contributes to the count, so we have 1.  Next active digit is the fifth position or 16.  Now we have 16+1=17.  The next active digit is at the end, which represents 128.  The total is 145 in decimal. If we have all ones, we get 255 counts in decimal or you could say there are 256 different things an 8-bit binary number can represent, when you also count 0 as a number.

Let's look at the split version again.  Notice that each half counts up to 16 (8+4+2+1=15  plus zero, makes 16 counts total).  So 1111 in binary is 15 in decimal, and represents 16 different numbers.  The higher group of four start with 16 on the right and each count now is a count of 16.  16 in Greek is Hexa or Hexadecimal if your counting by 16s.  We can abbreviate our number by splitting it in half and use Hex to count each half, which make things much easier, and the resulting number is in Hexadecimal.

Example again, please.  1001 is 9 in decimal.  0001 is 1 in decimal.  Placed together as 91xH (xH added to show Hex type number) is the hexadecimal equivalent.  You don't believe it - okay what's 9x16 plus 1 => 144 +1 or 145.  Same as before, so it works.  Converting back and forth from binary to hex is an easy way to write down a group of ones and zeros.  So 11011100 => 1101 1100 => 8+4+1=13 and 8+4=12.  In hex that would be... oops, we need a single digit to represent the 13 and 12.  How do we do that?  Since the hex system goes beyond "9", it uses the letters of the alphabet to get up to 16 counts and keep a single digit, so 10 is A, 11 is B, 12 is C, 13 is D, 14 is E, and F is 15.  We don't need another digit, because the first digit can be a 1 or 0, that's two counts or two different numbers.

This is the hardest part of keeping binary or hex numbering straight is they start with zero as a count.  Back to the example: 13 is D, 12 is C so our number is DCxH in Hex.  Check it out - 128+64+16+8+4=220 (binary way).  13*16 plus 12 = 208+12=220 (Hex way).  It works.  The math is not the point.  I mention it just to show how it works.  What we want to pick up is an easy method to see the different binary numbers, since they are used to represent the MIDI data.  The binary result is used by the computer to decide what we want it to do.  You should rest your brain now.  From here on, everything is much easier to understand.

Commands

So how does all this new knowledge help me in music?  Since we are dealing with computers to manage all this digital traffic over our MIDI network, it has to be in a binary form.  That is the language of computers. All our MIDI commands and data bytes are binary information for the computer to feed on.  A few observations - each half of the byte can represent 16 events.  The lower half is use to identify the channel numbers mentioned in the earlier class.  The upper half is used to identify different kinds of commands.  Also notice that any byte that always has a 1 in the most significant place, or on the far left, are numbers equal to or greater than 80xH (1000 0000).  This is the distinguishing mark for the computer.

Commands have the 1 on the left, data has a zero.  Note-off commands start with 80xH, note-on commands with 90H, key pressure start with A0xH, etc. on up to F0xH where system exclusive type data resides.  Therefore, 9BxH would be a note-on command for channel 11 ..oops another got-cha.  By convention the MIDI manufactures use channels 1 thru 16.  The hex numbering system starts with 0, therefore, Hex 0 is channel 1, Hex F is channel 16.  So our example is a note-on for channel 12.

Great, which note? This is why the messages usually have more bytes.  The second byte is the value described by the command.  In this case a note.  We need a way to avoid confusing commands from data, so it was decided the highest digit of data type byte should be a zero.  This leaves only 127 counts in the lower digits.  We sacrifice the upper 126 possible combinations for the more important thing, that being, letting the computer know, if the byte is a command or data.

127 notes in music is really 127 1/2 steps or semitones.  That's 10 and half octaves!!  That should be enough.  60 was given the honor of being middle C.  That's what the lower bits do.  They provide us a number that points to a note.  Computers like numbers, so now we have a way for a computer to know which note we want to play.

The third byte lives by the same rules, has a zero for the upper bit, and has 127 levels available.  In this case it will represent volume (or velocity).  127 levels of volume are from pppp to ffff, which is plenty for anyone's ear.  The note is on now, so we next need to turn it off.  Here is the sequence of bytes: 9BxH  40xH  3CxH.  This is a note-on for channel 12, it is note 64, E above middle C, at volume level 60 or medium loudness.

You don't have to know all this, to work with the system, but if you wanted to delve into what is going down the wire, this is what you would see.  Next we turn the note off.  That sequence would be 8BxH  40xH  00xH or note-off for channel 12, it is the E above middle C, and notice now a volume of 0, which is interpreted as off.  Manufactures play a trick here by sending a note-on command and its two data bytes, then another data byte later that is recognized as a volume byte set to zero.  This causes the device to turn off the note.  The equipment keeps track of its incoming note sequence.  If another new note comes in, the computer reverts back to waiting for the full three byte off message as before, and the regular set of commands rule.  This helps lower the traffic rate problem over the connection.

Okay, that was more than you needed to know.  Like any digital system, if there is a trick to getting the job done faster with less effort, the designers are going to do it.  It then becomes really hard to describe to the novice, so we will stick to the basics.

Controllers

MIDI gear has many gismos built in to make marketing it more desirable.  Many are not used much, but some are.  The designers allow you to assign controller numbers to various switches, and slide pots.  The controller commands start with the B0xH level and have two more bytes that follow.  The first data byte tells the listening devise which controller to command, and the second data byte is the value of the command.  And as before the same limits of 127 controller types and only 127 different values that can be provided by the controller.  This is how the sustain pedal, the modulator wheel, and pitch bend is used, which are common to most synthesizers.  It's hard to think of 127 different kinds of controllers on a typical synth, which leads to a lot of spares for the future.  See the table of common controllers.  Notice in the table the pitch bend command uses two value bytes instead of one.  This provides 256 different levels, which was necessary to make pitch bending smooth sounding.  It also points out one of those tricky engineering practices designers use, if pushed.  They just make a new rule to handle the exception, but it must still fit into the MIDI general specification.

Modes

Since the intention of the MIDI spec, was to cover all possible types of synthesizers, a mode scheme was devised.  A nice variety of approaches are captured in the modes.  In the early days of inventing synthesizers many approaches were tried, limited by the cost of an electronic instrument.  There are four modes recognized by the MIDI spec and are built into most equipment, but most of these are now out dated by equipment that can do it all - meaning polyphonic, multi-timbrel.  That's a mouthful.  That means more than one note at a time (chords) and can have multiple sounds or patches playing at the same time.  Well, close to the same time.  Don't forget all is relative, since the data comes in serially.

Omni On - the equipment will respond to a message heard on any of the 16 MIDI channels coming in.

Omni Off - the equipment responds to each channel separately.

Poly - this signals the equipment to play Chords or multiple
notes.

If not Poly, then Mono or single voice.

Now we have four defined combinations of the above features, allowed by the MIDI spec, to create the modes.

Mode 1.  Omni On/Poly - equipment connected will respond to any MIDI channel and play chords

Mode 2  Omni On/Mono - equipment connected will respond to any channel and play only one note

Mode 3  Omni Off/Poly - equipment connected will be channel specific and play chords

Mode 4  Omni Off/Mono - equipment connected will be channel specific and play only one note

Mode 1 and 2 are obsolete.  Mode 3 is the most useful, since it allows playing chords on separate channels.  Mode 4 has been used by clever equipment designers by assigning a separate note to each channel going to a different synthesizer, so a chord could be played from this stack of devices.  Big fat sounds.  Cool, but dumb.

The MIDI spec has been very robust so far, but there has been one new approach that was adopted by many manufacturers and is not in the spec.  Multi-mode is like Mode 3 in nature, but adds the stipulation that the user assigns a maximum number of notes he wants each channel to play, up to the total number of notes available in the instrument.  This is very necessary, since there are a finite number of circuits in the equipment, that each play only one note each.  The note assignment can be dynamic, that is , the equipment assigns them as they come in by channel, and when the total available is reached, the first guy on, is the first one cut out, to be available for another channel request or availability will be automatic as note-off commands come in.

The new thought learned here is, there are a finite number of circuits that make sound in a synthesizer, and once exceeded by incoming data prior to making a circuit available by turning off a note, demands some scheme to be devised to take care of this situation.  When you read a synth spec, look for this feature.  They all list it.  Some play 16 notes, some 64, some more.  Let's look at an example.  I want 4 note hits from a trumpet patch, piano playing 3 notes in the left hand and 4 notes in the right, and I need 1 note for bass.  Lets make 5 notes available to the drum patch.  That's 17 tone generators that have to be available at any one given time.  Now lets add sustain to the piano and a playing style that glisses a couple of octaves ever now and then.  That could add another 24 tone generators until the sustain starts cutting notes off.  You can see if you use a synth to provide an ensemble of instruments all playing together, you need several channels.  Some fancy workstation type synths provide 128 voices (or little circuits that each will produce a note).  They would go fast in an orchestra setting.  More on multiple connections of MIDI circuits, ganged to get more "channels" later.

System Exclusive

System exclusive command messages start with F0xH.  Channel numbers are not used, because they are not needed.  The message ends with F7xH.  Everything in between is data that is exclusive of the common MIDI stuff described above, which are known as Channel Voice messages.  So what is exclusive data good for?  SysEx("sis-x") data, as it is called, allows a manufacture to send data out, that only his devices can use, no matter what channel it comes in on.  As mentioned before the various manufacturers have come up with a scheme to avoid duplicating identification codes that allows communication with the guts of the equipment without accidentally generating sound or activating controls.  This is useful for software updating, patch loading and off-loading, to store patches in out-board libraries, or a million other powerful reasons.

Those brilliant minds out there that are computer verse will recognize that not all the available combinations of Hex events have been shown yet.  What happens above F7xH to FFxH?  At F8xH through FFxH the System Real Time clock data is generated to be used by any device that is synchronizing with something.  Cool. F7xH to F8xH are spares currently undefined.

These are the basics.  A more in depth investigation on your part is welcome, but you don't have to know how the electronics work, but it is beneficial to know what it is doing.  Before we go on here is a circuit diagram of a typical MIDI connections for you hardware freaks.

© 2003 John Wolf - Wolf Tracks Music

Return