Building a MIDI break-out box

			 A cheap MIDI connector box
			 for the Sound Blaster card
			   v1.2  March 22nd, 1991
			       Adam Mirowski

Sound Blaster  has a  "built-in MIDI interface", but "all you need
is a MIDI Connector Box (optionally available) in order to connect
your SB  to MIDI  instruments or  keyboards", says  the add on the
box. The  list price  for that  gadget is  as high  as $79.95  and
anyway it  is  not  available  here  in  France.  Also,  the  MIDI
interface is  not compatible  with the  MPU-401 standard  (and  de
facto norm) and is only one-way-at-a-time. So the box is not worth
the money,  except if you try to set up it by yourself. For $5 you
can get  the basic  functionalities and  for $10  everything which
comes with the original one.

I have heard on Usenet recently  that Sound Blaster will soon come
out with a  standard MIDI interface. Chances are that this circuit
will also work with that new version.

  Qty     Name               Type           Tandy ref
   1   Optocoupler         4N25             276-9294
   3   Resistors           220 ohm          271-015
   1   Resistor            1 Kohm
   1   AND gate            74LS08           276-9276
   2   DIN plugs           Female 5 pins    274-9110
   1   Canon DB plug       Male 15 pins     Not sold
  [1]  Diode               1N914
   1   Veroboard (*)       5cm by 5cm
   8   Wires               Not shielded
   1   Box to put all that stuff inside
   [] - didn't use it myself.
   (*) It is a piece of
 epoxide with  a raster  of holes spaced at 2.54mm. On one side
 there are  preprinted copper  tracks along  each line of holes
 (in one  direction only).  You cut  off unused portions of the
 tracks and  join the  other  with  straps,  so  as  to  get  a
 primitive form of a printed circuit board. You then insert the
 electronic parts and solder them.

       Sound Blaster MIDI/Game connector REAL cabling
	!  Pin       Signal                        !
	!   1     +5V                              !
	!   2     X button for joystick A          !
	!   3     X potentiometer for joystick A   !
	!   4     Ground                           !
	!   5     Ground                           !
	!   6     Y potentiometer for joystick A   !
	!   7     Y button for joystick A          !
	!   8     +5V                              !
	!   9     +5V                              !
	!  10     X button for joystick B          !
	!  11     X potentiometer for joystick B   !
	!  12     MIDI out                         !
	!  13     Y potentiometer for joystick B   !
	!  14     Y button for joystick B          !
	!  15     MIDI in                          !
The interesting pins are 12, 15, 4 (or 5) and 9 (or 8 or 1).
BTW, if your joystick Y cable assumes that pin 12 is ground (as it
is on a normal game port), it will not work with the SB.
		     Interface cabling
The cabling  is roughly the same as in the MIDI 1.0 Specification,
except that I used a different optocoupler and "AND" gates instead
of inverters (simply because Tandy sold the former with docs :-).
Numbers between  parentheses are  pin numbers. ICs have a standard
pin numbering  scheme. Other  parts have  pin numbers  written  on
them. For  resistors, it's  simply to  make difference between the
two ends.
		  6    5    4
 Usually       !               !         IC seen from the top
 a hole -->    >               !
	       !               !
		  1    2    3
"MIDI-in", "MIDI-out"  design the  female MIDI  plugs. "Game/MIDI"
designs the 15 pin female connector on the SB.
	 FROM PIN                 TO PIN
     MIDI input part
     MIDI-in (4)             Resistor1 220ohm (1)
     Resistor1 220ohm (2)    Optocoupler (1)
     Optocoupler (2)         MIDI-in (5)
     [Optocoupler (1)        Diode -]
     [Optocoupler (2)        Diode +]
     Games/MIDI (9)          Resistor4 1Kohm (1)
     Resistor4 1Kohm (2)     Optocoupler (5)
     Games/MIDI (15)         Optocoupler (5)
     Optocoupler (4)         Game/MIDI (4)
     MIDI output part
     Games/MIDI (12)         AND gate (1)
     AND gate (1)            AND gate (2)
     AND gate (3)            Resistor2 220ohm (1)
     Resistor2 220ohm (2)    MIDI-out (5)
     MIDI-out (4)            Resistor3 220ohm (1)
     Resistor3 220ohm (2)    Game/MIDI (9)
     Games/MIDI (9)          AND gate (14)
     Games/MIDI (4)          AND gate (7)
		       Final remarks
When using  a "veroboard", don't forget to cut tracks under the IC
and the optocoupler, or they will be short-circuited.
You will probably also want to setup two MIDI cords, to attach the
interface to  an instrument.  To stay under $5, you could use male
plugs instead  of female  ones for  the interface  and  plug  them
directly into the instrument.
When preparing the cords, be careful about not swapping the wires.
The pin 4 from one plug must be wired to pin 4 from the other end,
and the  pin 5  must be  attached to pin 5. None of the other pins
must be  wired, nor the overall cable shielded. There is no ground
in MIDI cords.
If you  want more  outputs, you  have to  slightly extend the MIDI
output part.  I would rather have only one AND gate input attached
to the  SB MIDI-out  pin and  only one  MIDI-out plug per AND gate
output. If  Creative Labs  offer  5  MIDI  outs  in  the  original
Connector Box,  it is  probably because  they use simple inverters
(or buffers)  and there  are 6  per IC.  As I  previously said,  I
bought AND  gates only  because they  had  data  sheets  attached,
whereas inverters/buffers had not...
Direct your remarks to, or to
		M. Adam Mirowski
		Chorus systemes
		6, avenue Gustave Eiffel
		F-78182 Saint-Quentin-en-Yvelines CEDEX
     My phone number is +33 (1) 30-64-82-00
