The VRChat Documentation Hub

Welcome to the VRChat Documentation hub. You'll find comprehensive guides and documentation to help you start working with VRChat as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Midi in Udon

VRChat can connect to a single MIDI device and receive events from it, piping them through to your Udon Programs.

Components

To get started with Midi in your scene, add a VRC Midi Listener component to one of your GameObjects.

This Component informs VRChat that you want to receive Midi events, and starts up the Midi system if needed. You need to select the events you want to receive by pressing the 'Active Events' toggles to select them - no events are selected by default, so turn them on before you start testing. You also need to select an UdonBehaviour that will receive these events by selecting it as the 'Behaviour' on the VRC Midi Listener. This UdonBehaviour can be on the same GameObject as the Midi Listener, or any other object.

You may notice a VRCMidiHandler gameobject and component added automatically when you start your scene. This is the handles the Midi device driver and sends events to all the Listeners. DO NOT add this component anywhere yourself - it is meant to be automatically added and removed so that Midi Devices are only connected to once, and disconnected when someone leaves your world.

Device Selection - Editor

You can test your Midi events in the Unity Editor by selecting your device through the VRChat SDK. It is saved in your Editor preferences, so Unity will remember your device for every project.

Device Selection - Runtime

When you visit a world with Midi events, VRChat will try to open the first Midi device it can find on your machine. If you have multiple devices and want to specify which one to use, you can pass part of its name as command-line argument. For example, if you have a device that appears in Windows as "SchneebleCo MidiKeySmasher 89", you can add this to your launch options / script:
--midi=midikeysmasher
VRChat will match partial names and ignore case. Learn about all other Launch Options: Launch Options

Midi Events

MidiNoteOn

Triggered when a Note On message is received, typically by pressing a key / pad on your device.
Outputs:

  • int channel Midi Channel that received the event, 0-15.
  • int number Note number from 0-127 (your midi Device may not output the full range)
  • int velocity Number from 0-127 representing the speed at which the note was triggered, if supported by your midi device.

MidiNoteOff

Triggered when a Note Off message is received, typically by releasing a key / pad on your device.
Outputs:

  • int channel Midi Channel that received the event, 0-15.
  • int number Note number from 0-127 (your midi Device may not output the full range)
  • int velocity This value is typically 0 for Note Off events, but may vary depending on your device.

MidiControlChange

Triggered when a control change is received. These are typically sent by knobs and sliders on your Midi device.
Outputs:

  • int channel Midi Channel that received the event, 0-15.
  • int number Control number from 0-127.
  • int value Number from 0-127 representing the value sent by your controller. For some knobs that can spin endlessly rather than being limited by physical start / end positions, this value might be simply 0 and 1 or some other range indicating "positive" and "negative" increments that you must manage on your own.

Example Scene

You can download a demo scene that reads and displays all three message types below.
You can visit the world here: Udon Midi Test.

Updated 6 months ago


Midi in Udon


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.