RtMidi.Input.Message Class


About RtMidi.Input.Message Class


RtMidi.Input.Message class is mainly used for receiving MIDI Messages from MIDI Input devices.


RtMidi.Input.Message Class Methods


RtMidi.Input.Message.ManualChecking( bool ManualChecking ) specifies if Giavapps MIDI should store data about detected MIDI Messages in order that you can then check that data through RtMidi.Input.Message.* functions. By default this feature is disabled. When this feature is enabled you must always loop through all received data by calling RtMidi.Input.Message.Count() (usually inside Update() or Coroutine methods). If a MIDI device continues sending MIDI Messages and you are not processing them you may cause a memory leak. (See Code Examples below for more info about how to manual check MIDI Messages correctly). When this feature is disabled, Giavapps MIDI will stop storing data for MIDI Messages. You can leave disabled this feature if you are not going to use any of the RtMidi.Input.Message.* functions.

bool ManualChecking: enable (true) or disable (false) manual check.


RtMidi.Input.Message.Type( bool Sysex, bool Time, bool Sense) specify whether certain MIDI Message Types should be queued or ignored during input.

bool Sysex: enable (true) or disable (false) System Exclusive messages.
bool Time: enable (true) or disable (false) Timing messages.
bool Sense: enable (true) or disable (false) Active Sensing messages.


RtMidi.Input.Message.Count() returns the amount of messages from an open MIDI Input device. Use the other RtMidi.Input.Message.* functions to get info about the messages. When you call this function Giavapps MIDI will free data stored for MIDI Messages (see RtMidi.Input.Message.ManualChecking() function for more info).


RtMidi.Input.Message.Size( ulong MessageIndex ) returns the amout of bytes of the specified MIDI Message.

ulong MessageIndex: zero-based index of the MIDI Message.


RtMidi.Input.Message.Byte( ulong MessageIndex, ulong ByteIndex) Returns the specified byte (0-255) from the given MIDI Message.

ulong MessageIndex: zero-based index of the MIDI Message.
ulong ByteIndex: zero-based index of the byte.


RtMidi.Input.Message.Time( ulong MessageIndex ) returns the amount of time passed since the previous MIDI Message was received.

ulong MessageIndex: zero-based index of the MIDI Message.


Code Example

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Giavapps.MIDI;

public class CodeExample : MonoBehaviour

void Awake()
RtMidi.Initialize();//Initializes RtMidi
RtMidi.Input.Device.Open(2);//Opens the third MIDI Input Device ("Oxygen 49" MIDI Keyboard in my case)
RtMidi.Output.Device.Open(0);//Opens the first MIDI Output Device ("Microsoft GS Wavetable Synth" by default on Windows)
RtMidi.Input.Message.AutoMessage(true);//Sends all received MIDI Input Messages to the MIDI Output Device ("Oxygen 49" >>> "Microsoft GS Wavetable Synth" in my case)
RtMidi.Input.Message.ManualChecking(true);//Enables manual checking of MIDI Messages
RtMidi.Input.Message.Type(true,true,true);//Enables all MIDI Messages Types

void Update()

//Prints all received MIDI Messages
ulong messages = RtMidi.Input.Message.Count();

for(ulong m = 0; m < messages; m++)
double time = RtMidi.Input.Message.Time(m);
ulong size = RtMidi.Input.Message.Size(m);
string bytes = “”;

for(ulong b = 0; b < size; b++)
bytes += RtMidi.Input.Message.Byte(m, b).ToString()+” “;

.Log(“MIDI MESSAGE – TIME: “+time.ToString()+” – “+size.ToString()+” bytes – “+bytes);


void OnApplicationQuit()
RtMidi.Deinitialize();//Deinitializes RtMidi



I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Comments are closed.