• 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 , circuit for using 6n138 opto coupler and arduino midi keyboard , auriduino midi keyboard , arduino midi read input data , Arduino MIDI piano code , arduino midi piano , arduino interactive piano
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, 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

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • Best Piano Apps for Android

    Best Piano Apps for Android lists the Apps those can be controlled via touchscreen and simulate a keyboard instrument like the piano.

  • How to Control Multiple Relays With Single Arduino ESP32?

    Before How to Control Multiple Relays With Single Arduino ESP32 Testing, You Need to Learn How to Create Multiple MQTT Channels & Fetch Data.

  • Control Multiple AC Appliances With One ESP32 Arduino

    Here is how to use ESP32 and IBM Watson IoT to control multiple relays (i.e. multiple AC appliances) by pushbutton and over the internet.

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

Get new posts by email:

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 (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

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

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