Understanding android and MIDI Cable Connections

Asked 2 years ago, Updated 2 years ago, 122 views

I am creating an application to receive MIDI Note ON and OFF messages on Android.
I have a MIDI cable connected to the Android terminal via micro USB.
Therefore, we are developing using the API of Android.media.midi, but it does not recognize the MIDI cable.Maybe it's simply because there's no driver in it that handles the MIDI cable, but when I installed the MIDI application, it was able to receive the MIDI message.

Specific circumstances are as follows:

·Development environment: Android Studio
·Portable terminal: Zenfone2
·Developer option for terminal (USB Configuration): MIDI
·Android version: 6.01 (API level 23)
·Connection MIDI cable: UX16 (YAMAHA)

Added the following to AndroidManifest.xml:

<uses-feature android:name="android.software.midi"android:required="true"/>

Here are some of the codes:

MidiManager=(MidiManager) context.getSystemService(Context.MIDI_SERVICE);  
if(context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_MIDI)){
    MidiDeviceInfo[] infos=m.getDevices();
}

The current situation is when you run getDevices(), the infos length is 0 (infos[0] is null).

Also, when you start the application as an OTG function of the USB host by describing the following in the manifest,
Identified the cable as a USB device.

<uses-feature android:name="android.hardware.usb.host"/> 

This is a reference site for Android.media.midi.
Android Developers:
https://developer.android.com/reference/android/media/midi/package-summary.html#get_list_of_already_plugged_in_entities

Could you tell me why the MIDI cable is not recognized and how to make it recognized?Thank you for your cooperation.

android usb

2022-09-30 21:24

1 Answers

I'm not that familiar with Android MIDI either...

As far as I've tried, the following two products were recognized by the Android MIDI API.

In addition to the MIDI API that comes standard with Android 6.0, there is also a USB MIDI Driver (https://github.com/kshoji/USB-MIDI-Driver) provided by kshoji.There are many devices that are sensibly compatible with this device, and I think the MIDI app I installed is probably using this one.

That's all for your information.


2022-09-30 21:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.