open-audiovisual
Search GitHub

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

noteReleased()#

eventoav-p5
function noteReleased(note) {}

You define this function; oav-p5 calls it each time a key (or a pad) is let go.

The partner of notePressed(), like keyReleased() to keyPressed():

js
function noteReleased(note) {
  // a key came up
}

Parameters

NameTypeDescription
noteNumberThe MIDI number of the key that was released.

Examples

jsOpenProcessing ↗
let held = {};

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

function notePressed(note) { held[note] = millis(); }
function noteReleased(note) { delete held[note]; }

function draw() {
  background(20);
  fill(255);
  text(Object.keys(held).map((n) => noteName(+n)).join('  '), 20, 40);   // the keys down now
}
Lists the names of the keys that are down right now.

Related

  • notePressed() You define this function; oav-p5 calls it each time a key (or a pad) goes down.
  • padReleased() You define this function; oav-p5 calls it each time a drum pad is let go.
  • noteOff() You define this function; oav-p5 calls it for every MIDI note-off, with the key and the channel.
  • noteIsDown() True while the key n (a MIDI number or a name like 'C4') is held down.

p5/oav-p5.js, line 254

↑ Back to top · All names