MIDI script functions¶
Functions for C# (Cb.Call) and Python (cb.call). See Script functions for how to use them.
midi.close¶
Closes one of your MIDI connections. Fails with an error when no connection has that name.
| Value | What to put in |
|---|---|
device |
The connection's name from the MIDI page, like "Launchpad". Empty means the first one. |
direction |
Optional. "in" for a MIDI In connection, "out" for MIDI Out. Default "out". |
Gives back: true when done.
var answer = await Cb.Call("midi.close", new { device = "Launchpad" });
answer = cb.call("midi.close", device="Launchpad")
midi.devices¶
Lists the MIDI In and MIDI Out connections you set up on the MIDI page.
Gives back: in and out: each a list of connections with id, name, device, state, open, present (plugged in), message and settings. MIDI In ones also list their events.
var answer = await Cb.Call("midi.devices");
answer = cb.call("midi.devices")
midi.isAvailable¶
Checks whether MIDI works on this computer. Use midi.status to see why when it does not.
Gives back: true when MIDI works here, otherwise false.
var answer = await Cb.Call("midi.isAvailable");
answer = cb.call("midi.isAvailable")
midi.open¶
Opens one of your MIDI connections so it can send or receive. Fails with an error when no connection has that name.
| Value | What to put in |
|---|---|
device |
The connection's name from the MIDI page, like "Launchpad". Empty means the first one. |
direction |
Optional. "in" for a MIDI In connection, "out" for MIDI Out. Default "out". |
Gives back: true when the connection is open now, false when it could not be opened.
var answer = await Cb.Call("midi.open", new { device = "Launchpad" });
answer = cb.call("midi.open", device="Launchpad")
midi.ports¶
Looks for MIDI ports on your computer right now, like a plugged-in keyboard or a virtual MIDI cable.
| Value | What to put in |
|---|---|
direction |
Optional. "in" for inputs, "out" for outputs. Leave it empty for both. |
Gives back: in and/or out: each a list of port names.
var answer = await Cb.Call("midi.ports", new { direction = "out" });
answer = cb.call("midi.ports", direction="out")
midi.sendControlChange¶
Sends a Control Change to a MIDI Out connection, like turning a knob or moving a slider.
| Value | What to put in |
|---|---|
device |
The MIDI Out connection's name from the MIDI page. Empty means the first one. |
channel |
Optional. The MIDI channel, 1-16. Empty or "all" sends on all 16. Default 1. |
controller |
Optional. Which knob or slider (controller number), 0-127. Default 0. |
value |
Optional. The new value, 0-127. Default 0. |
Gives back: true when sent.
var answer = await Cb.Call("midi.sendControlChange", new { device = "Launchpad", controller = 7, value = 100 });
answer = cb.call("midi.sendControlChange", device="Launchpad", controller=7, value=100)
midi.sendEvent¶
Sends any channel message to a MIDI Out connection. Pick the kind of message and its two numbers.
| Value | What to put in |
|---|---|
device |
The MIDI Out connection's name from the MIDI page. Empty means the first one. |
command |
The kind of message: NoteOn, NoteOff, ControlChange, PatchChange, ChannelAfterTouch, PitchWheelChange or KeyAfterTouch. |
channel |
Optional. The MIDI channel, 1-16. Empty or "all" sends on all 16. Default 1. |
data1 |
Optional. The first number, 0-127 (like the note or controller). For PitchWheelChange without data2: the whole value 0-16383. Default 0. |
data2 |
Optional. The second number, 0-127 (like velocity or value). PatchChange and ChannelAfterTouch ignore it. |
Gives back: true when sent.
var answer = await Cb.Call("midi.sendEvent", new { device = "Launchpad", command = "PatchChange", data1 = 5 });
answer = cb.call("midi.sendEvent", device="Launchpad", command="PatchChange", data1=5)
midi.sendNoteOff¶
Sends Note Off (letting go of a key) to a MIDI Out connection.
| Value | What to put in |
|---|---|
device |
The MIDI Out connection's name from the MIDI page. Empty means the first one. |
channel |
Optional. The MIDI channel, 1-16. Empty or "all" sends on all 16. Default 1. |
note |
Optional. The note: a number 0-127 or a name like "C4". Default 60. |
velocity |
Optional. How fast the key is let go, 0-127. Default 0. |
Gives back: true when sent.
var answer = await Cb.Call("midi.sendNoteOff", new { device = "Launchpad", note = "C4" });
answer = cb.call("midi.sendNoteOff", device="Launchpad", note="C4")
midi.sendNoteOn¶
Sends a note (like pressing a piano key) to a MIDI Out connection. It opens the connection if needed. Can also let go of the note after a while.
| Value | What to put in |
|---|---|
device |
The MIDI Out connection's name from the MIDI page. Empty means the first one. |
channel |
Optional. The MIDI channel, 1-16. Empty or "all" sends on all 16. Default 1. |
note |
Optional. The note: a number 0-127 (60 is middle C) or a name like "C4". Default 60. |
velocity |
Optional. How hard the key is pressed, 0-127. Default 127. |
duration |
Optional. With noteOff: how long to hold the note, in milliseconds, before letting go. Default 0. |
noteOff |
Optional. true also sends Note Off (lets go) after the duration. Your script waits for it. Default false. |
Gives back: true when sent.
var answer = await Cb.Call("midi.sendNoteOn", new { device = "Launchpad", note = "C4", velocity = 100, duration = 500, noteOff = true });
answer = cb.call("midi.sendNoteOn", device="Launchpad", note="C4", velocity=100, duration=500, noteOff=True)
midi.sendRaw¶
Sends one complete MIDI message, written as hex bytes, to a MIDI Out connection. For advanced users.
| Value | What to put in |
|---|---|
device |
The MIDI Out connection's name from the MIDI page. Empty means the first one. |
data |
The message as hex bytes, like "B0 07 64" (Control Change 7 to 100 on channel 1). |
Gives back: true when sent.
var answer = await Cb.Call("midi.sendRaw", new { device = "Launchpad", data = "B0 07 64" });
answer = cb.call("midi.sendRaw", device="Launchpad", data="B0 07 64")
midi.sendSysex¶
Sends a SysEx message (a device-specific message) to a MIDI Out connection. F0 at the start and F7 at the end are added when missing.
| Value | What to put in |
|---|---|
device |
The MIDI Out connection's name from the MIDI page. Empty means the first one. |
data |
The message as hex bytes, like "F0 7E 7F 06 01 F7". |
Gives back: true when sent.
var answer = await Cb.Call("midi.sendSysex", new { device = "Launchpad", data = "F0 7E 7F 06 01 F7" });
answer = cb.call("midi.sendSysex", device="Launchpad", data="F0 7E 7F 06 01 F7")
midi.status¶
Tells you how MIDI is working in Cuebot right now.
Gives back: backend (the MIDI library in use), available (true/false), reason (why not, when unavailable), state and message (a status line).
var answer = await Cb.Call("midi.status");
answer = cb.call("midi.status")