open-audiovisual
Search GitHub

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

padReleased()#

eventoav-p5
function padReleased(n) {}

You define this function; oav-p5 calls it each time a drum pad is let go.

The partner of padPressed(): function padReleased(n) { … }. Without it, a pad calls noteReleased().

Parameters

NameTypeDescription
nNumberWhich pad (1 is the first).

Examples

jsOpenProcessing ↗
let down = {};

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

function padPressed(n) { down[n] = true; }
function padReleased(n) { down[n] = false; }

function draw() {
  background(20);
  fill(255, 90, 31);
  for (let i = 1; i <= 8; i++) if (down[i]) square(10 + (i - 1) * 48, 130, 40);   // lit while held
}
A square per pad, lit from press to release.

Related

  • padPressed() You define this function; oav-p5 calls it each time a drum pad is hit.
  • pad1 How hard a drum pad is pressed, from 0 to 1: pad1 is the first pad, up to pad16; 0 when it is let go.
  • noteReleased() You define this function; oav-p5 calls it each time a key (or a pad) is let go.

p5/oav-p5.js, line 254

↑ Back to top · All names