open-audiovisual
Search GitHub

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

fader1#

variableoav-p5
fader1

Also: fader2 fader3 fader4 fader5 fader6 fader7 fader8

The position of a controller fader (slider), from 0 to 1: fader1 is the first fader, up to fader8.

Works exactly like knob1, for the controller's faders, numbered in the order the controller's profile lists them (as printed on the device). A controller with only four faders, like the MiniLab 3, has fader1 to fader4.

Type
Number
Range
0..1

Changes when the fader moves; 0 until it has moved.

Before it has a value

Nothing to call. Web MIDI is asked for at load, exactly as for a knob (knob1); reading a fader also makes a missing or refused Web MIDI show as a card.

Examples

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

function draw() {
  background(20);
  fill(255);
  rect(40, height - 40, fader1 * (width - 80), 24);   // fader 1 is a level bar
}
A bar that follows fader 1. Plug in a controller, or press 🎹 (bottom right) and use the on-screen one.

Related

  • fader() Returns the position of fader number n, from 0 to 1: the same as fader1 to fader8, for any n.
  • knob1 The position of a controller knob, from 0 to 1: knob1 is the first knob, knob2 the second, up to knob8.
  • faderMoved() You define this function; oav-p5 calls it whenever a fader moves.

p5/oav-p5.js, line 1

↑ Back to top · All names