Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 12.2   12.3   12.4   12.5   13.0   13.1   13.2   13.3   13.4   13.5    Statistic    FMM    Blog  

PortMidi.SendMessage

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

Parameters

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

Result

Returns OK or error.

Description

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).

Examples

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

💬 Ask a question or report a problem