MIDI Comms

MIDI Library

Install the library from here.

This library documentation seems somewhat overwhelming and difficult to carry out simple tasks such as specifying a different UART TX port when we looked.  If you only need to send simple Note On and Note Off commands then you can just use the UART instead if preferred.

MIDI Using Basic UART Functions


 #define  MIDI_OUT_CHANNEL    0x0        //0x0 to 0xF
 
  //----- SETUP MIDI PORT -----
  Serial.begin(31250, SERIAL_8N1);
 
 
 
  //MIDI Note On
  Serial1.write(0x90 + MIDI_OUT_CHANNEL);
  Serial1.write(43);                     //Note Number (0 - 127)
  Serial1.write(64);                     //Velocity  (64 is default for no velocity info available)
  
  delay(50);
  
  //MIDI Note Off
  Serial1.write(0x80 + MIDI_OUT_CHANNEL);
  Serial1.write(43);                     //Note Number (0 - 127)              
  Serial1.write(0);                      //Velocity  (64 is default for no velocity info available)
  
  delay(500);
  
  //MIDI All Notes Off (Can be handy during development and as a general power up command to send)
  Serial1.write(0xB0 + MIDI_OUT_CHANNEL);
  Serial1.write(0x7B);
  Serial1.write(0x00);

 

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *