open-audiovisual
Search GitHub

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

noteIsPressed#

variableoav-p5
noteIsPressed

True while at least one key is held down.

To ask about one particular key, use noteIsDown(). midi.held lists every key held right now, lowest first.

Type
Boolean

Like keyIsPressed, for MIDI keys. False when nothing is held.

Examples

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

function draw() {
  background(noteIsPressed ? 90 : 20);   // lighter while any key is down
}
The background lightens while any key is held.

Related

  • noteIsDown() True while the key n (a MIDI number or a name like 'C4') is held down.
  • note The MIDI number (0 to 127) of the last key pressed.
  • notePressed() You define this function; oav-p5 calls it each time a key (or a pad) goes down.

p5/oav-p5.js, line 326

↑ Back to top · All names