I obviously  won't take  any responsibility  for the  damages  you
could do  to your  Sound Blaster  or to  your MIDI equipment while
using this interface.


I) You can use invertors in place of AND gates. The schematic
diagram would be the following (for 2 outputs), instead of
the old "MIDI output part" description.

	!\         !\
SB      ! \ 2      ! \ 4    +--------+    5  MIDI   4   +--------+      SB
MIDI ---!  >o--+---!  >o----! R=220  !----[  out    ]---! R=220  !---- +5V
out    1! /    !  3! /      +--------+      plug 1      +--------+    (pin 9)
 12     !/     !   !/
	       !   !\
	       !   ! \ 6    +--------+    5  MIDI   4   +--------+       SB
	       +---!  >o----! R=220  !----[  out    ]---! R=220  !----- +5V
	       !  5! /      +--------+      plug 2      +--------+    (pin 9)
	       !   !/
	       +--- etc.

Pin 14 of the chip must be connected to +5V, and pin 7 to ground, just
like with the previous one. Also don't forget to remove the strap between
old pins 1 and 2! It is no more necessary and would court- circuit the
first inverter.

The other inverters in the chip are cabled between pins 13 (input) and
12 (output), 11 and 10, 9 and 8 (all the inverters point to the right).

If you try to use CMOS inverters (4... series) instead of TTL ones (74..
and 74LS... series), please remark that CMOS inverters "point" to the

Tandy references are different for 74.., 74LS.. and 74HC.. circuits.

II) If you really want to save money, don't put any AND gate. Connect
together the wires going to pins 1, 2 & 3. Don't short-circuit the power
supply pins; leave them unconnected.

III) For the optocoupler, you could also use a 4N26, a 4N27 or a 4N28.


The following text explains how to build a MIDI interface for the
Sound Blaster. The circuit is my own design, but works just like
the commercialy available interfaces that retails for $60-$90.
Here is the list of parts necessary:
Qty.           Part
 1    Sharp PC900 or HP 6N138 opto-isolator
 1    DB15P (15 pin 'D' connector, male. like joystick connector)
 3    220 ohm resistors (2 for input, 1 for EACH output you need)
 1    3 conductor shielded cable (length is up to you)
 2    Female 5 pin DIN connector (1 for input, 1 for each output you need)
 1    PC board with pre-drilled holes (about 2" x 2" from Radio Shack)
      A few short lengths of hook-up wire
All of these parts, except the first 2, are available from Radio Shack.
Construction techniques are completely up to you, if you want to go
ultra-cheap, you don't even need a PC board or enclosure, and you could
use a MIDI cable you already have by cutting it in the middle. I used
a PC900 out of a non-working organ and cut the end off of a joystick I
didn't need and built the whole thing for about $4.00. Buying all the
parts new, and using an enclosure with built-in MIDI jacks may cost
about $20 or so.
Here is a diagram of the DB15P connector (looking at the solder side).
    1       5     8
    o o o o o o o o
     o o o o o o o
     9     12     15
Here is the 5 pin FEMALE DIN plug (solder side).
   5   o   4 
     o   o
  3  o   o  1
This is the circuit for the MIDI INPUT.
                                     +-----> To pin 5 of 'D' connector
To pin 15 of 'D' connector <---+     |     +-------+-----> To pin 9 of 'D' con
                               |     |     |       |
                               |6    |5    |4      \
                             +---------------+     /  220 ohm
                             |     PC900     |     \  resistor
                             |      or       |     /
                             | o  HP 6N138   |     |
                             +---------------+     +------> To pin 6 of PC900 
                               |1    |2    |3
                               |     |     |
                               \     |     +----->  No connection
                       220 ohm /     |
                      resistor \     |
                               /     +-----> To pin 5 of DIN connector
To pin 4 of DIN connector <----+
Don't overlook the two 220 ohm resistors.
Also, for cables longer than a few feet, connect pin 2 of the DIN to pin
5 of the 'D' connector.
The output circuit is much simpler.
                                  220 ohm resistor
To pin 12 of 'D' connector <---------/\/\/\/\/---------> To pin 5 of DIN 
To pin 15 of 'D' connector <---------------------------> To pin 4 of DIN 
Also, for cables longer than a few feet, connect pin 2 of the DIN to pin
5 of the 'D' connector.
This circuit has been built and tested by me, using Voyetra's SPJr, and
a cheap-o Casio keyboard. The input and output do work as shown here, but I
don't have any other MIDI devices to use to test using more than 1 output
device. Theoretically, it should work fine, but it has not been tested.
The chances of hurting anything by trying is slim and none.
This circuit DOES work, but I make no guarantees, nor will I be
held responsible for any damages you may cause from your use of
this information.
If you have any questions, or would like to buy one already built for you,
I can be contacted on:
The Lighthouse BBS (207) 255-3700   (username is Ronald Davis)
The Music Studio BBS (708) 351-0288 (username is Volstagg)