>You should look at LUFA (http://www.fourwalledcubicle.com/LUFA.php),
>which is a great framework library for writing USB device and host
>firmware for the USB-enabled AVR micros (including the ATMEGA8U2). It
>comes bundled with examples of many of the standard USB device types
>(serial, keyboard, joystick, mouse, mass-storage etc). I've been using
>it in various projects for several years. To load the code into your
>chip you'll need the Atmel FLIP tool (http://www.atmel.com/dyn/
>products/tools_card.asp?tool_id=3886) or similar.
>
>I see two problems:
>
>1) The 8U2 is pretty minimal; it has 8kbytes of flash, 4kbytes of
>which will be used by the USB bootloader, which does not leave much
>space for your stuff.
>2) The 8U2 appears to replace the FTDI chip altogether, so your
>firmware will need to perform that function in addition to whatever
>USB stuff you have in mind, otherwise the link to the Arduino's main
>ATMEGA328 will be broken.
"Your stuff" goes in the ATMega, not the 8U2.
However, the 8U2 also has a DFU bootloader, so it can be reflashed easily over USB - or ISP cable. I'd expect libraries to appear that work with a reflashed 8U2 for supporting keyboard, mouse and midi. The tricky part is getting those libraries to be beginner friendly.
I wrote the bootloader on the Arduino Uno 328 chip (they now use Optiboot), and I assure you there will be much work on this.
Watch this space!
Yes, but that's all it needs to do, and there should be plenty of room for that, and the
communication with the mega328 for the actual functionality required