MIDI Basic Concepts

What Is MIDI?
Musical Instrument Digital Interface (MIDI)
 * MIDI is how Musical devices can connect to and communicate with each other
 * Audio is not passed through MIDI cables, only commands and command data
 * Note on, Note off, set volume, select voice, etc.
 * USB MIDI is a superset that can include actual audio (such as a singers voice)

TYPES OF MIDI CONNECTIONS TO KEYBOARDS
If you see ports on the back of your music keyboard that look similar to this labelled MIDI IN and MIDI OUT (and possibly MIDI THRU) then you have the 5 PIN DIN MIDI ports. These are the older style, “True MIDI” connectors. This means you need a MIDI port adapter for your computer, such as a “ROLAND UM-ONE” (USB to MIDI adapter cable) or an adapter card (if you have an older computer without USB ports). The driver for these will be specific to the adapter and not your keyboard. Some of the USB-to-MIDI cables are class-compliant and do not require a driver – check with your cable manufacturer. If you see a port on the back of your keyboard that looks similar to this (USB B) labelled TO HOST then you have a USB port on your keyboard. This port will carry standard MIDI messages and potentially digital audio (depending on the keyboard). This port might be “Class Compliant” and not require drivers at all, or it will be proprietary (common on all but the most recent Yamaha keyboards, for instance) and requires a driver from the manufacturer. Check with the manufacturer of your keyboard.

You might find both types on your keyboard. The USB connection will probably be the preferred connection depending on your application. It will be faster and might be capable of sending and receiving digital audio.

This is an example of a USB to MIDI Adapter Cable. Many brands are available, this is just one of them. The Roland UM-ONE pictured here has been used successfully with the Playground Sessions app. There are many other brands that do as well. It might be useful to spend a little more to ensure good quality, but you don't have to buy the absolute best to get a decent adapter. This is a USB “To Host” (USB A to USB B) cable. They might also be sold as USB Printer cables. The most common size is probably a one meter (three foot) cable. This will probably work for most setups, but you should measure from your digital piano to your computer, and using the route the cable will run to be sure you don't need a longer cable. They also come in two meter (six foot) sizes, which is generally the longest recommended length - any longer and you might have troubles. These are standard MIDI cables. At least the old kind from the first specification of MIDI.They may come in many colors. You will likely want to use two different colors, one for IN to the keyboard instrument, and a different color for OUT from the keyboard instrument. The cables themselves are bi-directional, but the ports they plug into are one way. As with any cable, buying upscale a little will likely get you better construction and components than the absolute cheapest. Finally, a really old style from 1990s computer sound card joystick / MIDI ports to five-pin connectors. Roughly the equivalent of the USB to MIDI Adapter Cable, they provided a connection between a PC and the MIDI keyboard.

MIDI Connection Types

 * The Roland UM-ONE and similar USB-to-MIDI adapters connect a computer with USB ports to music keyboards with MIDI ports
 * The USB “To Host” cable connects computers with USB ports to music keyboards with the USB “To Host” port
 * There are also computers, old machines like the Atari 520ST or Atari 1040ST which had MIDI ports built-in, and other personal computers that had MIDI adapters or sound cards with MIDI through the joystick port
 * The cables for these were MIDI to MIDI cables
 * There is no way to connect a modern music keyboard with only a USB “To Host” port to an old computer that only has the MIDI ports - to do so you need to add another Host device of some sort between
 * You don’t really need the circuit diagrams to understand how to use five-pin MIDI Cables
 * Just know that the basic cables connect to MIDI ports that are optically isolated on their MIDI IN port
 * This helps prevent ground looping and other data destroying conditions
 * Only one direction of signal flows in each port so that you need separate cables for MIDI Input and MIDI Output
 * The Official MIDI specification includes circuit diagrams and detailed specifications if you are interested in those things
 * That’s beyond the scope of this basic tutorial
 * You’ll find all that at [//www.midi.org/ https://www.midi.org/]

Modern Keyboard and PC
This image represents a modern keyboard and a modern computer. Click on the image and choose to view the full size for the readable version. The black line represents a USB only cable and the red lines represent a USB to MIDI adapter cable

Old Style Keyboard to Old Style Computer
This image depicts an old five-pin MIDI only keyboard and an ancient sound card MIDI. The even older original PC MIDI Card, the Roland MPU-401 would not have the joystick ports and did not actually have audio capabilities! Again, click for full resolution image.

Why You Might Need Drivers

 * Older keyboards with USB Ports were created before the “Class Compliant” standard was
 * Older USB to MIDI cables were created before the “Class Compliant” standard was
 * The operating system of the computer, phone, or tablet is older than and does not include the “Class Compliant” standard
 * Your keyboard manufacturer should have a table which lists the operating systems that do need a driver and notes which versions include the drivers already
 * Check with the manufacturer of your MIDI Keyboard or USB to MIDI adapter cable to see if a specific driver is required
 * Some older devices might be supported by updates to the operating system “Class Compliant” MIDI system

Direction Matters

 * The original MIDI Ports are one way directional
 * You must connect the output of one device to the input of the other
 * The actual cables are not directional and either end of the cable will work in either direction of the port
 * USB Cables are keyed to fit only one way
 * Each of these ports is bi-directional, carrying both In and Out information

Old Style MIDI Ports In-to-Out and Out-to-In
You can connect two music keyboards using the old-style MIDI but not via USB MIDI. USB is always computer device to peripheral device (like the music keyboards). Phones and tablets use a special On-The-Go (OTG) cable to connect to peripherals.

Final Thoughts

 * USB is not peer-to-peer
 * One end is the HOST and one is the DEVICE
 * The computer will be the host and the music keyboard the device
 * USB generally is not used to connect computer to computer
 * (This might change as the USB standard evolves)
 * MIDI can be peer to peer
 * Two keyboards can connect to each other via MIDI cables
 * You do not have to connect the IN and OUT MIDI ports to the same far-end device
 * MIDI can be used for non-musical purposes
 * Controlling lighting is one such purpose