to top

MIDI Test Procedure

In this document

These tests may be used to validate the MIDI feature on Android devices. Successful execution of these tests is a prerequisite to claim the MIDI feature.

Preparation

Hardware

The following hardware is needed for the tests.

  • MIDI keyboard with USB connector, e.g. the Akai LPK25
  • MIDI keyboard with Bluetooth Low Energy (BLE) support, e.g. the Miselu C.24
  • USB cables
  • USB On-The-Go (OTG) adapter to convert a female USB-A to male micro-USB or USB-C
  • Android device running Android 6.0 Marshmallow or later release
  • Optional: desktop computer

Apps

Several apps are used by this test procedure. The apps are available in source code on GitHub project android-midisuite, and via Google Play™ at links in the following table.

Source code Google Play™ Description
MidiScope or MidiScope MIDI Scope displays MIDI messages on-screen
MidiKeyboard MIDI Keyboard sends MIDI messages by pressing an on-screen music keyboard
MidiSynthExample or
MidiSynth
MIDI Synth Ex simple MIDI synthesizer that uses sawtooth oscillators
MidiBtlePairing MIDI BLE Connect pairs an Android device with a BLE peripheral
MidiTools library dependency of the above apps

If you choose to work from source code rather than install via Google Play™, first build the app using the supplied Android.mk. Then install the app using Android Debug Bridge (ADB). For example, to install the MidiScope app:

  1. Use a workstation with ADB installed.
  2. Connect a USB cable from the workstation to the Android device.
  3. You may need to allow the USB connection on the Android device; see USB peripheral mode
  4. On the workstation, enter:
cd <this-folder>
adb install -r MidiScope.apk

Virtual synth tests

Note that a MIDI input port can have only one connection. So if another app is already using an input port, that port will not be available. If you cannot connect to an input port then try closing other apps.

Hardware needed: Android device under test

Simple connection

Apps needed: MidiKeyboard, MidiSynthExample

This tests device enumeration, virtual devices, port connections, and message sending.

  1. Adjust volume on Android device to about halfway.
  2. Orient phone in landscape mode.
  3. Launch MidiKeyboard app.
  4. Select SynthExample from the spinner menu.
  5. Play keys. You should hear notes being played in the SynthExample app.
  6. Exit the application by pressing the Back button so that the port will be closed.

USB test: host mode

Hardware needed: USB MIDI keyboard, USB cable, OTG adapter

Repeat these tests several times. We have seen the USB stack crash hard on some prototype devices if devices were plugged in and unplugged a few times.

Keyboard already plugged in

Apps needed: MidiSynthExample or MidiScope

This tests USB MIDI in host mode.

  1. Adjust volume on Android device to about halfway.
  2. Plug in USB keyboard using the OTG adapter.
  3. Launch SynthExample app or the MidiScope app.
  4. From the menu select the USB keyboard. It will display the brand.
  5. Play notes on the keyboard. If you ran SynthExample then you should hear notes being played on the phone. If you ran MidiScope then you should see NoteOn and NoteOff messages on-screen.
  6. Unplug the keyboard. The Sender for Synth menu should display - - - - -.
  7. Exit the application by pressing the Back button.

Hot-plug USB keyboard

Apps needed: MidiSynthExample or MidiScope

This tests USB MIDI in host mode.

  1. Adjust volume on Android device to about halfway.
  2. Make sure there is not a USB MIDI keyboard plugged in.
  3. Launch SynthExample app.
  4. At middle, next to Sender for Synth, look in menu. You should not see the USB keyboard listed.
  5. Plug in USB keyboard using the OTG adapter.
  6. At middle, next to Sender for Synth, select the USB keyboard. It will display the brand.
  7. Play notes on the keyboard. You should hear notes being played on the phone.
  8. At middle, next to Sender for Synth, select - - - - -.
  9. Play notes on the keyboard. You should hear nothing.
  10. At middle, next to Sender for Synth, select the USB keyboard. It will display the brand.
  11. Play notes on the keyboard. You should hear notes being played on the phone.
  12. Unplug the synthesizer. The Sender for Synth menu should display - - - - -.
  13. Exit the application by pressing the Back button.

USB test: peripheral mode

Hardware needed: USB cable, OTG adapter

Android-to-Android

Apps needed: MidiKeyboard on Android device under test, MidiScope on another Android device.

Use Android devices as a peripheral controller for another Android device. To help test this mode, use another Android device running in host mode. Note that you could modify the test to work with a desktop computer running Digital Audio Workstation (DAW) software such as GarageBand.

  1. Connect the USB cable to the Android device under test (Android device A).
  2. Use an OTG adapter to connect the other end of the cable to a second Android device B that operates in host mode.
  3. On Android device A:
    1. Drag finger down from top of screen.
    2. Select USB for Charging icon.
    3. Select MIDI.
    4. Launch MidiKeyboard app.
    5. Select Android USB Peripheral Port from Receiver for Keys menu at top.
  4. On Android device B:
    1. Launch MidiScope app.
    2. Select the other Android device as the source.
  5. On Android device A:
    1. Play notes on the keyboard and look for NoteOn and NoteOff on Android device B.

BLE test

Hardware needed: MIDI keyboard supporting BLE

Basic pairing and playing

Apps needed: MidiBtlePairing, MidiSynthExample

Test a keyboard connected to Android over BLE.

  1. Reboot the Android device.
  2. Power on the BLE keyboard.
    (The Miselu C.24 keyboard is powered on by pushing the button near the back so that it pops open. The power button on the C.24 pulses blue when in pairing mode.)
  3. Launch the MidiBtlePairing app. It has a MIDI+BTLE icon.
  4. Press the Bluetooth Scan button.
  5. Select desired BLE peripheral.
  6. The app should return to the main page, and you should see the peripheral listed. If you are using a C.24, then you will notice that the light should turn green on the C.24 to indicate paired mode.
  7. Exit the app by pressing the Home button, not the Back button.
  8. Launch the SynthExample app.
  9. Select the BLE keyboard as the sender from the menu.
  10. You should be able to press keys on the BLE keyboard and hear notes on Android.