ANDROID DEVICES AS MIDI CONTROLLERS Art Hunkins abhunkin@uncg.edu http://www.arthunkins.com A BIT OF PERSONAL BACKGROUND As a classically-trained musician, my interest has always been in live performance. To me, performance has a human and everchanging face, exhibiting both variability and personal interpretation. As a consequence, my Csound works are nearly all realtime, and require performance interfaces. Though I've used FLTK and Python widgets (the latter for Sugar activities for children), CsoundAV, Lettuce and Cabbage, even ASCII keyboards, I favor hardware MIDI devices - particularly control surfaces consisting of sliders and/or buttons. I find these controllers more user-friendly. (My music is mostly slow and meditative; so my need for precise, slow-moving control with immediate visual feedback favors long-throw sliders over knobs and other options.) The challenge of hardware control surfaces, especially as compared to mouse-on-screen, is that the widget count is fixed per control device, and often only vaguely corresponds to compositional requirements. Though I've often been tempted to design my music for a particular control surface, doing so drastically reduces the opportunity for performance. (Not to mention that it can be expensive both for composer and potential performer.) So I am always on the lookout for configurable performance interfaces that allow for combinations of buttons and sliders. Recently, on eBay, the JazzMutant Lemur caught my eye. Despite its lack of tactile feedback, its ability to configure a plethora of controls is impressive. However, its price tag is way beyond my pay grade (I'm a retired college music professor after all). Besides, it is long out of production. However, Lemur has now morphed into an impressive software app for the iPad/iPhone, and costs a more reasonable $24.99[1]. Unfortunately, Lemur is not available for Android devices. Further investigation managed to unearth several other apps with extensive capability comparable to Lemur[2]. They were less expensive than Lemur - even free, and like Lemur had their GUI editing facility built into the app. Again, however, they were only for iOS. An additional consideration: my work doesn't require the many tools that Lemur and these other apps provide. The question remains: what more basic (and inexpensive) app might be available for Android? Two notable events had sent me down the Android path: 1) Csound was ported to the Android OS; 2) my son gifted me with a Samsung Galaxy Tab 2 (and is himself an Android developer[3]). So now a complete Csound composing/performance environment is available to recent Android devices - in a single app. (I actually have realtime Csound running solely on a $35 mini-tablet[4] you can fit in your pocket.) From a performance standpoint, however, there are two main issues: 1) The Android port includes a fixed, limited collection of performance widgets (5 sliders, 5 buttons, one X/Y controller); 2) the performance interface is not MIDI, and involves chnget calls. Thus, any .csd must be redone for Android. The only way to change the Android performance interface currently, is to create a new Csound Android app. (My son and I have done this: we created an enhanced interface of 9 sliders and 12 buttons[5].) A next step in Csound Android development may well be an option to select the number of sliders, buttons (and X/Y controller?) within the Csound app itself. (This is a possibility my son and I will explore soon. Until then, GUI customization for the Android port of Csound remains problemmatic.) So, again, is there an Android app that offers an alternative solution to these issues? Yes - TouchOSC[6]. TouchOSC *includes code for MIDI*, allowing any recent Android device to act as a MIDI controller for Mac or PC. It permits custom performance GUIs (Layouts) potentially specific to each composition. Perhaps most importantly, the .csd remains exactly the same as for a traditional MIDI controller. In researching both Lemur and TouchOSC as possible MIDI controllers, I ran across an important article that compares and contrasts the two apps: "Touch Music Control Choices: TouchOSC Gives Android, iPhone 5 Proper Love"[7]. This is required reading for anyone interested in TouchOSC, and includes several instructive videos. TOUCHOSC FOR ANDROID DEVICES TouchOSC is available for both iOS and Android. Both versions are downloadabe for a reasonable $4.99. Though I have used it only on Android, the excellent documentation[8] is written for iOS, but is nearly identical for Android. Besides the TouchOSC app itself, two other software pieces (free) are required: TouchOSC Editor and TouchOSC Bridge[9]. These are needed by the computer (Mac or PC). (Note that TouchOSC does not have in-app GUI editing - a feature that could be viewed as either positive or negative.) The Editor program that creates these layouts (.touchosc files), is also available for Linux (though TouchOSC Bridge is not - thus presumably eliminating Linux from MIDI control by TouchOSC). TOUCHOSC SETUP There are two ways of setting up TouchOSC. One requires a wireless network (a wireless router, but *not* modem and internet connection); the other needs portable hotspot capability on your device (Android devices since version 3.x have it). In either case, your *computer* must have wireless connectivity (desktop computers can use an inexpensive wireless USB adapter). Start by Downloading/installing TouchOSC to your device, and TouchOSC Bridge (as well as TouchOSC Editor) to your computer. THE WIRELESS (WiFi) NETWORK METHOD 1) Open a WiFi network connection on your computer. 2) Run (open) TouchOSC Bridge on your computer. (A black icon with a "B" on it should appear in your taskbar). 3) On your device, connect to the same wireless network as your computer. (Settings | WiFi ON.) 4) On your device, open the TouchOSC app. Click MIDI Bridge. If your desired WiFi network is listed (under Found Hosts), select it. If not, on your computer at the command prompt, enter ipconfig, and copy the ipaddress found to the Host field in MIDI Bridge on your device. 5) Back out of MIDI Bridge. 6) Select your desired Layout in Settings. If you've created your own .touchosc layouts and copied them to your device, first Import them from the File to which you copied them. 7) Select Done. 8) Open and run your .csd in your computer - from the command prompt or any frontend. Do check that the correct MIDI input device (TouchOSC Bridge) is selected under in your Csound file. 9) Perform on your TouchOSC layout! THE PORTABLE HOTSPOT METHOD (Android OS 3.x and up) Note: when available WiFi networks are weak, the portable hotspot method gives better results. Networks with low connectivity are less dependable, and can respond more slowly. 1) On your device (Settings | WiFi/More | Portable Hotspot | Select Portable Hotspot), turn on Portable WiFi Hotspot. (Doing so will turn off your usual WiFi connection if it is already on.) If you hadn't previously created your hotspot, click Set up WiFi Hotspot, select a security type and password. (If you've forgotten your password, check Show Password.) Remember your hotspot's name (SSID) and password (also called network key) for the following step. 2) On your computer, select your device's wireless hotspot (SSID) that is now available, using information from step 1. 3) Continue with step 4 of the Wireless Network Method. Note: the computer's ipaddress will not be the same for these two connection methods. However, the address will *not change* unless the *method of connecting* changes. LAYOUT SAMPLES AND .CSD TEST FILE I have written a .csd test file for user-designed TouchOSC layouts that verifies communication between the TouchOSC app, TouchOSC Bridge and Csound. It tests controller widgets (sliders, rotary knobs, X/Y controller) and MIDI notes (buttons, keys and pads - the latter with velocity sensitivity). This file, an explanatory README.txt, and 18 TouchOSC layouts comprise the zip archive, TouchOSC_for_Android[10]. (Note: any MIDI monitor program for the computer [such as MIDIOx for PC] can also verify proper communication between mobile device and computer. Getting your setup just right can be troublesome.) These sample layouts run on all recent smartphones and tablets, both iOS and Android. Some are appropriate for smaller devices, others (with more widgets) for larger tablets. Each of 9 sample layouts come with text labels, a parallel set of 9 without. All use default values found in the test file. (These values can be changed in any text editor.) See the archive's README.txt for further information. SUMMARY TouchOSC is a valuable app that functions as a MIDI controller for realtime Csound on both Macs and PCs. Its positive features include: 1) It is available for both iOS and Android platforms. 2) It interfaces with both Macs and PCs. 3) Latency is minimal, especially with a strong wireless connection. 4) It works well on smartphones and tablets of various sizes. 5) It is well documented. 6) It requires no changes to .csd code. 7) Though it uses a wireless connection, it does not require the internet. 8) It has a good, standalone editor (for Mac, PC, *and Linux*) that creates custom GUIs. 9) The app costs $5 (a one-time charge) and runs on Android tablets that are priced as low as $35. It allows a single smartphone or device to do the work of numerous (and expensive) hardware controllers. 10) Unlike many hardware controllers, mobile devices do not require an electrical connection. When paired with a laptop, setups do not require an electrical connection at all. Given a choice, I will admit, however, to prefering my favorite MIDI hardware controllers to Android devices in performance. I find hardware: 1) more ergonomic (good tactile feedback and solid control); 2) more dependable (Android devices lack MIDI out, so a wired connection is not available. Note, though, that under the right conditions, latency of wireless connections can be remarkably low); 3) somewhat easier to set up. Of course, I've all that multitude of hardware controllers ready to choose from! AFTERWORD Of possible related interest is another Android app, MyOSC - BETA[11]. Though lacking a version for iOS, it partners with both Mac and PC, and is a near dropin replacement for TouchOSC. Indeed it promotes itself as an "upgrade" of TouchOSC, and requires both the latter's MIDI Bridge and GUI editor. Thus it is an alternate interface for GUIs produced by the TouchOSC Editor, displaying its widgets in a cleaner and more highly visible style. Its only modification is to show controller values (which TouchOSC does not). Perhaps best of all it's free. (Warning: MyOSC does not implement advanced TouchOSC widgets and features - even including velocity sensitivity for notes! Its sluggishness with continuous controllers is no doubt due to its display of changing values. Overall the app is somewhat less dependable than TouchOSC.) To install MyOSC - BETA, simply follow the instructions for TouchOSC, substituting MyOSC - BETA for TouchOSC. The only departure is that user-designed layouts must be stored in /sdcard/MyOSC (and cannot be directly copied/synced from the TouchOSC Editor). References: [1] https://liine.net/en/products/lemur/ [2] The two apps are: MIDI Touch - $19.99; http://www.iosmidi.com. Only for iPad. MIDI Designer 12 - $1.99; http://www.mididesigner.com. For iPhone/iPad. A free MIDI Designer Lite is available (with moveable adbar); also a MIDI Designer Pro version @ $14.99. [3] Dave Hunkins; dmhunkins@gmail.com; http://www.zatchu.com [4] A refurbished iview CyberPad 4.3" Tablet PC from NewEgg.com. In addition, there was a $10 rebate. [5] http://www.arthunkins.com/Android_Csound_Apps.htm [6] http://hexler.net/software/touchosc-android [7] The author is Peter Kirn - http://createdigitalmusic.com/2013/05/touch-music-control-choices-touchosc-gives-android-iphone-5-proper-love/ [8] http://www.hexler.net/docs/TouchOSC [9] http://www.hexler.net/software/touchosc [10] http://www.arthunkins.com/TouchOSC_for_Csound.zip [11] https://play.google.com/store/apps/details?id=com.widget.myosc Unfortunately, the author's "website" is minimal. Indeed, perhaps the app is abandoned (as well as a bit buggy)?