open-audiovisual
Search GitHub

oav-p5 reference · MIDI: knobs, faders, pads, keys

OAVp5.devices#

variableoav-p5
OAVp5.devices

The names of the MIDI controllers plugged in, as the browser reports them: an array of text, empty when there is none.

Use it for a line like "playing: Arturia MiniLab3", or to tell whether a real controller is there. The names are whatever the operating system calls the port, so match them loosely (name.toLowerCase().includes('minilab')). The 🎹 panel uses them to follow the controller that is plugged in.

Type
Array<String>

One entry per connected input port. Replaced whenever a device is plugged in or out. Empty until Web MIDI has been allowed (OAVp5.hardware), and it never lists the on-screen controller or the phone.

Notes

  • midi.devices is the same array, replaced as a whole, not changed in place: read it again after a change.

Examples

jsOpenProcessing ↗
function setup() {
  createCanvas(400, 300);
}

function draw() {
  background(20);
  fill(255);
  text(OAVp5.devices.length ? 'playing: ' + OAVp5.devices.join(', ') : 'no MIDI controller plugged in', 20, 30);
}
Names the controllers found, or says there are none. Plug a controller in while the page is open and the line changes.

Related

  • OAVp5.hardware Where Web MIDI stands: 'off', 'asking', 'connected', 'waiting', 'denied' or 'unavailable'.
  • OAVp5.connectHardware() Asks the browser for Web MIDI now, and returns a promise that says whether a real controller can be heard.
  • profile Which controller the on-screen 🎹 shows, by profile id such as akai-lpd8; by default it follows the one that is plugged in.
  • hardware When oav-p5 asks the browser for Web MIDI, which a real controller needs: auto at load, click when the 🎹 panel opens, or off.

p5/oav-p5.js, line 626

↑ Back to top · All names