• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » Arduino MIDI Input & Virtual MIDI Piano Keyboard

By Abhishek Ghosh December 5, 2018 10:23 pm Updated on December 5, 2018

Arduino MIDI Input & Virtual MIDI Piano Keyboard

Advertisement

We can use Arduino for processing MIDI input and use Virtual MIDI Piano Keyboard freeware on PC for testing purpose. MIDI controller is hardware or software which generates and transmits Musical Instrument Digital Interface (MIDI) data to electronic or digital MIDI-enabled device. We can directly connect the MIDI jack with Arduino with minimally complex wiring or use IC. We can program, create circuit to blink the LED connected to Pin 13 on the Arduino Board upon press of a note on a Midi Keyboard to confirm that we are receiving MIdI commands with Arduino.

MIDI is a micro-to-micro digital communication bus. MIDI ues a circular 5-pin DIN connector which could not be misconnected. While the connectors have five pins, only three of them are used. Two MIDI cables are connected in the following manner :

Pin 1 — > no Connection — > Pin 1
Pin 2 — > shield — > Pin 2
Pin 3 — > no Connection — > Pin 3
Pin 4 — > Voltage Reference Line — > Pin 4
Pin 5 — > Data Line — > Pin 5

Advertisement

---

The MIDI specification recommendeds a circuit for the ports and calls for an opto-isolator. The reference design specifies obsolete Sharp PC-900 which currently substitued with the 6N138 IC (reference design is of TOSHIBA).

The PC-900 or the 6N138 IC are called optocoupler or optical isolator. An opto-isolator (also known as optocoupler, photocoupler, or optical isolator) is an electronic component which transfers electrical signals between two isolated circuits by using light. This prevents high voltages affecting the system receiving the signal. We have seen such optical isolators to be used on 4 channel relay.

For easiest connection, we need an 220 Ohm resistor, one MIDI jack, jumper wires, breadboard and one USB MIDI adapter. We need some headers to solder with the MIDI jack’s pins. MIDI jacks are easy for wiring – middle one ground, left hand side data pin (digital pin of Arduino, like pin 1 – RX), right hand side +5V with a 220 Ohm resistor in-between.

Now, we can download this Virtual MIDI Piano Keyboard software and install :

Vim
1
http://vmpk.sourceforge.net/

We need to go to the Edit menu, choose MIDI Connections and tick mark :

Enable MIDI input
Enable MIDI thru on MIDI output

options. Also change the base octave setting in the main window to 2.

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void setup() {
  Serial.begin(31250);
}
 
void loop() {
  for (int note = 0x18; note < 0x53; note ++) {
    noteOn(0x90, note, 0x45);
    delay(300);
    noteOn(0x90, note, 0x00);  
    delay(100);
  }
}
 
void noteOn(int cmd, int pitch, int velocity) {
  Serial.write(cmd);
  Serial.write(pitch);
  Serial.write(velocity);
}

Reference of the above can be found on Arduino’s official documentation :

Vim
1
https://www.arduino.cc/en/Tutorial/Midi

There are MIDI Note Tables with corrosponding hex values.

Now, if we want to follow the MIDI standard’s circuit then we need to use the 6N138 optocoupler, 1N914 diode. We can install this library :

Vim
1
https://github.com/FortySevenEffects/arduino_midi_library

And this circuit :

Arduino MIDI Input Virtual MIDI Piano

The above circuit and below code is from notesandvolts.com :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <MIDI.h>
#define LED 13  
 
void MyHandleNoteOn(byte channel, byte pitch, byte velocity) {
  digitalWrite(LED,HIGH);  
  if (velocity == 0) {
    digitalWrite(LED,LOW);
  }
}
 
void setup() {
  pinMode (LED, OUTPUT);
  MIDI.begin(MIDI_CHANNEL_OMNI);
  MIDI.setHandleNoteOn(MyHandleNoteOn);
}
 
void loop() {
  MIDI.read();
}

Tagged With virtual midi input , virtual midi cable windows vst arduino , what are midi input/ output on digital piano , arduino midi keyboard , electronic midi keyboard circuit , circuit for using 6n138 opto coupler and arduino midi keyboard , auriduino midi keyboard , arduino midi read input data , arduino midi piano , arduino interactive piano

This Article Has Been Shared 835 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Orthopaedic Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Arduino MIDI Input & Virtual MIDI Piano Keyboard

  • Connecting Arduino With M029 JoyStick : Getting Started

    Here is a Getting Started Guide Around Connecting Arduino With M029 JoyStick and Testing With Basic Code. It is a useful thing for robotics.

  • Arduino Temperature & Humidity Sensor DHT 11 With LCD 1602A

    Create a Arduino Temperature & Humidity Sensor DHT 11 With LCD 1602A Following Few Steps. Circuit Diagram, Code and Helpful Step by Step Guide For Troubleshooting.

  • Create an Arduino LDR Module With Transistor

    We Can Create an Arduino LDR Module With Transistor in Easy Way to Print Response as Either Zero or One.

  • Arduino 14 Segment LED Display : Driver IC & Library

    Here is Information About Arduino 14 Segment LED Display Driver IC & Library. As it is less used component for higher price, possibly you have build module yourself.

  • Arduino e-Paper/e-Ink Buying Guide

    Here is Arduino e-Paper/e-Ink Buying Guide. e-Paper Still Costly, Offers Slower Refresh Rate, Yet it is Great For Some Project Where Paper Look Adds Beauty.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

You can subscribe to our Free Once a Day, Regular Newsletter by clicking the subscribe button below.

Click To Subscribe

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (20K Followers)
  • Twitter (4.9k Followers)
  • Facebook (5.8k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.2k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is Domain-Driven Design (DDD)? January 23, 2021
  • Top 10 Anti Hacking Software for Microsoft Windows January 22, 2021
  • What is Software Modernization? January 21, 2021
  • Cloud Computing : Cybersecurity Tips for Small Business Owners January 20, 2021
  • Arduino : Independently Blink Multiple LED January 18, 2021

 

About This Article

Cite this article as: Abhishek Ghosh, "Arduino MIDI Input & Virtual MIDI Piano Keyboard," in The Customize Windows, December 5, 2018, January 24, 2021, https://thecustomizewindows.com/2018/12/arduino-midi-input-virtual-midi-piano/.

Source:The Customize Windows, JiMA.in

 

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Cookie Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2021 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy