Sending MIDI Messages via USB on Android

I would like to make an Android application that sends MIDI messages via USB to a computer in order to be able to control music programs such as Cubase, FL, Reason, ect ...

Hardware MIDI controllers (such as keyboards) are automatically recognized in Windows music software. I guess, because they use a universal MIDI protocol that is directly recognized by the music software. They do not need their own driver.

I would like to be able to use my phone / tablet as a midi controller without having to install personnel on a computer (for example, using hardware controllers).

The Android developer has a demo code for controlling a toy with a rocket launcher via USB. If I send using the same method, will messages that follow the MIDI protocol work the same way?

Thank you in advance for your help.

+5
source share
3 answers

No, it does not work remotely.

MIDI USB devices use a driver ... it's just that they are usually "class compatible" and they can all use the same stock driver that comes with the OS.

To do what you offer, you will need to emulate the device via USB ... complete with the corresponding PnP identifiers and what not. It's almost impossible. The code you found was for using USB in host mode, and not vice versa.

, MIDI , MIDI-.

+3

Android 6.0 (API 23) - Android ( - ) MIDI-.

USB-MIDI, , USB (. ).

Screenshot showing USB selection menu

MIDI- MIDI API. MIDI NoteOn:

byte[] buffer = new buffer[3];
buffer[0] = (byte)0x90 + (byte)0x01; // Note On - Channel 1
buffer[1] = (byte)0x3C; // pitch (Note C3)
buffer[2] = (byte)127; // velocity
int offset = 0;
inputPort.send(buffer, offset, numBytes);

, MIDI-. , Java, .

+10

I wrote a USB MIDI driver for Android.
Useful for creating your own MIDI controller / receiver.

https://github.com/kshoji/USB-MIDI-Driver

Another midi driver is the nmj library.
This library also supports USB MIDI. In addition, it supports some network MIDI protocols, MIDI over bluetooth and MIDI via ADB (debugging connection).

http://www.humatic.de/htools/nmj/

+7
source

All Articles