Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Basic MIDI examples, building blocks for bigger projects to support the Marshall's Plans column in the April 2012 issue of Popular Science

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 chordinator
Octocat-spinner-32 control_change
Octocat-spinner-32 play_notes
Octocat-spinner-32 read_notes
Octocat-spinner-32 README
Octocat-spinner-32 further_reading.txt
README
These are some code examples to support the MIDI Basics column in the April 
2012 issue of Popular Science.  They're simple, but they should be enough
to get you going with MIDI and an Arduino.

If you make some well commented examples of your own that you'd like to 
include here, please fork the repository and issue a pull request.  If 
possible, please use the same circuit or one based upon the demo circuit
used here so that these examples can all run on the same hardware.

These examples are written assuming you are using the Sparkfun MIDI Shield
or an equivalent circuit with the same pin connections (e.g. momentary
pushbutton connected to digital pin 2).  Build that shield with stackable
Arduino headers and connect a Serial LCD to +5V, GND, and D5 on the shield.

Shield - http://www.sparkfun.com/products/9595
Headers - http://www.sparkfun.com/products/10007
Serial LCD - http://www.sparkfun.com/products/9395

If you are building your own circuit, you can build a MIDI interface 
circuit based on this schematic:

http://www.midi.org/techspecs/electrispec.php

If you are building the MIDI IN side with a 6N138 Optoisolator instead
of the PC-900, replace the MIDI IN part of the above with this:

https://github.com/vinmarshall/Radio-Shack-MIDI-Lights/blob/master/schematic/1_MIDI.bmp

The Sparkfun MIDI Breakout Board is also good for prototyping:
http://www.sparkfun.com/products/9598

NOTE: Remember to set the Midi (Run) / Program switch to "Program" before trying
to upload a program to the Arduino.  


The Examples: 

Chordinator:

 * This code will read Note On and Note Off messages on Channel 1
 * arriving at the MIDI IN port and play a Chord built on each of 
 * those notes to the MIDI OUT port.  Connect the MIDI OUT of your
 * keyboard to the MIDI IN of the Arduino and the MIDI OUT of the
 * Arduino to the MIDI IN of the keyboard.  


Control Change:

 * This code will send Control Change (or PitchBend, or 
 * Aftertouch, etc...) messages based on the position of the 
 * potentiometer every time it's position changes.  This is just 
 * a simple demo designed to get you up and running with MIDI. 


Play Notes:

 * This code will send Note On and Note Off messages on Channel 1
 * based on the position of the potentiometer when the button is
 * pressed.  This is just a simple demo designed to get you up and 
 * running with MIDI.


Read Notes:

 * This code will read Note On and Note Off messages on Channel 1
 * arriving at the MIDI IN port.  This is just a simple demo designed 
 * to get you up and running with MIDI.


Controlling Relays with MIDI:

 Look at my "MIDI Lights" project for an example of using MIDI notes to
 control a series of relays:
 https://github.com/vinmarshall/Radio-Shack-MIDI-Lights
Something went wrong with that request. Please try again.