There are three (well, four, but one is not suitable) ways of doing midi from an arduino.
One method uses the hardware serial ports available on the atmega chips (1 on the uno/etc, 4 on the mega) to send midi messages directly to whatever midi device you want. (usb->midi, midi thru box, midi keyboard, you name it… it’s freakin midi!
)
Another method would be to use a standalone usb->midi device, hack it apart, connect things and install it into your case… BAM! instant usb midi… (note that you will still use the previous method to send the midi–direct thru the hardware serial port, it’s just directly connected to the midi->usb converter).
The third method can only be used on the newest arduino boards, uno’s for sure, not 100% sure about the mega’s (the ones that use a dedicated atmega8 chip as the usb->serial converter instead of the regular FTDI chip). Since they use a dedicated microcontroller, you are able to reprogram it for your own purposes. Someone has already made a port of LUFA that will work on these new arduino’s.. I don’t have a link right now, but a quick google ‘arduino uno lufa’ should bring it up.
The fourth (and not suitable) method is what you’re using right now, which is a client running on your computer to translate the serial messages into midi messages. This adds SIGNIFICANT latency, to the point of being useful for debugging only, not for performance.
Feel free to ask more questions… I have some work stuff going on at the moment, but when I get a chance I can post working midi-in and midi-out schematics.
Midi-out is nothing but a pullup resistor and the correct wiring.
Midi-in is a little more complicated, as you need an optoisolator to convert the rs232 midi signal to a TTL signal for the arduino.
It CAN be done
My current setup consists of three homebrew midi controllers (one of them is still on a breadboard) all with midi-in and out, with the code performing midi-thru functions to daisy chain them. They’re all connected to a single m-audio uno midi->usb converter. They work flawlessly… ZERO latency… One of them has a bunch of leds responding to midi-in FROM traktor, one set (of eleven) is the crossfader position, and I have two more that flash in time with the beats (one per deck).
I will be posting something regarding that one, since it is the more complex of the two (I hacked the MF source into my controller so I could emulate the MF’s 4 banks mode. Allowing me to use the instant gratification mapping. In addition to providing me a complete dual deck transport section.