MIDI Data

The Rudiments of Computer/MIDI Data

by Benjamin Israel

Introduction

Bits, Bytes, Nibbles & The Binary, Decimal, and Hexadecimal Numbering Systems

Summary

List of Sources

Introduction

The role of the computer in the music world has occupied the minds of numerous composers, computer scientists and manufacturers since at least the nineteen sixties. The number of applications that have since been developed to exploit the computer's abilities is truly astounding. For example there are programs such as FINALE designed for the output of printed music and there are others like Csound developed for the synthesis of sound from the ground up and many others too numerous to mention. MIDI itself is not an application like FINALE or Csound, but rather a protocol by which MIDI data is communicated between devices equipped to receive and transmit MIDI data.

There are several immediate difficulties when one attempts to tell a computer how to communicate things like music which we traditionally think of in more abstract terms. The majority of these difficulties could be summarized as what do we know about music that can be quantified in absolute values? Computers do not think per se, they calculate, and as such are limited to things that can be calculated. This focus of this paper will be on the three numbering systems that computers use to calculate and process all types of data. This knowledge can then be used as a foundation for further exploration into the world of MIDI.

Bits, Bytes, Nibbles & the Numbering Systems



Bit is a contraction of binary digit. [(B)inary + dig(IT) = BIT] A digit is a whole number between 0 and 9 and binary means that there are two and only two possible values for each individual digit in a bit. Bits can have a value of 0 or 1, which works nicely when communicating with computers because at the very root level of the hardware a circuit is either on or off. In terms of each individual bit 0=off (a closed switch/circuit) and 1=on (an open switch/circuit).

A Byte is a string of bits. By convention a byte is eight bits long. For example: 0 is a possible bit and 00101100 is a possible byte. Because there are only two possible numbers for a bit, a byte is a base 2 numbering system. Imagine that each bit in a byte going from left to right is a place holder in much the same way that each digit in a number like 2,317 is holding a place. In the number 2,317, the 2 is holding the thousands place, 3 is holding the hundreds place, 1 is holding the tens place, 7 is holding the singles place. In a more fundamental way what we're really saying is that 2x1,000(103)+3x100(102)+1x10(101)+7x1(10 0) = 2,317. This is in essence the decimal numbering system. It is also the system we use in our everyday lives. Now imagine that each place holder instead of being 10nth (1,000s,100s,10s,1s,etc.) is 2nth (1,2,4,8,etc.). In a full eight bit byte going from left to right we would have the following number array:27 (128)+26 (64)+25(32)+24 (16)+23 (8)+22 (4)+21 (2)+20 (1) and because bits only allow for an on or off position what we really have is as follows: 128 or 0, 64 or 0, 32 or 0, etc. So in our imaginary byte 00101100 we have the following: (0x128)+(0x64)+(1x32)+(0x16)+(1x8)+(1x4)+(0x2)+(0x1) = 44. This is in essence the binary numbering system and how it works in relation to a byte. Now we know what a bit and a byte is and how to derive values using the decimal and binary numbering systems.

A nibble is a cute way of saying half-byte (i.e. 1 byte = 2 nibbles). So if our imaginary byte were to be broken down into two nibbles it would be as follows: from the byte 00101100 into the nibbles 0010 and 1100. These nibbles could be individually summated as 0010=32 and 1100=12. Nibbles were invented as a shortcut for us human beings to calculate byte values. The hexadecimal numbering system was developed as a shorthand for talking about bytes and directly corresponds to the values ,whatever they may be, of each of the two nibbles that make a byte. It is a little more complicated than either the decimal or binary numbering systems but is based on the same principal. Instead of being a base 2 or a base 10 numbering system as in the binary and decimal numbering systems, it is a base 16 numbering system(1). Now maybe you're wondering ,how do we get sixteen discrete numerical possibilities with a single digit when we only have 10 whole numbers (0-9) to work with? Well, in short, why not A-F where A=11,B=12,C=13,etc. on up to 16. So instead of 0-9 (10 possibilities) we have 0-F (16 possibilities). The next part important to realize about the Hexadecimal numbering system is that each Hexadecimal number consists of two digits where the first digit is a multiple of 16 (with a possible multiplier of 0-F) and the second digit is a multiple of 1 (with a possible multiplier of 0-F). A few examples will probably do more to illustrate this point than a verbal explanation. Before the examples ;however, and for the sake of convenience I will use the $ to denote a Hexadecimal number. Now for the examples: a) $39 = (3x16) + (9x1) = 57 and therefore $39=57 b) $B6 =(12x16) + (6x1)=198 and therefore $B6=192 c) $FC = (15x16) + (13x1)= 251 and therefore $FC = 251. The range of the Hexadecimal numbering system is from $00-$FF (0-255), exactly the same range of numerical possibilities as in a byte. This is where it gets interesting. Remember our little friend the nibble. Well in our imaginary byte 00101100 the left nibble is 0010. This nibble and all other possible combinations of 1's and 0's for the left nibble can be notated as a multiple of 16. The range of possibilities for the left nibble is 0000 (0x16) to 1111 (15x16) and all combinations in between. Don't forget that powers of 2 still apply to each digit in a nibble when converting to Hexadecimal (i.e. 23,22,21,20). For the right nibble instead of multiples of 16, it is multiples of 1. So in the right nibble the range of possibilities is 0000 (0x1) to 1111 (15x1) and all combinations inbetween. Finally, as a demonstration of all these ideas put together, we will take our imaginary byte which is in the binary numbering system, break it down into nibbles, convert the nibbles to Hexadecimal, and then convert the Hexadecimal number to a decimal value. Byte=>00101100 Nibbles=>0010/1100 Hexadecimal=>$2B Decimal=>44.



Summary

In the age of spiraling technology, where even state of the art hardware and software can and often does become outdated or even obsolete in just a few months, it is still not a bad idea to have a fundamental understanding of how computers deal with data on the most basic level. If nothing else, this understanding should inspire awe because no matter how sophisticated the hardware or software is, it is all being controlled by a bunch of 1's and 0's doing little more than turning switches on and off.



1. Note that Hexa=6 and Decimal (decca) = 10, ergo Hexadecimal =16, just as Binary (bi) = 2 and Decimal (deca) = 10 and hence the name for each of these numbering systems.

List of Sources

"How MIDI Works-With Home Recording"; by Dan Walker, Revised by Bobby Maestas & Peter L. Alexander, Published by Peter L. Alexander Publishing Inc., Copyright 1991

"The Next MIDI Book-Starting With the Numbers"; by Lorenz Rychner & Dan Walker,Published by Katamar Entertainment Group, Copyright 1991


Last Updated on Tuesday, March 12, 2002