Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Sends a midi message.

Component Version macOS Windows Linux Server iOS SDK
PortMidi 4.2 ✅ Yes ✅ Yes ❌ No ❌ No ❌ No
MBS( "PortMidi.SendMessage"; StreamRef; Status; Data1; Data2 { ; Timestamp } )   More


Parameter Description Example Flags
StreamRef The reference to the midi stream. You create those with PortMidi.OpenInput or PortMidi.OpenOutput and finally close them with PortMidi.Close. $stream
Status The Midi status code. 144
Data1 The first data byte. 4*12+0
Data2 The second data bytes. 127
Timestamp The timestamp. If zero or not provided, note is sent immediately. 0 Optional


Returns OK or error.


Sends a midi message.
The Status is the command code. 144 is note on and 128 is note off. For those note commands Data1 is the number of the note. 48 (4*12) is C2 and then you can count over all notes till you get to next octave with C3 (5*12).


Press down a C note:

MBS( "PortMidi.SendMessage"; $StreamRef; 144; 4*12+0; 127 )

Release a C note:

MBS( "PortMidi.SendMessage"; $StreamRef; 128; 4*12+0; 127 )

See also

Example Databases

This function checks for a license.

Created 18th August 2014, last changed 3th April 2021

PortMidi.Rescan - PortMidi.SendMessageRaw