I've put together a basic USB MIDI driver for the UNO's atmega8u2. I've tested it using the demo sketch below with GarageBand and it seems to be working well. By flashing this firmware onto your UNO's atmega8u2 you can turn the UNO into a USB MIDI device. See my earlier posts on how to load the firmware via DFU mode.
The MIDI driver expects to receive a serial message with the following format:
||Command: E.g. 0x90 Note On, 0x80 Note Off.
||Channel: 1 to 16
||MIDI data byte 2. Depends on Command, for 0x80 and 0x90 this is the Pitch values 1-127
||MIDI data byte 3. Depends on Command, for 0x80 and 0x90 this is the Velocity values 1-127
The serial port should be configured for 115200 baud.
Here's the firmware files, source, and example sketch to send 5 notes to the host.
More detail on the MIDI messages can be found here at www.midi.org
More detail on the MIDI USB interface standard can be found in the MIDI 1.0 Specification
You can download a copy the USB Serial firmware here: Arduino USB Serial firmware
. You'll need to replace the MIDI firmware with this whenever you want to upload a new sketch. Flash this by putting the board in to DFU mode and using dfu-programmer or flip.