MIDI

From Robo-T
Jump to: navigation, search

MIDI (Musical Instrument Digital Interface) is a means for electronic instruments to communicate among themselves. We can use the Arduino to control an electronic instrument like a electric piano, synthesizer or drum machine through MIDI. Likewise, the reverse is also true, an electric keyboad can be used to send commands to Arduino that can be used in any way imagianable (lights, sound, motors, fireworks, lasers,...).

General Information

  • MIDI is a serial protocol.
  • everything is sent in binary. (you can use the "byte" command to send decimal in binary)
  • first byte is a command. the first four bits comprise the command and the next four bit address the MIDI channel
  • Commands begin with a 1 bit. Data begin with 0 bit.
  • You can use not on with 0 velocity to turn the note off instead of note off.
  • There is a midi library to make things easier.
4bit code & Command Data 1 Data 2 (if applicable)
4bit channel
1000 0000 note off note (0-127) velocity (0-127)
1001 0000 note on note velocity
1010 0000 aftertouch note aftertouch
1011 0000 continuous controller controller # controller value
1100 0000 patch change instrument #
1101 0000 channel pressure pressure
1110 0000 pitch bend lsb (7bits) msb(7bits)
1111 0000 non-musical commands

Hardware

MIDI 5 pin din wired different depending on whether it is in,out or through.

  • two pins are not used at all. farthest pin on both sides.
  • use only one ground (out)
  • for receiving need an opt isolator

Resources

Projects