Glenn Kasten | bd606bd | 2015-10-07 09:02:47 -0700 | [diff] [blame^] | 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 | |
| 54 | <p>Several apps are used by this test procedure:</p> |
| 55 | |
| 56 | <table> |
| 57 | <tr> |
| 58 | <th>App</th> |
| 59 | <th>Description</th> |
| 60 | </tr> |
| 61 | <tr> |
| 62 | <td><a href="https://github.com/philburk/android-midisuite/tree/master/MidiScope">MidiScope</a> or |
| 63 | <a href="https://github.com/googlesamples/android-MidiScope">MidiScope</a></td> |
| 64 | <td>displays MIDI messages on-screen</td> |
| 65 | </tr> |
| 66 | <tr> |
| 67 | <td><a href="https://github.com/philburk/android-midisuite/tree/master/MidiKeyboard">MidiKeyboard</a></td> |
| 68 | <td>sends MIDI messages by pressing an on-screen music keyboard</td> |
| 69 | </tr> |
| 70 | <tr> |
| 71 | <td><a href="https://github.com/philburk/android-midisuite/tree/master/MidiSynthExample">MidiSynthExample</a> or |
| 72 | <br /><a href="https://github.com/googlesamples/android-MidiSynth">MidiSynth</a></td> |
| 73 | <td>simple MIDI synthesizer that uses sawtooth oscillators</td> |
| 74 | </tr> |
| 75 | <tr> |
| 76 | <td><a href="https://github.com/philburk/android-midisuite/tree/master/MidiBtlePairing">MidiBtlePairing</a></td> |
| 77 | <td>pairs an Android device with a BLE peripheral</td> |
| 78 | </tr> |
| 79 | <tr> |
| 80 | <td><a href="https://github.com/philburk/android-midisuite/tree/master/MidiTools">MidiTools</a></td> |
| 81 | <td>library dependency of the above apps</td> |
| 82 | </tr> |
| 83 | </table> |
| 84 | |
| 85 | <p> |
| 86 | Most of these apps are part of the GitHub project |
| 87 | <a href="https://github.com/philburk/android-midisuite">android-midisuite</a>. |
| 88 | </p> |
| 89 | |
| 90 | <p>Each test has a list of apps that are used. After building each app, you can install the app using |
| 91 | <a href="http://developer.android.com/tools/help/adb.html">Android Debug Bridge</a> (ADB). |
| 92 | For example, to install the <em>MidiScope</em> app:</p> |
| 93 | |
| 94 | <ol> |
| 95 | <li> Use a workstation with ADB installed.</li> |
| 96 | <li> Connect a USB cable from the workstation to the Android device.</li> |
| 97 | <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> |
| 98 | <li> On the workstation, enter:</li> |
| 99 | </ol> |
| 100 | |
| 101 | <pre> |
| 102 | cd <em><this-folder></em> |
| 103 | adb install -r MidiScope.apk |
| 104 | </pre> |
| 105 | |
| 106 | |
| 107 | <h2 id="virtual_synth_tests">Virtual synth tests</h2> |
| 108 | |
| 109 | |
| 110 | <p>Note that a MIDI input port can have only one connection. So if another app is |
| 111 | already using an input port, that port will not be available. If you cannot connect to |
| 112 | an input port then try closing other apps.</p> |
| 113 | |
| 114 | <p>Hardware needed: Android device under test</p> |
| 115 | |
| 116 | <h3 id="simple_connection">Simple connection</h3> |
| 117 | |
| 118 | |
| 119 | <p>Apps needed: <em>MidiKeyboard</em>, <em>MidiSynthExample</em></p> |
| 120 | |
| 121 | <p>This tests device enumeration, virtual devices, port connections, and message |
| 122 | sending.</p> |
| 123 | |
| 124 | <ol> |
| 125 | <li> Adjust volume on Android device to about halfway.</li> |
| 126 | <li> Orient phone in landscape mode.</li> |
| 127 | <li> Launch <em>MidiKeyboard</em> app.</li> |
| 128 | <li> Select <strong>SynthExample</strong> from the spinner menu.</li> |
| 129 | <li> Play keys. You should hear notes being played in the <em>SynthExample</em> app.</li> |
| 130 | <li> Exit the application by pressing the <strong>Back</strong> button so that the port will be |
| 131 | closed.</li> |
| 132 | </ol> |
| 133 | |
| 134 | <h2 id="host_mode">USB test: host mode</h2> |
| 135 | |
| 136 | |
| 137 | <p>Hardware needed: USB MIDI keyboard, USB cable, OTG adapter</p> |
| 138 | |
| 139 | <p>Repeat these tests several times. We have seen the USB stack crash hard on some |
| 140 | prototype devices if devices were plugged in and unplugged a few times.</p> |
| 141 | |
| 142 | <h3 id="keyboard_already_plugged_in">Keyboard already plugged in</h3> |
| 143 | |
| 144 | |
| 145 | <p>Apps needed: <em>MidiSynthExample</em> or <em>MidiScope</em></p> |
| 146 | |
| 147 | <p>This tests USB MIDI in host mode.</p> |
| 148 | |
| 149 | <ol> |
| 150 | <li> Adjust volume on Android device to about halfway.</li> |
| 151 | <li> Plug in USB keyboard using the OTG adapter.</li> |
| 152 | <li> Launch <em>SynthExample</em> app or the <em>MidiScope</em> app.</li> |
| 153 | <li> From the menu select the USB keyboard. It will display the brand.</li> |
| 154 | <li> Play notes on the keyboard. If you ran <em>SynthExample</em> then you should hear notes |
| 155 | being played on the phone. If you ran <em>MidiScope</em> then you should see <em>NoteOn</em> and |
| 156 | <em>NoteOff</em> messages on-screen.</li> |
| 157 | <li> Unplug the keyboard. The <em>Sender for Synth</em> menu should display <em>- - - - -</em>.</li> |
| 158 | <li> Exit the application by pressing the <strong>Back</strong> button.</li> |
| 159 | </ol> |
| 160 | |
| 161 | <h3 id="hot_plug_usb_keyboard">Hot-plug USB keyboard</h3> |
| 162 | |
| 163 | |
| 164 | <p>Apps needed: <em>MidiSynthExample</em> or <em>MidiScope</em></p> |
| 165 | |
| 166 | <p>This tests USB MIDI in host mode.</p> |
| 167 | |
| 168 | <ol> |
| 169 | <li> Adjust volume on Android device to about halfway.</li> |
| 170 | <li> Make sure there is not a USB MIDI keyboard plugged in.</li> |
| 171 | <li> Launch <em>SynthExample</em> app.</li> |
| 172 | <li> At middle, next to <em>Sender for Synth</em>, look in menu. You should not see the USB |
| 173 | keyboard listed.</li> |
| 174 | <li> Plug in USB keyboard using the OTG adapter.</li> |
| 175 | <li> At middle, next to <em>Sender for Synth</em>, select the USB keyboard. It will display |
| 176 | the brand.</li> |
| 177 | <li> Play notes on the keyboard. You should hear notes being played on the phone.</li> |
| 178 | <li> At middle, next to <em>Sender for Synth</em>, select <strong>- - - - -</strong>.</li> |
| 179 | <li> Play notes on the keyboard. You should hear nothing.</li> |
| 180 | <li> At middle, next to <em>Sender for Synth</em>, select the USB keyboard. It will display |
| 181 | the brand.</li> |
| 182 | <li> Play notes on the keyboard. You should hear notes being played on the phone.</li> |
| 183 | <li> Unplug the synthesizer. The <em>Sender for Synth</em> menu should display <em>- - - - -</em>.</li> |
| 184 | <li> Exit the application by pressing the <strong>Back</strong> button.</li> |
| 185 | </ol> |
| 186 | |
| 187 | <h2 id="peripheral_mode">USB test: peripheral mode</h2> |
| 188 | |
| 189 | |
| 190 | <p>Hardware needed: USB cable, OTG adapter</p> |
| 191 | |
| 192 | <h3 id="android_to_android">Android-to-Android</h3> |
| 193 | |
| 194 | |
| 195 | <p>Apps needed: <em>MidiKeyboard</em> on Android device under test, <em>MidiScope</em> on another |
| 196 | Android device.</p> |
| 197 | |
| 198 | <p>Use Android devices as a peripheral controller for another Android device. To help test |
| 199 | this mode, use another Android device running in host mode. Note that |
| 200 | you could modify the test to work with a desktop computer running Digital Audio Workstation (DAW) |
| 201 | software such as |
| 202 | GarageBand.</p> |
| 203 | |
| 204 | <ol> |
| 205 | <li> Connect the USB cable to the Android device under test (Android device <strong>A</strong>).</li> |
| 206 | <li> Use an OTG adapter to connect the other end of the cable to a second Android |
| 207 | device <strong>B</strong> that operates in host mode.</li> |
| 208 | <li> On Android device A: |
| 209 | <ol> |
| 210 | <li> Drag finger down from top of screen.</li> |
| 211 | <li> Select <strong>USB for Charging</strong> icon.</li> |
| 212 | <li> Select <strong>MIDI</strong>.</li> |
| 213 | <li> Launch <em>MidiKeyboard</em> app.</li> |
| 214 | <li> Select <strong>Android USB Peripheral Port</strong> from <em>Receiver for Keys</em> menu at top.</li> |
| 215 | </ol> |
| 216 | </li> |
| 217 | <li> On Android device B: |
| 218 | <ol> |
| 219 | <li> Launch <em>MidiScope</em> app.</li> |
| 220 | <li> Select the other Android device as the source.</li> |
| 221 | </ol> |
| 222 | </li> |
| 223 | <li> On Android device A: |
| 224 | <ol> |
| 225 | <li> Play notes on the keyboard and look for <em>NoteOn</em> and <em>NoteOff</em> on Android device B.</li> |
| 226 | </ol> |
| 227 | </li> |
| 228 | </ol> |
| 229 | |
| 230 | <h2 id="bluetooth_le_test">BLE test</h2> |
| 231 | |
| 232 | |
| 233 | <p>Hardware needed: MIDI keyboard supporting BLE</p> |
| 234 | |
| 235 | <h3 id="basic_pairing_and_playing">Basic pairing and playing</h3> |
| 236 | |
| 237 | |
| 238 | <p>Apps needed: <em>MidiBtlePairing</em>, <em>MidiSynthExample</em></p> |
| 239 | |
| 240 | <p>Test a keyboard connected to Android over BLE.</p> |
| 241 | |
| 242 | <ol> |
| 243 | <li> Reboot the Android device.</li> |
| 244 | <li> Power on the BLE keyboard.<br /> |
| 245 | (The Miselu C.24 keyboard is powered on by pushing the button near the back so |
| 246 | that it pops open. The power button on the C.24 pulses blue when in pairing |
| 247 | mode.)</li> |
| 248 | <li> Launch the <em>MidiBtlePairing</em> app. It has a <em>MIDI+BTLE</em> icon.</li> |
| 249 | <li> Press the <strong>Bluetooth Scan</strong> button.</li> |
| 250 | <li> Select desired BLE peripheral.</li> |
| 251 | <li> The app should return to the main page, and you should see the peripheral listed. If |
| 252 | you are using a C.24, then you will notice that the light should turn green on |
| 253 | the C.24 to indicate paired mode.</li> |
| 254 | <li> Exit the app by pressing the <strong>Home</strong> button, not the <strong>Back</strong> button.</li> |
| 255 | <li> Launch the SynthExample app.</li> |
| 256 | <li> Select the BLE keyboard as the sender from the menu.</li> |
| 257 | <li> You should be able to press keys on the BLE keyboard and hear notes on |
| 258 | Android.</li> |
| 259 | </ol> |