rtmidi/msg
msg-note-on
(msg-note-on [channel :int note :int velocity :int] :int)
construct a Note On MIDI message.
| channel | MIDI channel (0-15) | |
| note | MIDI note number (0-127) | |
| velocity | note velocity (0-127) |
A __midi_msg* as :int. len is 3.
(let [m (msg-note-on 0 60 127)]
(midi-out-send mo (msg-bytes m) (msg-len m))
(msg-free m))
Since: RM0
msg-note-off
(msg-note-off [channel :int note :int velocity :int] :int)
construct a Note Off MIDI message.
| channel | MIDI channel (0-15) | |
| note | MIDI note number (0-127) | |
| velocity | release velocity (0-127) |
A __midi_msg* as :int. len is 3.
(let [m (msg-note-off 0 60 0)]
(midi-out-send mo (msg-bytes m) (msg-len m))
(msg-free m))
Since: RM0
msg-control-change
(msg-control-change [channel :int cc :int value :int] :int)
construct a Control Change MIDI message.
| channel | MIDI channel (0-15) | |
| cc | controller number (0-127) | |
| value | controller value (0-127) |
A __midi_msg* as :int. len is 3.
(let [m (msg-control-change 0 7 100)]
(midi-out-send mo (msg-bytes m) (msg-len m))
(msg-free m))
Since: RM0
msg-program-change
(msg-program-change [channel :int program :int] :int)
construct a Program Change MIDI message.
| channel | MIDI channel (0-15) | |
| program | program number (0-127) |
A __midi_msg* as :int. len is 2.
(let [m (msg-program-change 0 0)]
(midi-out-send mo (msg-bytes m) (msg-len m))
(msg-free m))
Since: RM0
msg-pitch-bend
(msg-pitch-bend [channel :int lsb :int msb :int] :int)
construct a Pitch Bend MIDI message.
| channel | MIDI channel (0-15) | |
| lsb | least significant 7 bits of bend value (0-127) | |
| msb | most significant 7 bits of bend value (0-127) |
A __midi_msg* as :int. len is 3.
(let [m (msg-pitch-bend 0 0 64)]
(midi-out-send mo (msg-bytes m) (msg-len m))
(msg-free m))
Since: RM0
msg-aftertouch
(msg-aftertouch [channel :int pressure :int] :int)
construct a Channel Pressure (Aftertouch) MIDI message.
| channel | MIDI channel (0-15) | |
| pressure | pressure value (0-127) |
A __midi_msg* as :int. len is 2.
(let [m (msg-aftertouch 0 64)]
(midi-out-send mo (msg-bytes m) (msg-len m))
(msg-free m))
Since: RM0
msg-poly-aftertouch
(msg-poly-aftertouch [channel :int note :int pressure :int] :int)
construct a Polyphonic Aftertouch MIDI message.
| channel | MIDI channel (0-15) | |
| note | MIDI note number (0-127) | |
| pressure | pressure value (0-127) |
A __midi_msg* as :int. len is 3.
(let [m (msg-poly-aftertouch 0 60 80)]
(midi-out-send mo (msg-bytes m) (msg-len m))
(msg-free m))
Since: RM0
msg-sysex
(msg-sysex [bytes :cstr len :int] :int)
construct a SysEx MIDI message with 0xF0/0xF7 framing.
| bytes | pointer to the inner SysEx data bytes (without 0xF0/0xF7) | |
| len | number of inner data bytes |
A __midi_msg* as :int. Total len is len + 2 (including 0xF0 and 0xF7).
(let [data "\x41\x10\x42"]
(let [m (msg-sysex data 3)]
(midi-out-send mo (msg-bytes m) (msg-len m))
(msg-free m)))
Since: RM0
msg-status
(msg-status [m :int] :int)
return the status nibble (high 4 bits) of a MIDI message.
| m | __midi_msg* as :int (from any msg-* constructor) |
Status nibble as :int, e.g. 0x90 for Note On.
(assert-eq (msg-status (msg-note-on 0 60 127)) 0x90)
Since: RM0
msg-channel
(msg-channel [m :int] :int)
return the channel nibble (low 4 bits) of a MIDI message.
| m | __midi_msg* as :int (from any msg-* constructor) |
Channel nibble as :int (0-15).
(assert-eq (msg-channel (msg-note-on 3 60 127)) 3)
Since: RM0
msg-data1
(msg-data1 [m :int] :int)
return the first data byte of a MIDI message.
| m | __midi_msg* as :int (from any msg-* constructor with len >= 2) |
First data byte as :int.
(assert-eq (msg-data1 (msg-note-on 0 60 127)) 60)
Since: RM0
msg-data2
(msg-data2 [m :int] :int)
return the second data byte of a MIDI message.
| m | __midi_msg* as :int (from any msg-* constructor with len >= 3) |
Second data byte as :int.
(assert-eq (msg-data2 (msg-note-on 0 60 127)) 127)
Since: RM0
msg-bytes
(msg-bytes [m :int] :cstr)
return a pointer to the raw byte buffer of a MIDI message.
| m | __midi_msg* as :int (from any msg-* constructor) |
Raw byte buffer as :cstr; use with msg-len for midi-out-send.
(midi-out-send mo (msg-bytes m) (msg-len m))
Since: RM0
msg-len
(msg-len [m :int] :int)
return the byte count of a MIDI message.
| m | __midi_msg* as :int (from any msg-* constructor) |
Number of bytes in the message as :int.
(assert-eq (msg-len (msg-note-on 0 60 127)) 3)
Since: RM0
msg-free
(msg-free [m :int] :void)
free all memory associated with a MIDI message.
| m | __midi_msg* as :int (from any msg-* constructor) |
void
(msg-free m)
Since: RM0