2021年8月14日土曜日

Published Unity asset: MIDI Plugin for Mobile devices

I published a new plugin asset for Unity at the Store. 
This article explains about this plugin's features.

Features

This plugin enables MIDI event transceive functions to mobile Unity project(iOS/Android)
  • MIDI Event Receiving and Sending
    • The plugin can treat the all kind of MIDI events defined in MIDI 1.0.
  • USB MIDI
    • Android only
  • Bluetooth MIDI (BLE MIDI)
    • both of iOS and Android
  • Apple Network MIDI (RTP-MIDI)
    • iOS only

Works with Android-based VR devices

This plugin also work with Android-based VR devices, such as Oculus Quest 2. It can easily create app that VR objects interact with real MIDI instruments. When I pointed an cube in the VR world, the real-world MIDI module plays a sound. And vice versa, When I play real-world keyboard, the VR objects will be interacted with playing MIDI note.

How to try with a sample scene

Install the plugin

  • Install the plugin from Unity Asset Store.
  • Select the app's platform; iOS or Android, and build the app with sample scene.
    • The sample scene 'MidiSampleScene.unity' is found at Assets/MIDI/Samples/Scenes directory.
    • The plugin doesn't work with Unity Editor, so you should build the app binary and install it into the real devices.

MidiSampleScene

Start app with Sample scene, some GUI will be appeared.
The left window is for selecting MIDI device, and sending some MIDI messages.
The right window is for viewing received MIDI messages.

Connect with MIDI devices

  • Android
    • USB / Bluetooth MIDI devices will be automatically detected, connected, and displayed on GUI 'Device' list.
  • iOS
    • Apple Network MIDI devices are automatically connected and displayed on GUI 'Device' list.
    • Select Bluetooth MIDI devices at the first time the app launched.
These initializations are implemented at InitializeMidi method in MidiManager class.

New connection / disconnection events can be received by implementing IMidiDeviceEventHandler interface.
The device's name can be got from GetDeviceName method in MidiManager class. The device's name may sometimes empty(null) if the name has not noticed yet.

Sending MIDI events

The implementation for sending MIDI events will be like this. 

Receiving MIDI events

The implementation for receiving MIDI events will be like this.

Open Source

Some parts of this package are Open Source project. The below list are dependency libraries in the package.
All repositories below are owned by me, feel free to feature request or issue reporting.

0 件のコメント:

コメントを投稿