The MIDI Page: Base 16 Hexadecimal Math

by Todd Albertson

My sixth grade math teacher was a gracious old lady named "Mrs. Bailey". She was thin, tall, near retirement, and walked so stiffly and properly that she always looked as though she was being held upright and together with bailing wire, which was unfortunate, considering her name. In the sixth grade, I of course knew a great deal about life and humanity. (Much more than I do now!) Since I was such a man of the world, I and my friends immediately labeled this fine old lady as a mean old biddy. Poor Mrs. Bailey... she tried so hard to be fair, and we didn't make it easy. This situation was further compounded by the fact that I was in the school orchestra, which met twice a week DURING math class. Since I was learning the cello, I was excused (to my infinite pleasure), and missed many, many math lessons. In particular, I enjoyed avoiding the lessons concerning math systems in other bases. The system we are all used to, is known by mathematicians as "base 10". There are as many math systems as human imagination has dreamed up however, and three such nightmares have surprised otherwise normal people by actually being useful! One, known as BINARY math (base 2), is used extensively by computer programmers and other perverts, while those of us who merely wish to "interface" (two-bit word!) with computer systems have been allowed to lapse into the relative sanity of OCTAL (base 8), and HEXADECIMAL (base 16). Mrs. Bailey undoubtedly clucks sympathetically when she looks down at me from heaven (that's where she surely is). I should have listened, Mrs. Bailey. You were right, Mrs. Bailey. I have learned my lesson.

Base 16 math is quite simple and easy to adjust to since it uses so many symbols already familiar to us all. From now on, in this article, when I refer to the normal numbers we all know and despise, I will spell out the word, like this: "nine", instead of "9". When I am referring to a non-base ten number, I will show the actual number like this: "4F".

As you have no doubt noticed, hex numbers include some letters of the alphabet. This is because there are more than just ten digits in hex. Consider: In our normal base ten math system, we have zero, one, two, three, four, five, six, seven, eight, and nine. Now go back and count the words... TEN of them, because ZERO is a digit. When we have numbers greater than nine in our regular base ten math system, we simply reset our first column to zero, and put a one in the next column to the left. Base sixteen is no different at all, except that instead of only ten digits available, we have sixteen. In hexadecimal math, we have the following digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. A is equal to ten, B is equal to 11, C is equal to 12, D is equal to 13, E is equal to 14, F is equal to 15. Like base ten, when we want to write a number bigger than our base (sixteen), we reset our primary column to 0, and increment the next column on the left. Thus, 10 is equal to sixteen. Hmmmm... that was a strange sentence to type! You can see that converting two digit numbers from base sixteen to base ten is relatively easy. Simply count the number of sixteens in the second column and add the number in the first column to that. That's BASE-ically it... hehe. For instance, 4F is converted by multiplying 4 times sixteen to get sixty-four. You then add the rightmost column to that. F = fifteen, which added to sixty-four, produces the result: Seventy-nine. Reverse the process to convert base ten to hexadecimal. It's really not hard.

Hexadecimal is used throughout computerdom, and has therefore found its way into the world of MIDI as well. Another oddity is the math system known as OCTAL. Base eight... uh-oh. Not so bad, really. Just the same principles, but using the digits 0, 1, 2, 3, 4, 5, 6, 7. Thus, 10 = eight. Simple.

Now the hard part. Look at your synthesizer. There is about a fifty percent chance you have a bastardized version of octal math calling your patch numbers. The industry manufacturers, in their infinite wisdom, have chosen to INVENT yet another, less easy to understand math system. If you have a Roland Juno 106, or Korg DW 8000, or any of hundreds of other synthesizer types, you have been blessed with this ridiculous nonsense. In this system, there is no "0", rather, the first digit is "1". A more difficult, less intelligent form of OCTAL, the digits are 1, 2, 3, 4, 5, 6, 7, 8. In this system patch "one" on your synthesizer is input as "11". AIYEEEEE! Patch "35" is really the "twenty-first" patch in the synthesizer. This system is so convoluted, that I don't even want to try to explain the logic (or lack thereof) involved. Suffice to say that the principles do not remain consistent in this system.

Now then, if you have more than one instrument type in your studio, chances are good that you have to deal with mixed math systems, plus the bastardized non-system. The Yamaha people have (for once) thought ahead, and kindly equipped their products with base ten math systems, for human consumption. Their KX 88 controller is so well designed (though horribly documented), that it has multiple math calling systems built in. Some translation is still required however, and a basic understanding of math base logic is necessary for any advanced use of MIDI. For instance: Let's say you want to call a certain patch on your reverb unit when you get to a certain place in the promo you are building. You want to call patch 15, so you go over to your MIDI sequencer (which is synced to tape) and input fifteen at the right moment. You then run the tape and begin the mixdown. Suddenly, you are horrified to hear strange noises, and wailings coming from your speakers! At first you think it's kind of hip, but the PD will have none of it! He thinks you are out of your mind! Typical scenario (yeah, sure). Now it is your job to figure out how to give the PD the sound he wanted in the first place (patch 15). You COULD input the patch number manually at the right moment, but that would tie you up during a possibly critical moment in the mixdown. It would be better if you could let the sequencer do the job you bought it for (at a hefty price). Here is the answer: The reverb unit is using a different math base system. It is probably using the nasty little bastardized octal system I described earlier. Patch "15" is really "five" in your sequencer's math system. Don't be misled into thinking this convoluted system is EVER going to be easy for you. I STILL don't get it right all the time, and I have been using it for five years! Just experiment with it, and keep the principles in mind that I have outlined here. If you would like a conversion chart, you may write to:

Todd Albertson
c/o Clean Sheets, Inc.
[address removed]

Include a self-addressed stamped envelope, because you know how much the music business pays! See you next month.

Comments (0)

There are no comments posted here yet