Midi Receiver
Live input from a computer keyboard or MIDI device
Last updated
Live input from a computer keyboard or MIDI device
Last updated
Midi Receiver listens for midi input from an external device. This can be used to synchronize visuals with live played music or using a midi controller.
Please be advised that for MIDI device support, this behavior requires one of the 3rd party plugins for Unity, either or . Timeflow is not affiliated in any way with these plugins other than implementing the input that it provides. Axon Genesis is not responsible for its performance or any issues that may occur while using it.
Live MIDI input varies by platform. Please refer to the documentation for the MIDI plugin you choose to use for a list of supported platforms and devices.
Please refer to the following pages for step-by-step instructions to install and configure either Minis or MidiJack. Minis is the newest and preferred solution, while MidiJack is offered for legacy support.
Select the object to view its settings in the Inspector.
MIDI Jack only works during runtime so it is necessary to enter play mode to receive any midi input. Click 'Enter play mode for input' to enter play mode in the editor.
Saves the current configuration to the PlayerPrefs.
Loads the configuration from the PlayerPrefs.
If enabled, the configuration is automatically loaded and saved on Awake and Destroy, respectively. Changes are not saved until unloaded or the Save button is pressed.
If Auto is enabled, new midi mappings assigned at runtime are automatically saved and restored the next session. This option is preferred when custom mappings are allowed.
You must enter play mode to use the Map feature.
Upon entering play mode, the current configuration is loaded and Midi Receiver is awaiting midi input to react to the control it is currently mapped to.
To assign a new midi input, press Map to enter listening mode.
The first input detected from any key, knob, or fader is captured and mapping mode ends.
MIDI mapping can be set at runtime by using a UnityEvent (using a UI Button or other input) as well as controlled by custom script. There are 3 methods in MidiReceiver:
StartMapping() : Begins listening for the first MIDI input, which when detected is assigned and automatically stops listening.
StopMapping() : Cancels or interrupts the listening process, making no change to the existing/prior mapping.
ToggleMapping() : Starts or stops the mapping process. This method is best used with buttons or toggle switches.
Select the input channel (1-16) to receive midi signals.
Select whether the input control is a Note (key on a keyboard) or a Knob (a fader or twist knob).
This option is available for note types only. When enabled, notes played are treated the same across all octaves. For example, if you map the note C, it will be triggered when C is played in any octave.
This is an optional UI button to allow users to map midi input during runtime. When the button is pressed, it puts Midi Receiver into listening mode and captures the first midi note or knob touched.
This defines the basename for PlayerPrefs values to store and retrieve the midi input configuration for this Midi Receiver. By default this name matches the game object name but may be changed if desired. This saves several values into the PlayerPrefs starting with the basename.
This removes the values from the PlayerPrefs based on the current name entered. Use this to clear out old settings before renaming a setting.
When this option enabled, standard keyboard input can be used to trigger events in lieu of MIDI.
The key code can be selected manually in the inspector by using the dropdown menu, or in play mode you can enter mapping mode (press the Map button) to listen for the first key pressed.
If enabled, no mapping is required and any key on the keyboard will cause MidiReceiver to trigger.
of these settings.
If enabled, the midi note immediately triggers this behavior when pressed.
For any effect that comes on gradually, turn off Instant and set the Attack (time in seconds) desired. This could be good for lighting or anything that fades on.
Midi input may be mapped directly to a property or to control Midi Tween, Tween
Maps directly to a property.
Assign an instance of Tween or Midi Tween to control. Use the Amount slider to blend the influence of the live received midi over the current behavior.
When this mode is selected, midi input only triggers the Events (registered below) and does not apply directly to any property. Use this mode to pass live midi note values to a custom script.
Unity Events may be used to propagate note on/off events to drive other behaviors. This could be used to trigger particles, animations, or custom scripts. The value passed to these events is the note intensity (velocity), which may be used or ignored by the registered event listeners.
Most often, only 1 program may receive midi messages, blocking other applications from receiving messages. If you are running Unity with MIDI Jack while also running audio software that uses midi, it may block MIDI Jack from receiving signals. This is something that will need to be tested on your setup, however to test midi input it is advised to close other applications that might interfere with receiving midi signals.
To verify that your device and computer are communicating, you may want to try using a 3rd party application to diagnose midi signals, such as Midi View:
Be sure to close Unity and all other applications to test midi input.
InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings.
If you see this error message during play mode, it means you are using the wrong type of Event System for the current input configuration. To fix this please refer to the example scene for the correct setup:
Assets/AxonGenesis/Timeflow/Examples/Scenes/AudioMidi/MidiReceiver_InputSystem
If neither or are installed, Midi Receiver displays a warning in the Inspector.
For common features, please see and .
If a configuration is saved and then the PlayerPrefs Name is changed, the configuration will need to be saved again under the new name. This also may result in the old settings remaining in PlayerPrefs. This doesn't hurt anything but you may want to clear the settings with the old name first before setting a new name, using .
To inspect and edit PlayerPrefs, get the free Unity plugin .
Notes are processed using an ADSR envelope (Attack, Delay, Sustain, Release). Please refer to the glossary for an explanation of .
Please refer to the documentation for for
Unlike Midi Tween which has the ability to the note attack, with live midi input there is no possibility to predict when a note will be played. To avoid introducing latency (a delay from the note being played to seeing it visually) it is recommended to use Instant mode.
This works identically to , replicated in Midi Receiver to simplify the setup for basic use. However, either Tween or Midi Tween may be used for additional control.
Using , it is possible to combine input from a with live midi input using Midi Receiver, essentially adding the live signal in with the prerecorded midi. This depends on the Remote Control setting of Midi Tween.