by Todd Albertson

Welcome back friends. I hope you brought a sharp mind and a good night's sleep with you this month, because we are going to get down and dirty in the actual computer codes that carry data in MIDI cables. It's a difficult subject, and it's not for the faint hearted!!!

Considering the things that computers do for us, it's positively amazing how stupid they are. Oh they are FAST, but they really don't understand much at all! In fact, the only thing they understand is numbers, and even then, only ones and zeros...actually not even that - it's really more like "not zero" and "zero", "yes" or "not yes", etc... ACK! It hurts to think like that, doesn't it?

Computers understand and group these "bits" of information in pairs, then those pairs in pairs, and so on. In other words, computers understand things best in twos, fours, eights, sixteens, thirty-twos, sixty-fours, etc... If you have an eight bit computer at home, it understands numbers as groups of eight bits each, otherwise known as a "byte". The byte is of particular interest to us, since this is how MIDI is sent. Information is passed in bytes (a group of eight "on" or "not on" states) down the MIDI cable. The instrument on the other end understands these bytes, and knows how to react to them. Each byte contains a tiny amount (oops, almost said "bit" - gotta WATCH that here!) of data. It takes many bytes just to play one note! Worse still, the bytes have to go down the cable ONE AT A TIME - even if many notes are played at once. What saves us of course, is the SPEED at which this all happens, that speed being actually a significant fraction of the Speed of Light!

Let's look at what happens when we wish to play a single note. Actually it is more proper here to say we are going to see how to "turn on" a single note. The first byte sent for any event is always the "STATUS" byte. This byte tells the receiver what to expect in the bytes to follow STATUS. For our example, STATUS will contain the com¬mand that says "NOTE ON". The receiver then knows to expect a NOTE NUMBER in the next byte which will tell it WHICH note to turn on (middle C is note number 60, C# is then 61, etc.). If the receiver and transmitter are able to send and receive velocity data, that data will be contained in the byte following the NOTE NUMBER byte. Let's examine the contents of a STATUS byte briefly: ON/OFF (ON / NOT ON) states are usually depicted as ones and zeros like this: <10010011>. It is helpful to further breakdown the byte into two smaller chunks like so: <1001> <0011>. The first half of the byte indicates that a NOTE ON event is about to occur. The second half of the byte tells the receiver what channel is being sent. If the receiver is set to the same channel, it will respond (channel 4 in this case).

The NOTE NUMBER byte following STATUS simply contains a number which is read into the receiver and this determines which note on the keyboard will actually sound.

Lastly, the VELOCITY byte will carry performance information about how hard the key was struck by the player. This can then be interpreted with the various components we have discussed (in previous MIDI Page columns) such as filters, and other modifiers.

This little analysis of MIDI code delved only into turning on ONE NOTE. There is another similar set of bytes to turn the NOTE OFF again. As you can see, it can get deep quickly in these waters! We'll do some more of this next time, and I will introduce you to hexadecimal math (this is not as bad as it sounds!). Hope you all are finding this interesting. I'm afraid this won't seem practical again until you understand quite a bit more about the code itself...ah well. See you next month!

NOTE: If you have a computer and a modem, take some time to call Todd's computer Bulletin Board Service. It's one of the best around! All the MIDI PAGE articles are on line for those of you who sub-scribed after we started the MIDI PAGE. Plus, you can ask Todd questions about MIDI related stuff or just leave him a message via your computer. The number is (313) 544-0405, after 8pm nightly. Of course, if you don't have a modem, you can address any MIDI related questions directly to R.A.P. If we can't answer your questions, we'll pass them on to Todd for his expertise. Also, we will be glad to make recommendations regarding any MIDI gear you might be thinking about purchasing, whether it be a sampler, synthesizer, or sampling keyboard. Just drop us a line or give us a call, and we'll try to at least steer you in the right direction.

InterServer Web Hosting and VPS


  • The R.A.P. CD - December 2005

    Production demo from interview subject,Yaman Coskun at Clear Channel, Washington, D.C.; plus more commercial work, imaging and promos from Billy Draper,...