MIDI BLE Tutorial

Pages
Contributors: MTaylor
Favorited Favorite 8

Introduction

When new technologies are introduced, old technology is often warped into compliance of the new standards. MIDI is no exception and is surprisingly easy to work with over a Bluetooth Low Energy link.

MIDI BLE Adapter with Smartphone

A cellphone can control an instrument as if by magic.

This tutorial uses an nRF52832 Breakout board as the BLE radio and the MIDI parsing processor. For the sake of learning, the breakout is connected to a standard MIDI shield. Serial MIDI to BLE is already available as a consumer product, but it's a good platform to talk about the various pieces of the problem.

This covers:

  • Basic BLE Configuration for MIDI.
  • Decoding MIDI BLE packets and doing something with them.
  • Encoding MIDI BLE packets.
  • Creating a full BLE to DIN conversion tool.

Parts or all of the code presented here can be used as a starting place to build MIDI BLE devices.

Background Requirements

The following is required to progress through this tutorial.

  1. An understanding of the original MIDI specification. It is available in full at www.midi.org (Use midi a lot? Join and become a member for free!). The SparkFun MIDI Tutorial breaks down the specification in depth. If only a brief refresher is needed, midi.org's Summary of MIDI Messages is the specific page used to implement the MIDI protocol.

  2. A computer or mobile device that can interface with MIDI BLE devices.

  3. An nRF52832 Breakout and FTDI Basic Breakout - 3.3V

  4. Code examples in this tutorial are maintained in the GitHub repo MIDI-BLE-Adapter. Clone it.

  5. An installation of Arduino and board package for the nRF52832. Follow the nRF52832 Breakout Board Hookup Guide to install the board files, and BLEPeriphrial library.

Isolating Windows Installations To create a stand-alone Arduino installation in windows that doesn't tie into any other installations,
  • Download the Arduino program as a zip and unzip to a new location
  • Make a new folder called 'portable' in the extracted location before you start Arduino for the first time. Upon seeing 'portable' Arduino knows to use this for packages.
  • Create a folder called 'localSB' (name and location doesn't matter)
  • Run Arduino and set your local sketchbook to your created folder, and Arduino will populate libraries into it.

MIDI BLE Supported Devices.

MIDI BLE has only been around for a couple years, so support is spotty. Take some time to Google your device plus "BLE MIDI" and see what comes up. Here's some general information. Have success? Please post device and OS info in the comments.

Mac

Go into your "System Report" through Utilities->System Information. MIDI BLE is available with "LMP Version" 0x06 or higher. More information available on checking your Mac in this imore.com article.

  • Use Audio MIDI Settings to search for devices.
  • Try Pocket MIDI to test communications.

iPhone

Generally, iOS 8 should have support for BLE MIDI but this is not tested.

Windows

Windows 10 machines that are fully updated should have MIDI BLE support.

The program MIDIBerry is pretty basic but can be used to connect BLE devices to other Windows programs.

Android

Android 6.0 marshmallow or later should have software support. Try the app MIDI BLE Connect and see if you can scan for devices.

Recommended Materials and Tools

Development Hardware

While just the nRF52832 Breakout and an FTDI are required to run the code, it's recommended to attach a MIDI shield. The next section details how to hook the two together.

MIDI Peripherals

Have a pile of midi devices available. When working with so many unknowns, it's nice to have something that is familiar and can be relied on to help narrow down where a problem is occurring.

Here are some options:

  • A wired MIDI receiver that can display MIDI packets as they go by. This can be an Arduino UNO with another MIDI shield that is running the MIDI analysis software, or a computer with physical MIDI port with software.
  • A wired MIDI transmitter. Usually a keyboard.
  • A BLE MIDI receiver. On Mac the program "Pocket MIDI" works extremely well. For windows, MIDIBerry is OK.
  • A BLE MIDI transmitter. Again, software on a computer will do the job.