Using class compliant USB MIDI interfaces
TouchDAW 1.4 on Android 3.1 (Honeycomb) added support for hardware USB MIDI interfaces on devices featuring USB host mode. On most devices a Usb-OTG ('On The Go') adapter cable or some kind of dock adapter will be needed to provide physical USB type A ports that a MIDI interface can be connected to.
On Android 6 and larger, Usb MIDI interfaces are handled by the system's MIDI api (If your device's manufacturer did not consider it necessary to support MIDI, you'll have a problem. Please complain with the vendor in question). On older systems this is done by nmj. Functionally there should be no difference. Do not unplug your interface while it's in use on Marshmallow, though. The phone or tablet may crash hard and reboot.
What interface to use?
The only requirement to the MIDI interface is that it can run without specific drivers on the major desktop OSs. That is: it needs to be "class-compliant". This is usually the case with most lower end products and you can pick up bare bone Usb Midi "cables" for less than ten Euro on the web (not all of those may be fully functional, though. Some of the cheap stuff blocks Sysex for example). Some more professional boxes may optionally run without dedicated drivers as well. Lots of synthesizers and hardware controllers also come with built-in class compliant MIDI interfaces.
TouchDAW supports interfaces with multiple channels and to make full use of the app you will need a two channel interface. More than one unit can be used via a hub - just keep in mind that the tablet's ability to power devices will be limited.
Android 5 note: MIDI interfaces on combined Audio / MIDI Usb devices may no longer work in Android 5. Thanks to Lollipop's half-baked Usb Audio support this seems to be broken on the system level. On Android 6 this should no longer be a problem.
As of version 1.6 TouchDAW does no longer register for Android's "launch app when Usb device is connected" functionality, because it would clash with Android 6's Usb MIDI support. On Android versions < 6 please make sure that your interface is connected before launching the app, as it won't be able to detect device attachments when it's already running.
Using hardware interfaces still needs to be allowed by the user, so you will be prompted for permission to use the device as shown below.
To make TouchDAW use the interface for MIDI in- and output go through the MIDI connection dialogs as follows:
Note that the second and third dialogs are conditional. If the hardware interface was the only available USB connection (i.e. if ADB and tethering were not enabled), the second dialog would be skipped. If the MIDI interface only offered one port the third dialog would not show up.
Pre Android 6 only: TouchDAW "knows" the names of most interfaces and will name MIDI ports accordingly. In cases where the name can not be read from USB descriptors, you will see portnames like "Class compliant MIDI (a23:b789)". with the hexadecimal numbers in brackets being the vendor and product IDs of the interface. We'll be happy to update the internal "obscure device name database" if you post info on product names along with those numbers to the comments page.
Android's USB host mode API lacks some features before Android 3.2 (in fact there's still some missing now). When running Honeycomb version 3.1 you may find ports on multi IO interfaces not being detected or get non existing ones reported.
The class-compliant firmware in some MIDI interfaces may have issues. This is more likely the case with interfaces that are primarily thought to run on dedicated drivers. The M-Audio Anniversary Series boxes for example can operate class-compliant, but you may occassionally see delays in incoming MIDI.