Hi Johnny.
It may be possible to do what you want.
You need to understand that MIDI and RS-232 are not exactly the same, electrically, but can be made compatible.
RS-232 uses a common ground and signals are bipolar (positive and negative) with respect to this common ground rail.
MIDI uses current loops for data in both directions. Two pins on the connector are used for data in each direction. With MIDI, idle line is zero current, and active ("0" data state) is current present.
With RS-232, idle line is negative voltage, and active is positive voltage present.
So to convert an RS-232 output (on pin 3 of a D9 connector) to MIDI, you need a diode (to block the negative voltage) and probably a current limiting resistor.
To convert a MIDI signal to be compatible with an RS-232 input (on pin 2 of a D9 connector), you may need a resistor to pull the signal to a negative state (when no current is being supplied by the MIDI device), and probably a diode to feed the positive voltage from the MIDI device to the RS-232 input when the MIDI device is transmitting data "0".
Do you have pinout information for the MIDI interface on the device you want to connect to?
Do you need to RECEIVE MIDI information from the device, or is transmission from the D9 port to the MIDI device all you need?
If you can give me this information, we might be able to work out how to wire a cable to allow a D9 port to transmit data to, and possibly receive data from, a MIDI device.
The final problem is the data rate. MIDI uses a data rate of 31.25 kilobits per second, i.e. each data bit is 32 microseconds wide. This data rate is not achievable with a standard serial port (e.g. an RS-232 port on a PC).
This is why it's normal to use a converter between a PC serial port and a MIDI device. The converter handles the electrical differences between RS-232 and MIDI, but also handles the data rate difference.
I hope this has been of some help. Please reply with more details and I may be able to help further.