MIDI address converter and router

Described is a digital electronic device which selectively intercepts and reroutes the serial data being transmitted between digital music instruments interacting via the MIDI signal standard. Simultaneously, the device performs either transposition or control increment operations by incrementing (or decrementing) only those data bytes which are MIDI addresses of either musical keys or selected controls, (e.g., controls pertaining to volume, pitch bend, tremolo, tone duration, and the like) respectively. The device when equipped with logic gates can operate even faster than a microprocessor-based device performing the same functions, and no programming is required. In fact, a preferred device of the invention built with logic gates and other components available now is capable of operating at 250 kilobaud which is 8 times as fast as the present MIDI baud rate.

TECHNICAL FIELD 
This invention relates to electronic keyboards and musical instruments 
designed to communicate with each other by a digital system called MIDI, 
and more particularly to an electronic device (hardware) which, when 
inserted in the communication lines between MIDI instruments can transpose 
the music and also perform a very useful control increment operation. The 
device can also route signals from one set of instruments to another in 
different ways. It is unique and particularly advantageous because in its 
preferred form in which logic gates are utilized to monitor and to perform 
logic functions on the data being processed, it can operate even faster 
than a microprocessor-based device of this invention and no programming is 
required. 
BACKGROUND 
MIDI stands for Musical Instrument Digital Interface. It is an 
internationally accepted standard for signal communication between digital 
music devices. MIDI signals consist of 8 bit bytes sent serially at a 
standard rate of 31.25 kilobaud. The most significant bit (MSB) is used to 
indicate whether the byte is a "Status Byte" (a byte that commands a MIDI 
Device to perform a certain operation, e.g., "Key On") or a "Data Byte" (a 
byte that supplies the numerical value of data, e.g., "Key No."). If the 
MSB is a one then the byte is a Status Byte, otherwise it is a Data Byte. 
This leaves 7 bits for data which can range from 0 to 127. Numbers larger 
than 127 require multiple Data Bytes. The 4 least significant bits of a 
Status Byte indicate the MIDI channel number. This allows 16 different 
MIDI instruments, each performing different musical parts, to be played by 
MIDI signals sent over a single cable, because each instrument can be set 
to respond to all channels or just one selected channel. The remaining 
three bits of Status Byte (between the MSB and channel number) are used to 
convey infommation such as Key On, Key Off, Control Change, etc. Control 
is used to distinguish things like modulation wheel, sustain pedal, 
volume, etc. from the ordinary keys of a keyboard. When one of these 
controls is changed the Status Byte 1011cccc is sent by the MIDI system to 
indicate Control Change, which is then followed by a Data Byte to indicate 
which control, and one or more Data Bytes to indicate the amount of 
change. In the above Status Byte and in following statements cccc 
represents the binary channel number. When a key is pressed, the Status 
Byte 1001cccc is sent to indicate Key On on channel cccc, which is then 
followed by a Data Byte to indicate which key, and a third Data Byte to 
indicate the speed with which it was pressed. When the key is released 
1000cccc is sent to signify Key Off on channel cccc followed by a Data 
Byte to indicate which key. The first Data Byte following a key on, key 
off, or control change Status Byte is called a MIDI Address since it 
indicates which key or control was activated. Other Data Bytes are not 
considered addresses. 
Transposing involves the shifting of music from one musical key signature 
to another. Music written in one key can be transposed up or down any 
selected number of half tones to sound in another key. The demand for 
transposers is evident from the fact that there have been over 50 U.S. 
patents related to transposition. See U.S. Pat. No. 4,176,573 for example. 
With the MIDI system transposition can be accomplished by recording the 
MIDI signals with a sequencer, and with the aid of a computer program 
usually stored in the sequencer's ROM, subtracting or adding the desired 
amount to each MIDI address which follows a Key On or Key Off Status Byte. 
Likewise a control increment operation could be performed by incrementing 
the MIDI address of a control, but most sequencers are not designed to do 
this. The modified data can then be output so that the desired 
transposition is accomplished, but with a time lag which in certain 
situations is intolerable. Signals from MIDI keyboards are often used to 
play drum machines but most sequencers always transpose all channels by 
the same amount, i.e., they are not channel selective with respect to 
transposition. This causes the drums to play incorrectly when music with 
drum information is transposed. Musicians are also plagued by the fact 
that the numbering of the controls on MIDI equipment made by different 
manufacturers is not always the same, and by inconsistencies in equipment 
made by the same company, e.g., Yamaha's QX1 sequencer addresses the 
volume control as number 7, but their DX7 Keyboard is incapable of sending 
volume information to the sequencer because it has no control 7. Musicians 
with several pieces of MIDI equipment find that routing boxes which can 
effectively disconnect and reconnect MIDI cables in different ways by just 
flipping switches are a necessity for efficient operation of the 
collective equipment. The circuitry to solve the above problems should 
therefore be housed within a routing box for convenience. 
SUMMARY OF THE INVENTION 
The present invention solves the above problems with a routing box 
(designed to meet the demands of a keyboard artist operating a recording 
studio containing much MIDI equipment) which can also convert one MIDI 
address to another very quickly. It can therefore be termed a MIDI Address 
Converter and Router. In a preferred embodiment, MIDI signals entering the 
device through at least six standard MIDI jacks are converted to normal 
digital logic signals by high speed opto-isolators. The signals are then 
routed by switches through buffers to selected output jacks or they may be 
switched into the MIDI Address Converter, later referred to as MAC, which 
can either transpose the music or perform a control increment operation. 
In one preferred form the device includes a switch with two positions 
(which may be labeled KEY CHANGE and CONTROL CHANGE) which is used to 
select which operation is performed. The amount of the change is input for 
example by pressing a button (which may be labeled INCREMENT COUNTER) the 
desired number of times and preferably this information appears on a LED 
display. The counter is cleared with a RESET button. A switch with 
suitably labeled positions such as + and - is used to determine the sign 
of the increment added to the MIDI Address. And, in this preferred form 
the device also includes a switch with two positions (which may be labeled 
1-8 and ALL) to determine whether the address converter is to affect all 
channels or only channels 1-8. These controls are readily arranged so that 
a musician can instinctively operate them as quickly as he does the 
controls on a keyboard. 
A further understanding of the MAC can be obtained by studying its block 
diagram in FIG. 1 and the more detailed diagram of the Controller in FIG. 
2. 
It will be seen that this invention provides a digital electronic device 
which includes electronic means selectively intercepting and rerouting the 
serial data being transmitted between digital music instruments 
interacting via the MIDI signal standard. Simultaneously, the device 
performs either transposition or control increment operations by 
incrementing (or decrementing) only those data bytes which are MIDI 
addresses of either musical keys or selected controls, (e.g., controls 
pertaining to volume, pitch bend, tremolo, tone duration, and the like) 
respectively. The foregoing and other emodiments of this invention will be 
still further apparent from the ensuing description, accompanying drawings 
and appended claims. 
It should be emphasized that a major advantages of the MAC is the increase 
in speed resulting from the use of logic gates, to perform decisions and 
other logic. In fact, a device of this invention built with logic gates 
and other components available now is capable of operating at 250 kilobaud 
which is 8 times as fast as the present MIDI baud rate. An additional 
advantage of the MAC is that no programming is required. However, for some 
applications a microprocessor may be used even though it would require 
extra time to fetch and execute program statements from memory. 
Other objects, features and advantages of the invention, and a better 
understanding of its construction and operation, will be had from the 
following detailed description of a preferred embodiment (involving use of 
the MAC), when read in conjunction with the accompanying drawings.

