Go to: | 01 Directory | First 01W page |
Topics | |
A switch is open or closed. Think of your flashlight. It's just a switch, a power source (battery), and a light. If the switch is open, electricity can't flow, and the light is off. If the switch is open, electricity flows, and the light is on.
We can show if a switch is open or closed by using a one ("1") or a zero ("0"). For example, if the switch is open, let's call that a zero, or "0". If the switch is closed, that would be a one, or "1". This is quite arbitrary - we could just as easily done it the other way around (and we actually do just that in intermediate binary class), but for now, 0 = off, or nothing, and 1 = on, or something.
Suppose you had four flashlights, and you wanted to send a phone number.
If 0 = off and 1 = on, here's a table of flashlight codes you could use
to send zero through nine:
Decimal | Four-Flashlight Code (4-Bit Binary) |
---|---|
0 | 0000 |
1 | 0001 |
2 | 0010 |
3 | 0011 |
4 | 0100 |
5 | 0101 |
6 | 0110 |
7 | 0111 |
8 | 1000 |
9 | 1001 |
Hexadecimal | Binary | Hexadecimal | Binary | |
---|---|---|---|---|
0 | 0000 | 8 | 1000 | |
1 | 0001 | 9 | 1001 | |
2 | 0010 | A | 1010 | |
3 | 0011 | B | 1011 | |
4 | 0100 | C | 1100 | |
5 | 0101 | D | 1101 | |
6 | 0110 | E | 1110 | |
7 | 0111 | F | 1111 |
If we have eight bits, two groups of four, we can represent 256 values. Eight bits is called a "byte". If you see something is called "byte-wide", that means it is eight bits wide. (By the way, and you don't see this much anymore, 4-bits is called a "nibble", or if you really want to be cute, "nybble".)
Anyway, we can show the value of a byte by dividing the byte down the
middle into two groups of four, then using the hex code for each nibble.
Examples:
Binary | 4-Bit Groups | Hex Encoding | Final Hex Code |
---|---|---|---|
01010001 | 0101 0001 | 5 1 | 51h |
10101110 | 1010 1110 | A E | AEh |
11110111 | 1111 0111 | F 7 | F7h |
Decimal is fairly standard - put a lower case "d" at the end (like, "51d").
Hex, on the other hand, has at least three "standards":
lower case "h" suffix (51h)
upper case "H" suffix (51H)
"0x" prefix (0x51)
Least Significant Bit (LSB): The right-most bit (which represents the lowest value). The "1" in 00000001 is the LSB.
Now that you understand bits and bytes, you are ready to learn how the 01 sends data over MIDI. Technically, the 01/W uses Packed Transmission with the Most Significant Bits sent first.
You can't. Every time you put an 8-bit byte into 7 MIDI Data bits, you're gonna have one bit left over. You need a scheme to get these left-over data bits into the MIDI transfer somehow. Different manufacturers use different schemes, and some manufacturers use different schemes in different products.
This group of eight MIDI Data bytes is then sent out one bit at a time, starting with the MSB byte, then byte 0, byte 1, ... , byte 6, and finally byte 7.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | |
---|---|---|---|---|---|---|---|
00000000 | 10001000 | 01000100 | 11001100 | 00100010 | 10101010 | 01100110 |
Build a byte containing only the MSB of those seven bytes. Bit 0 come from Byte 0, bit 1 comes from Byte 1, and so on. Call this the MSB Byte.
bit 7 | bit 6 | bit 5 | bit 4 | bit 3 | bit 2 | bit 1 | bit 0 |
always 0 | MSB of
Byte 6 |
MSB of
Byte 5 |
MSB of
Byte 4 |
MSB of
Byte 3 |
MSB of
Byte 2 |
MSB of
Byte 1 |
MSB of
Byte 0 |
---|---|---|---|---|---|---|---|
0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
MSB | Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 |
---|---|---|---|---|---|---|---|
00101010 | 00000000 | 00001000 | 01000100 | 01001100 | 00100010 | 00101010 | 01100110 |
Reminder: This applies to 01 internal data only. All external MIDI stuff (like SysEx headers, MIDI commands/instructions) are already in MIDI format.
Why? If you do a MIDI Dump from the 01, like into your computer-based sequencer, you will see a series of MIDI bytes that don't exactly line up with what you read in the 01 MIDI Tables. That's because internal to the 01, 8-bit data is used. MIDI uses 7-bit data, with the MSB = 0.
To understand the MIDI data, you must convert the 7-bit MIDI data to 8-bit internal data as follows:
Write your MIDI data in same order it was received, first received byte on the left, next byte to the right, and so on ( byte 0, byte 1, byte 2, ... byte 7).
MIDI
Byte 0 |
MIDI
Byte 1 |
MIDI
Byte 2 |
MIDI
Byte 3 |
MIDI
Byte 4 |
MIDI
Byte 5 |
MIDI
Byte 6 |
MIDI
Byte 7 |
01
MSB |
01
Byte 0 |
01
Byte 1 |
01
Byte 2 |
01
Byte 3 |
01
Byte 4 |
01
Byte 5 |
01
Byte 6 |
---|---|---|---|---|---|---|---|
00101010 | 00000000 | 00001000 | 01000100 | 01001100 | 00100010 | 00101010 | 01100110 |
Move each bit out of the MSB Byte to the MSB of all the original 8-bit bytes. Bit 0 goes to Byte 0, bit 1 to Byte 1, through bit 6 to Byte 6. (Bit 7 is always 0, and doesn't go to any Byte.)
bit 7 | bit 6 | bit 5 | bit 4 | bit 3 | bit 2 | bit 1 | bit 0 |
always 0 | MSB of
Byte 6 |
MSB of
Byte 5 |
MSB of
Byte 4 |
MSB of
Byte 3 |
MSB of
Byte 2 |
MSB of
Byte 1 |
MSB of
Byte 0 |
---|---|---|---|---|---|---|---|
0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
You now have 7 bytes of 01/W 8-bit internal data.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | |
---|---|---|---|---|---|---|---|
00000000 | 10001000 | 01000100 | 11001100 | 00100010 | 10101010 | 01100110 |
MIDI uses 8 bits for all transfers, but the MIDI language defines two classes of messages: Status and Data. Status messages have Bit 7, the MSB, = 1. Data messages have Bit 7 = 0. So, if we tried to send eight bits of data in a Data message, and Bit 7 happened to be a "1", then our data would be interpreted as a Status message - which it isn't.
In other words, MIDI is an 8-bit language. If we used all eight bits for data, there would be no way to say what to do with the data - no way to identify MIDI commands.
Copyright ©1998, 2015 by Ken Westover at Cliff Canyon Publishing Co. All rights reserved.
This material may not be distributed without the written permission of the author.
E-mail questions or comments to cliffcan@indra.com.
Go to: | 01 Directory | First 01W page | Top of this page. |