pad1#
variableoav-p5pad1Also: pad2 pad3 pad4 pad5 pad6 pad7 pad8 pad9 pad10 pad11 pad12 pad13 pad14 pad15 pad16
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.
Read it like a held mouse button that also knows how hard: if (pad1 > 0) fill(255, 90, 31). Pads are numbered in the order the controller's profile lists them. To react once per hit rather than ask every frame, define padPressed().
- Type
Number- Range
0..1
The velocity of the hit while the pad is held (1 is as hard as the controller sends), and 0 as soon as it is released.
Before it has a value
Nothing to call. Web MIDI is asked for at load, exactly as for a knob (knob1); reading a pad also makes a missing or refused Web MIDI show as a card.
Examples
function setup() {
createCanvas(400, 300);
}
function draw() {
background(20);
fill(255, 90, 31);
circle(width / 2, height / 2, 40 + pad1 * 260); // swells while pad 1 is held
}Related
pad()Returns how hard pad numbernis pressed, 0 to 1: the same aspad1topad16, for anyn.padPressed()You define this function; oav-p5 calls it each time a drum pad is hit.padReleased()You define this function; oav-p5 calls it each time a drum pad is let go.knob1The position of a controller knob, from 0 to 1:knob1is the first knob,knob2the second, up toknob8.