In 2015 Android introduced MIDI support. Android has billions of users which means there's a whole lot of people with MIDI compatible devices in their pocket!
In this article I'll explore the most popular types of MIDI applications on Android and how to choose the right MIDI API when developing your own app.
The two most popular types of MIDI app are:
1) Apps controlled by MIDI. These are apps which primarily receive MIDI data, such as synthesizers, drum machines and DJing apps.
2) MIDI controller apps. These apps are used to control other apps, external hardware or external software (such as a desktop audio workstation).
The virtual analog synthesizer app, DRC can be played using an external MIDI keyboard
These types of apps are designed to control other apps by sending MIDI to them. Examples include:
Super MIDI Box is a MIDI drum machine and step sequencer
A little-known feature of Android is that when connected to a USB host (like a computer) it can become a class compliant USB-MIDI device. This is done in the USB settings.
Once the USB mode is changed to MIDI, it will appear on the host as a MIDI device with one input channel and one output channel. A MIDI controller app can then be used to control software, such as a Digital Audio Workstation (DAW), on the host.
Inside the app the MIDI device will show up as "Android USB Peripheral" with a single input port and a single output port.
DRC app connected to the Android USB Peripheral MIDI device
In order to develop a MIDI application on Android you'll need to use one or both of the available MIDI APIs. Here's a summary of the available APIs and their features:
In Android Marshmallow (API 23) the JVM Midi API was released. It can be accessed using Kotlin or the Java Programming Language. It enables you to enumerate, connect and communicate with MIDI devices over USB, Bluetooth LE and other apps advertising as virtual MIDI services.
You must use this API for enumerating and connecting to MIDI devices, however, for reading and writing you can choose between this API and the Native Midi API described below.
In Android Q the Native MIDI API was released. It's specifically designed for communicating with MIDI devices inside an audio callback which makes it easy to control audio rendering objects, for example a software synthesizer.
This API only handles sending and receiving MIDI data, not MIDI device enumeration or connection. That still needs to be done using the JVM API.
You can start developing a MIDI app using Android Studio. You'll want to check out the following resources:
You should also take a look at the existing MIDI apps on the Google Play Store.
If you are using audio in your app you might want to check out the Oboe library for developing high performance audio apps.
If you have questions about developing MIDI apps on Android feel free to ask them on the android-midi group. Good luck and have fun!