How To:

Getting your O2 to speak MIDI

The O2s are great little machines, with lots of media IO options, MIDI included. While I don't know the history of the MIDI libraries and the tools that were included with IRIX 6.3, they are quite easy to use and there is a quite a large body example source code available (from SGI and others).

After doing some web research, it seems that there are a number of folks out there who have had varying degrees of success with a wide range of hardware options. In essence, all you have to do is translate one form of serial protocol (MIDI), into another (RS-232). Unfortunately, that's easier said than done.

Probably the easiest (and perhaps most expensive) thing to do is to contact the folks at The Play Group and have them set you up with an UNWINDER. This is the only real plug-n-play device that I'm aware of. They have several versions for various models of SGI, and lots of other unique performance oriented hardware as well.

Building your own cable/converter can be cheaper - though there may be some other costs, depending on what you already own... To get things up-and-running on an O2, you need a MIDI converter box, and a cable to connect to your O2 serial port. If you use a Macintosh midi converter box (Opcode's Midi Translator II, for example) You'll need an RS422-232 converter and a custom cable to go from the Mac's Mini8Din connector to the 9pin Dsub connector that you'll be adding to the serial converter. While I've not tried it, this whole process may be greatly simplified if you can get a PC oriented midi converter box that sends RS232 directly.

Here's what I did:
I happened to have an Opcode Midi Translator II for a Mac that I have. I've also got a midiman Macman converter box. The Opcode product is "parasitic" that is, it draws power from the Macintosh serial port. The Macman is self powered (via a little DC adapter). This difference will become important later.
Next, since Macintosh serial ports (since the early Mac Plus) are all RS-422 devices, and the O2 serial port is an RS-232 device, we need a converter. My suggestion is the Antona serial converter model #6090.
Now build a cable - Male DB9 to Male Mini8 Din. If you don't like soldering, I would suggest buying a Mini 8 cable and just hack off one end. Soldering with a DB9 is a bit easier, though you may be able to find kits that make soldering unneccessary. Here's a pinout map for reference:
pin #
Mini-8 Din
Antona RS-422 Master
Dsub 9pin
Antona RS-422 Slave
Dsub 9pin
Antona RS-232 PC end
Dsub 9pin
O2 Serial port
Dsub 9pin
2CTSRc-Tx-Rx Rx
3Tx-Tx+Rc+Tx Tx
6Tx+ - - - -
7 - Rc+Tx+RTSRTS
9 - - - - -

Looking at the male end of a Mini-8 Din connector,
these are the pin numbers:
    /       \
   / 6  7  8 \
  /           \
 (  3   4    5 )     (the extra gap is between 4-5)
  \           /
   \  1   2  /

Looking at the male end of a Dsub 9pin connector,
the pin numbers are:
   \  1  2  3  4  5  /
    \   6  7  8  9  /

The Antona Serial converter has two jumper settings - Master and Slave. I happened to wire my cable such that I needed to put the jumper settings in the SLAVE position - the 6090 manual tells how to do this (it's really easy). The connections I made are as follows:
Mini8	Dsub
1	NC
2	NC
3	8
4	5
5	2
6	3
7	NC
8	7
-	NC
You should be able to swap the transmit and receive lines in this setup such that you can leave the 6090 adapter at its factory setting. I just didn't want to resolder my connectors. Note that the Anotna is female on both ends. Most Macintosh Midi boxes are also female. That means that you'll need to make a male Mini8 --> male Dsub9 cable.

NOTE: RS-422 is a powered protocol - that is, the Antona will draw power from your O2 serial port in order to bring RS-232 up to RS-422 line levels. If you then have a parasitic midi translator, even more power is demanded for the circuitry in the translator. Your best bet is a self powered midi converter box like the Macman.
If you don't have a self powered midi converter, the O2 does not have enough power to send data out to the converter. Most likely your devices have enough power to send signal to the O2, but the reverse is not true. In other words, if you play notes on an external keyboard, the notes will show up in Synthpanel, but when you generate midi events from the SGI, your converter will see nothing, and hence none of your external devices will respond.
Finally, the Macman is very sensitive to the polarity of it's DC input. I fried mine just the other day. I had a multipurpose AC/DC adapter and pluged in the Macman with the polarity switch in the wrong setting. A slight odor from the device tells me that I've committed a terrible error: I've let the secret smoke out of my electronics and I fear I can't get it back in... Mind you, the device still works for input into the O2, but until I can find a way to revive the "self power" mechanism, I won't be able to send data out to keyboards, sensors, and the like.

The Software Side
The only extra thing you need to do on your O2 is let it know that serial port 2 (Serial port one is usually reserved for terminals) is available for MIDI. To do this, type
%startmidi -d/dev/ttyd2
Now connect all your midi devices and start up the software synthesizer on the O2. Make sure that you select "Serial Port 2" from the MIDI menu in the Synthpanel program. Now you should be able to test the connections. There is also a utility program in the /usr/share/src/dmedia/midi directories that will echo to the screen all midi messages passing from one device to another, including the software synth.
© 1998 Georgia Institute of Technology