This program demonstrates how to get MIDI output using a Basic Stamp IIsx.
The circuit connected to the Basic Stamp is shown below. The +5v power source for the circuit below comes from the DIP pin #21. The program uses I/O pin #8 (DIP pin #13) for the MIDI output, but you can change the program to use any output pin for MIDI out. The buffer op-amp does not seem to be necessary.
The primary function used in this program is the serout function. The first parameter to serout is the output pin (0-15,16). The second parameter is the baude mode which is set to the value 2,500,000/31,250 - 20 = 60. Where 31,250 is the data bit rate of the MIDI serial protocol.