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
- MIDI keyboard with Bluetooth Low Energy (BLE) support
- 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
Several MIDI keyboards support both USB and BLE-MIDI, so you can do your testing with just one keyboard. Examples are the Akai LPK25 Wireless and the Korg Microkey Air.
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:
- Use a workstation with ADB installed.
- Connect a USB cable from the workstation to the Android device.
- You may need to allow the USB connection on the Android device; see USB peripheral mode
- 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.
- Adjust volume on Android device to about halfway.
- Orient phone in landscape mode.
- Launch MidiKeyboard app.
- Select SynthExample from the spinner menu.
- Play keys. You should hear notes being played in the SynthExample app.
- 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.
- Adjust volume on Android device to about halfway.
- Plug in USB keyboard using the OTG adapter.
- Launch SynthExample app or the MidiScope app.
- From the menu select the USB keyboard. It will display the brand.
- 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.
- Unplug the keyboard. The Sender for Synth menu should display - - - - -.
- Exit the application by pressing the Back button.
Hot-plug USB keyboard
Apps needed: MidiSynthExample or MidiScope
This tests USB MIDI in host mode.
- Adjust volume on Android device to about halfway.
- Make sure there is not a USB MIDI keyboard plugged in.
- Launch SynthExample app.
- At middle, next to Sender for Synth, look in menu. You should not see the USB keyboard listed.
- Plug in USB keyboard using the OTG adapter.
- At middle, next to Sender for Synth, select the USB keyboard. It will display the brand.
- Play notes on the keyboard. You should hear notes being played on the phone.
- At middle, next to Sender for Synth, select - - - - -.
- Play notes on the keyboard. You should hear nothing.
- At middle, next to Sender for Synth, select the USB keyboard. It will display the brand.
- Play notes on the keyboard. You should hear notes being played on the phone.
- Unplug the synthesizer. The Sender for Synth menu should display - - - - -.
- 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.
- Connect the USB cable to the Android device under test (Android device A).
- Use an OTG adapter to connect the other end of the cable to a second Android device B that operates in host mode.
- On Android device A:
- Drag finger down from top of screen.
- Select USB for Charging icon.
- Select MIDI.
- Launch MidiKeyboard app.
- Select Android USB Peripheral Port from Receiver for Keys menu at top.
- On Android device B:
- Launch MidiScope app.
- Select the other Android device as the source.
- On Android device A:
- 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.
- Reboot the Android device.
- 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.) - Launch the MidiBtlePairing app. It has a MIDI+BTLE icon.
- Press the Bluetooth Scan button.
- Select desired BLE peripheral.
- 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.
- Exit the app by pressing the Home button, not the Back button.
- Launch the SynthExample app.
- Select the BLE keyboard as the sender from the menu.
- You should be able to press keys on the BLE keyboard and hear notes on Android.