1 page.title=MIDI Test Procedure 2 @jd:body 3 4 <!-- 5 Copyright 2015 The Android Open Source Project 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 --> 19 20 <div id="qv-wrapper"> 21 <div id="qv"> 22 <h2>In this document</h2> 23 <ol id="auto-toc"> 24 </ol> 25 </div> 26 </div> 27 28 <p>These tests may be used to validate the MIDI feature on Android devices. 29 Successful execution of these tests is a prerequisite to 30 <a href="midi.html#claim-feature">claim the MIDI feature</a>. 31 </p> 32 33 <h2 id="preparation">Preparation</h2> 34 35 36 <h3 id="hardware">Hardware</h3> 37 38 <p> 39 The following hardware is needed for the tests. 40 </p> 41 42 <ul> 43 <li> MIDI keyboard with USB connector, e.g. the <a href="http://www.akaipro.com/product/lpk25">Akai LPK25</a></li> 44 <li> MIDI keyboard with Bluetooth Low Energy (BLE) support, e.g. the <a href="http://miselu.com/">Miselu C.24</a></li> 45 <li> USB cables</li> 46 <li> USB On-The-Go (OTG) adapter to convert a female USB-A to male micro-USB or USB-C</li> 47 <li> Android device running Android 6.0 Marshmallow or later release</li> 48 <li> Optional: desktop computer</li> 49 </ul> 50 51 <h3 id="apps">Apps</h3> 52 53 <p> 54 Several apps are used by this test procedure. 55 The apps are available in source code on GitHub project 56 <a href="https://github.com/philburk/android-midisuite">android-midisuite</a>, 57 and via <em>Google Play</em>™ at links in the following table. 58 </p> 59 60 <table> 61 <tr> 62 <th>Source code</th> 63 <th>Google Play™</th> 64 <th>Description</th> 65 </tr> 66 <tr> 67 <td><a href="https://github.com/philburk/android-midisuite/tree/master/MidiScope">MidiScope</a> or 68 <a href="https://github.com/googlesamples/android-MidiScope">MidiScope</a></td> 69 <td><a href="https://play.google.com/store/apps/details?id=com.mobileer.example.midiscope">MIDI Scope</a></td> 70 <td>displays MIDI messages on-screen</td> 71 </tr> 72 <tr> 73 <td><a href="https://github.com/philburk/android-midisuite/tree/master/MidiKeyboard">MidiKeyboard</a></td> 74 <td><a href="https://play.google.com/store/apps/details?id=com.mobileer.midikeyboard">MIDI Keyboard</a></td> 75 <td>sends MIDI messages by pressing an on-screen music keyboard</td> 76 </tr> 77 <tr> 78 <td><a href="https://github.com/philburk/android-midisuite/tree/master/MidiSynthExample">MidiSynthExample</a> or 79 <br /><a href="https://github.com/googlesamples/android-MidiSynth">MidiSynth</a></td> 80 <td><a href="https://play.google.com/store/apps/details?id=com.mobileer.midisynthexample">MIDI Synth Ex</a></td> 81 <td>simple MIDI synthesizer that uses sawtooth oscillators</td> 82 </tr> 83 <tr> 84 <td><a href="https://github.com/philburk/android-midisuite/tree/master/MidiBtlePairing">MidiBtlePairing</a></td> 85 <td><a href="https://play.google.com/store/apps/details?id=com.mobileer.example.midibtlepairing">MIDI BLE Connect</a></td> 86 <td>pairs an Android device with a BLE peripheral</td> 87 </tr> 88 <tr> 89 <td><a href="https://github.com/philburk/android-midisuite/tree/master/MidiTools">MidiTools</a></td> 90 <td></td> 91 <td>library dependency of the above apps</td> 92 </tr> 93 </table> 94 95 <p> 96 If you choose to work from source code rather than install via <em>Google Play</em>™, 97 first build the app using the supplied <em>Android.mk</em>. 98 Then install the app using 99 <a href="http://developer.android.com/tools/help/adb.html">Android Debug Bridge</a> (ADB). 100 For example, to install the <em>MidiScope</em> app:</p> 101 102 <ol> 103 <li> Use a workstation with ADB installed.</li> 104 <li> Connect a USB cable from the workstation to the Android device.</li> 105 <li> You may need to allow the USB connection on the Android device; see <a href="midi.html#usb-peripheral">USB peripheral mode</a></li> 106 <li> On the workstation, enter:</li> 107 </ol> 108 109 <pre> 110 cd <em><this-folder></em> 111 adb install -r MidiScope.apk 112 </pre> 113 114 115 <h2 id="virtual_synth_tests">Virtual synth tests</h2> 116 117 118 <p>Note that a MIDI input port can have only one connection. So if another app is 119 already using an input port, that port will not be available. If you cannot connect to 120 an input port then try closing other apps.</p> 121 122 <p>Hardware needed: Android device under test</p> 123 124 <h3 id="simple_connection">Simple connection</h3> 125 126 127 <p>Apps needed: <em>MidiKeyboard</em>, <em>MidiSynthExample</em></p> 128 129 <p>This tests device enumeration, virtual devices, port connections, and message 130 sending.</p> 131 132 <ol> 133 <li> Adjust volume on Android device to about halfway.</li> 134 <li> Orient phone in landscape mode.</li> 135 <li> Launch <em>MidiKeyboard</em> app.</li> 136 <li> Select <strong>SynthExample</strong> from the spinner menu.</li> 137 <li> Play keys. You should hear notes being played in the <em>SynthExample</em> app.</li> 138 <li> Exit the application by pressing the <strong>Back</strong> button so that the port will be 139 closed.</li> 140 </ol> 141 142 <h2 id="host_mode">USB test: host mode</h2> 143 144 145 <p>Hardware needed: USB MIDI keyboard, USB cable, OTG adapter</p> 146 147 <p>Repeat these tests several times. We have seen the USB stack crash hard on some 148 prototype devices if devices were plugged in and unplugged a few times.</p> 149 150 <h3 id="keyboard_already_plugged_in">Keyboard already plugged in</h3> 151 152 153 <p>Apps needed: <em>MidiSynthExample</em> or <em>MidiScope</em></p> 154 155 <p>This tests USB MIDI in host mode.</p> 156 157 <ol> 158 <li> Adjust volume on Android device to about halfway.</li> 159 <li> Plug in USB keyboard using the OTG adapter.</li> 160 <li> Launch <em>SynthExample</em> app or the <em>MidiScope</em> app.</li> 161 <li> From the menu select the USB keyboard. It will display the brand.</li> 162 <li> Play notes on the keyboard. If you ran <em>SynthExample</em> then you should hear notes 163 being played on the phone. If you ran <em>MidiScope</em> then you should see <em>NoteOn</em> and 164 <em>NoteOff</em> messages on-screen.</li> 165 <li> Unplug the keyboard. The <em>Sender for Synth</em> menu should display <em>- - - - -</em>.</li> 166 <li> Exit the application by pressing the <strong>Back</strong> button.</li> 167 </ol> 168 169 <h3 id="hot_plug_usb_keyboard">Hot-plug USB keyboard</h3> 170 171 172 <p>Apps needed: <em>MidiSynthExample</em> or <em>MidiScope</em></p> 173 174 <p>This tests USB MIDI in host mode.</p> 175 176 <ol> 177 <li> Adjust volume on Android device to about halfway.</li> 178 <li> Make sure there is not a USB MIDI keyboard plugged in.</li> 179 <li> Launch <em>SynthExample</em> app.</li> 180 <li> At middle, next to <em>Sender for Synth</em>, look in menu. You should not see the USB 181 keyboard listed.</li> 182 <li> Plug in USB keyboard using the OTG adapter.</li> 183 <li> At middle, next to <em>Sender for Synth</em>, select the USB keyboard. It will display 184 the brand.</li> 185 <li> Play notes on the keyboard. You should hear notes being played on the phone.</li> 186 <li> At middle, next to <em>Sender for Synth</em>, select <strong>- - - - -</strong>.</li> 187 <li> Play notes on the keyboard. You should hear nothing.</li> 188 <li> At middle, next to <em>Sender for Synth</em>, select the USB keyboard. It will display 189 the brand.</li> 190 <li> Play notes on the keyboard. You should hear notes being played on the phone.</li> 191 <li> Unplug the synthesizer. The <em>Sender for Synth</em> menu should display <em>- - - - -</em>.</li> 192 <li> Exit the application by pressing the <strong>Back</strong> button.</li> 193 </ol> 194 195 <h2 id="peripheral_mode">USB test: peripheral mode</h2> 196 197 198 <p>Hardware needed: USB cable, OTG adapter</p> 199 200 <h3 id="android_to_android">Android-to-Android</h3> 201 202 203 <p>Apps needed: <em>MidiKeyboard</em> on Android device under test, <em>MidiScope</em> on another 204 Android device.</p> 205 206 <p>Use Android devices as a peripheral controller for another Android device. To help test 207 this mode, use another Android device running in host mode. Note that 208 you could modify the test to work with a desktop computer running Digital Audio Workstation (DAW) 209 software such as 210 GarageBand.</p> 211 212 <ol> 213 <li> Connect the USB cable to the Android device under test (Android device <strong>A</strong>).</li> 214 <li> Use an OTG adapter to connect the other end of the cable to a second Android 215 device <strong>B</strong> that operates in host mode.</li> 216 <li> On Android device A: 217 <ol> 218 <li> Drag finger down from top of screen.</li> 219 <li> Select <strong>USB for Charging</strong> icon.</li> 220 <li> Select <strong>MIDI</strong>.</li> 221 <li> Launch <em>MidiKeyboard</em> app.</li> 222 <li> Select <strong>Android USB Peripheral Port</strong> from <em>Receiver for Keys</em> menu at top.</li> 223 </ol> 224 </li> 225 <li> On Android device B: 226 <ol> 227 <li> Launch <em>MidiScope</em> app.</li> 228 <li> Select the other Android device as the source.</li> 229 </ol> 230 </li> 231 <li> On Android device A: 232 <ol> 233 <li> Play notes on the keyboard and look for <em>NoteOn</em> and <em>NoteOff</em> on Android device B.</li> 234 </ol> 235 </li> 236 </ol> 237 238 <h2 id="bluetooth_le_test">BLE test</h2> 239 240 241 <p>Hardware needed: MIDI keyboard supporting BLE</p> 242 243 <h3 id="basic_pairing_and_playing">Basic pairing and playing</h3> 244 245 246 <p>Apps needed: <em>MidiBtlePairing</em>, <em>MidiSynthExample</em></p> 247 248 <p>Test a keyboard connected to Android over BLE.</p> 249 250 <ol> 251 <li> Reboot the Android device.</li> 252 <li> Power on the BLE keyboard.<br /> 253 (The Miselu C.24 keyboard is powered on by pushing the button near the back so 254 that it pops open. The power button on the C.24 pulses blue when in pairing 255 mode.)</li> 256 <li> Launch the <em>MidiBtlePairing</em> app. It has a <em>MIDI+BTLE</em> icon.</li> 257 <li> Press the <strong>Bluetooth Scan</strong> button.</li> 258 <li> Select desired BLE peripheral.</li> 259 <li> The app should return to the main page, and you should see the peripheral listed. If 260 you are using a C.24, then you will notice that the light should turn green on 261 the C.24 to indicate paired mode.</li> 262 <li> Exit the app by pressing the <strong>Home</strong> button, not the <strong>Back</strong> button.</li> 263 <li> Launch the SynthExample app.</li> 264 <li> Select the BLE keyboard as the sender from the menu.</li> 265 <li> You should be able to press keys on the BLE keyboard and hear notes on 266 Android.</li> 267 </ol> 268