OAVp5.cc#
variableoav-p5OAVp5.cc
An array of 128 numbers, one per MIDI controller number: where each control last was, 0 to 1. OAVp5.cc[1] is the mod wheel, OAVp5.cc[64] the sustain pedal.
The array version of controlChange(): read any controller in draw() without defining a function. It holds every CC, including the ones that are not a knob or a fader, such as the mod wheel (1), the volume (7) and the sustain pedal (64, which counts as down at 0.5 and above). The MIDI channel is ignored: the latest value of that controller number wins, whichever channel it came on.
- Type
Array<Number>- Range
128 numbers, 0..1 each
The index is the controller (CC) number, 0 to 127; the value is the last one received divided by 127. Changes when a message arrives. 0 before a control has moved, which is not the same as "at 0".
Notes
midi.ccis the same array. The friendly namesknob1andfader1are looked up through the controller's profile and read the same data.
Examples
function setup() {
createCanvas(400, 300);
}
function mouseDragged() {
OAVp5.input([0xB0, 1, constrain(round(mouseX / width * 127), 0, 127)]); // no wheel? drag the mouse
}
function draw() {
background(OAVp5.cc[64] >= 0.5 ? 90 : 20); // sustain pedal down: lighter
circle(width / 2, height / 2, 40 + OAVp5.cc[1] * 300); // mod wheel: size
}Related
controlChange()You define this function; oav-p5 calls it for every MIDI control change (a knob, a fader, the mod wheel, the sustain pedal), whether or not the controller is known.knob1The position of a controller knob, from 0 to 1:knob1is the first knob,knob2the second, up toknob8.fader1The position of a controller fader (slider), from 0 to 1:fader1is the first fader, up tofader8.OAVp5.noteAn array of 128 numbers, one per MIDI key: how hard that key is held, 0 to 1, and 0 when it is up.OAVp5.note[60]is middle C.OAVp5.bendWhere the pitch wheel is, from −1 (all the way down) through 0 (middle) to 1 (all the way up).