Hacking.MidiWith8U2Firmware History

Hide minor edits - Show changes to output

June 20, 2012, at 05:11 PM by Scott Fitzgerald -
Changed line 17 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/4.Communication/MIDI/Midi.ino lang=arduino tabwidth=4:)
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/04.Communication/MIDI/Midi.ino lang=arduino tabwidth=4:)
January 16, 2012, at 03:21 PM by David Cuartielles -
Changed line 17 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/4.Communication/MIDI/Midi.pde lang=arduino tabwidth=4:)
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/4.Communication/MIDI/Midi.ino lang=arduino tabwidth=4:)
February 15, 2011, at 03:11 PM by David Cuartielles -
Added lines 1-36:
!!!MIDI Note Player using the MIDI firmware for the 8U2 (Uno and Mega2560 only)

This tutorial shows how to play MIDI notes from an Arduino programmed to appear as a general MIDI device. This tutorial is only applicable to Arduinos with the 8U2 chip, the UNO and Mega2560 boards. This will not work with earlier models that use the FTDI chip (Duemilanove and previous).

Following the instructions on the [[Hacking/DFUProgramming8U2|Programming 8U2]] instructions using the [[http://web.mac.com/kuwatay/morecat_lab./MocoLUFA.html|MocoLUFA]] firmware, your Arduino will appear to the computer as a native MIDI device without any additional hardware.

You can read the Wikipedia [[http://en.wikipedia.org/wiki/MIDI|MIDI]] entry for complete information on the specification, but in a nutshell, MIDI is a useful protocol for controlling synthesizers, sequencers, and other musical devices. MIDI devices are generally grouped in two broad classes: controllers (i.e. devices that generate MIDI signals based on human actions) and synthesizers (including samplers, sequencers, and so forth).

For more information, see this [[http://www.tigoe.net/pcomp/code/communication/midi | introduction to MIDI]] or this [[http://itp.nyu.edu/physcomp/Labs/MIDIOutput |example]].

The Serial.print() function will send a MIDI command to the software synthesizer of your choice (in this example we will use Cycling74's Max/MSP, but any application that accepts MIDI will do).

Before programming the 8U2 firmware, you will need to program the Atmega 328 on your Arduino, the same way you usually do with the IDE. We will be using the MIDI communication example that comes with the Arduino software. It can be found in File>Examples>Communication>MIDI.

(:div class=code :)
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/4.Communication/MIDI/Midi.pde lang=arduino tabwidth=4:)

Program your Arduino, and prepare to program the 8U2 chip. Follow the instructions on the [[Hacking/DFUProgramming8U2|Programming 8U2]] page, replacing the Arduino firmware with the [[http://web.mac.com/kuwatay/morecat_lab./MocoLUFA.html|MocoLUFA]] firmware.

After the 8U2 has been updated with the MIDI firmware, disconnect and reconnect the USB cable.

Open your MIDI application of choice and look for connected devices. You should see the Arduino appear as an input and output device named "MIDI/MOCO for LUFA".


A simple Max patch that will allow you to hear the notes generated by the MIDI commands looks like this :


To change the program on the Arduino, you must first reset the firmware on the 8U2 to the Arduino's default.

'''See Also:'''

* [[Tutorial/Midi | MIDI]]