DESCRIPTION OF PREFERRED EMBODIMENT 
Because in the preferred form depicted signals enter and leave the MIDI 
Address Converter and Router system through the Router section, the Router 
section shown in FIG. 6 will be discussed first. 
The components in the input and output stages of the Router are determined 
by the standards of the MIDI system. Signals entering the input jacks in 
the form of 5 mill current loops, limited by 220 ohm resistors 24 through 
29, are converted to normal 5 volt digital signals by opto-isolators 42 
through 47, typically pS2007, ECG3087, or equivalent. Diodes 6 through 11, 
typically 1N4 or equivalent, serve to protect the opto-isolators against 
accidental voltage of wrong polarity or amplitude. Pull-up resistors 30 
through 35 should be about 1000 ohm. In the output stages buffers 36 
through 41 should be equivalent to two 74LSO5 inverters connected in 
series and the current limiting resistors 12 through 23 should be 220 ohm. 
The label C on switches 1 through 4 and also on the jack labeled C IN 
stands for COMMON. The label I on switches 1 through 4 stands for 
INDIVIDUAL. These terms are routinely used and well understood by users of 
MIDI gear. The label K on switch 5 and also on the jacks labeled K IN and 
K OUT stands for Keyboard-controller. A study of the circuit diagram of 
the Router will reveal the following facts. Signals out of the THRU jack 
are the same as the signals entering the C IN jack. When switch 2 is in 
position I signals pass unchanged through it from the 2 IN to the 2 OUT 
jack, but when it is in position C, signals pass unaltered through it from 
the C IN to the 2 OUT jack. Similar statements can be made about switches 
3 and 4. The K IN signal is routed through the MAC via UART 50 to the K 
OUT jack when switch 5 is in position K, otherwise the K IN and K OUT 
signals are equal. The C IN or 1 IN signal selected by switch 1 in 
position C or I respectively is routed through the MAC to the 1 OUT jack 
when switch 5 is in position S1, otherwise the 1 OUT and selected signals 
are equal. The Router can therefore route signals from the C IN, 1 IN, or 
K IN jacks through the MAC for the desired address conversion. 
Turning now to the MAC, its block diagram, FIG. 1, will be considered 
first, followed by the details of each block. Serial data from the Router, 
after conversion to parallel data by UART 50, appears on data bus D1-D8 as 
byte D input to Adder 51 and Controller 52. The amount to be added or 
subtracted to a MIDI address is input to the Adder as byte Q from the 
Increment Selector 53 via bus Q1-Q8. Byte B output by the Adder to the 
UART via bus B1-B8 depends upon the logic state of control lines C1 and 
C2. If (C1,C2)=(1,1) then B=D. If (C1,C2)=(0,1) then B=D -Q. If 
(C1,C2)=(1,0) then B=D+Q+1. Byte B is converted to serial data by the UART 
and sent back to the Router. The Controller receives information about the 
sign of the increment via control line C3 on which the voltage is high for 
plus and low for minus. Referring to the control lines between the UART 
and the Controller, DAV stands for Data Available, TBMT stands for 
Transmitter Buffer Empty, and DS stands for Data Strobe. DAV goes high 
each time a new byte appears on D1-D8. TBMT goes high when the transmitter 
buffer becomes ready to accept new data. A low going strobe on DS will 
then cause DAV to go low, and Byte B to be loaded into the transmitter 
buffer. The rising edge of the strobe will cause transmission to begin and 
TMBT to go low. 
The preferred UART is Intersil's IM6402 which is wired into the MAC exactly 
as shown in FIG. 4. The circuitry involving the Schmitt trigger connected 
to pin 21 of the UART is required because the IM6402 must be reset after 
power-up in order to function properly. The frequency of clock 49, FIG. 1, 
should be 500 kilohertz so that the UART will operate at 31.25 kilobaud as 
required by MIDI standards. 
The Adder, which must also be able to subtract, may be built with EXCLUSIVE 
OR gates, etc., but it is most conveniently constructed with two of RCA's 
40181 Arithmetic Logic Units connected and wired into the MAC as shown in 
FIG. 5. It will then function as stated above with regard to control lines 
C1 and C2. 
The Controller, shown in detail in FIG. 2, is complex because it must 
perform many functions. It must cause the Adder to add or subtract, as 
desired, the amount which has been entered into the Increment Selector by 
the person operating the device, to the first data byte following a Key On 
or Key Off Status Byte when the Key Change mode (switch 55 in position KC) 
has been selected by the operator. It must do this however, only if the 
key's channel number is in the range chosen by channel range select switch 
56 with positions labeled 1-8 and ALL. In the Control Change mode (switch 
55 in position CC) only the first data byte (with D7 low) following a 
Control Change Status Byte should be incremented. The restriction on D7 is 
due to the fact that the musician does not want the sustain pedal control 
number altered while other control numbers are being incremented. 
To simplify the following discussion a data byte which should be 
incremented will be called a Select Data Byte and the Status Byte 
immediately preceding it will be called a Select Status Byte. In the Key 
Change on all channels mode a Select Status Byte would be 100Xcccc where 
ccc represents the bits of an arbitrary channel number and X, which is 1 
for Key On and 0 for Key Off, is arbitrary. In the Key Change on channels 
1-8 mode a Select Status byte would be 100X0ccc because the channel number 
would be greater than 8 if bit D4=1. In the Control Change mode a Select 
Status byte would be 1011cccc. Comparator 54 makes EQ high (logic 1) only 
when bits X1-X4 are equal respectively to bits Y1-Y4, i.e., EQ is high 
only if X=Y. The effect of comparator 54, mode switches 55 and 56, and the 
D bus connected as shown is to make EQ high only when a Select Status Byte 
is present on the D bus. However, D bus data is not valid while it is 
being clocked onto the bus. Since DAV goes high at the moment when the D 
bus data becomes valid we can be sure that a valid Select Status Byte is 
present on the D bus only if both EQ and DAV are high which would make the 
output of NAND gate 58 low. Therefore, the arrival of a valid Select 
Status Byte is indicated by a high to low transition at the input of 
toggle flip flop 63 which causes its Q output to go high. This causes the 
output of 57 to go low which causes the Q output of 62 to go high. We can 
now say that a Flag (Q output of 62) has been set to indicate that the 
next data byte will be a Select Status Byte. The setting of the Flag did 
not cause any change at the output of AND gate 67 because the T input of 
62 went low before Q went high. Therefore Select 76 is still low after the 
Flag has been set. 
The sole purpose of the circuit involving 59, 60, 64, 65, 66, and 69 is to 
provide a low going strobe (whose width depends upon the RC time constant 
of 65 and 69) on DS each time new valid data appears on bus D and the 
transmitter buffer becomes empty. The strobe will reset DAV and cause byte 
B, output from the adder, to be loaded into the transmitter buffer of the 
UART which begins transmission to the router at the rising edge of the 
strobe. TBMT also goes low at the rising edge of the strobe. This low 
signal which is inverted by 61 will cause flip flops 62 and 63 to be reset 
by AND gate 68 only if Select 76 is high. 
Once the Flag has been set by the arrival of a Select Status Byte as 
explained above, the subsequent arrival of a valid Select Data Byte will 
make EQ low which will cause Select 76 to go high via the action of gates 
57 and 67. 
A high on Select indicates that the data present on bus D should be 
incremented unless D7 is high in the Control Change Mode. As explained 
above, this restriction is necessary to avoid the problem with the sustain 
pedal. It is therefore necessary to gate Select, D7, and Y1 with gates 70, 
71 and 72 as shown. We can then say, with no restrictions, that whenever 
Enable 77 is high, the data on bus D must be incremented. The sign of the 
increment is plus when the logic state of control line C3 from the 
Increment Selector is high and minus when it is low. Enable 77 and C3, 
connected to 73, 74 and 75 as shown, will cause control signals to be sent 
to the Adder 51 via C1 and C2 which will cause it to add when Enable 77 
and C3 are high, subtract when Enable 77 is high and C3 is low, and make B 
and D bus data equal when Enable 77 is low. 
It will be appreciated that in FIG. 2, all grounds shown are logic 0 and 
the points labelled 5V are logic 1. 
The Increment Selector is shown in more detail in FIG. 3. When the normally 
closed push button labeled Increment Counter is pressed, a debounced pulse 
causes byte Q, output by the binary counter to the Adder 51 and the 
display, to be incremented by one. The Reset button is used to clear the 
counter. The switch makes the logic state of C3 high when in the ADD 
position and low in the position labeled SUB as required. The red or green 
LED tells the operator, even in the dark, whether addition or subtraction 
is being performed, while the display indicates how much. The display may 
be a simple binary LED display or a 7 segment LED display with the usual 
decoders and drivers. 
All chips not previously specified should preferably be high speed CMOS 
with part numbers beginning with 74HC. The toggle flip flops used in the 
Controller may be improvised from 74HC393 dual binary counters. 
While this invention has been shown and described in connection with a 
particular preferred embodiment, it is apparent that various changes and 
modifiations, in addition to those mentioned above, may be made by those 
skilled in the art without departing from the basic featues of the 
invention. For example, a mere regrouping of components, e.g., gates 70 
through 75 in FIG. 2 being considered a part of the Adder in FIG. 5 rather 
than part of the controller, could lead to a different block diagram and 
different schematics for each block. In such a case, the actual physical 
system would be unchanged but its description would be different. More 
simple subsystems (with reduced capabilities) could obviously be produced 
by eliminating various components from the preferred embodiment. For 
example, if one required a device capable of transposition only, then only 
one input and one output jack would be needed, and all routing, mode, and 
channel select switches, and several gates and connections could be 
eliminated. Although the controller in FIG. 2 is particularly well suited 
for use in the MIDI Address Converter of this invention, it will be 
understood that the controller or subsystems thereof, may be used for 
other applications with slight modifications if necessary. For example, it 
may be used to render normally incompatible digital devices compatible 
with each other by suitably altering the data being transmitted. 
Accordingly, it is intended to protect such subsystems and all other 
variations and modifications of the preferred embodiment which are within 
the true spirit and valid scope of this invention.