OAVp5.bend#
variableoav-p5OAVp5.bend
Where the pitch wheel is, from −1 (all the way down) through 0 (middle) to 1 (all the way up).
Read it in draw() like a knob that goes both ways: x = width / 2 + OAVp5.bend * 150. MIDI sends the position as 14 bits (0 to 16383, with 8192 in the middle). oav-p5 maps the two halves to −1..0 and 0..1, so full travel reaches exactly −1 and 1. To be told on every movement, define pitchBend().
- Type
Number- Range
-1..1
Changes when the wheel moves. 0 before it has moved, and again when a spring-loaded wheel returns to the middle.
Notes
midi.bendis the same number. There is no plainbendvariable.
Examples
function setup() {
createCanvas(400, 300);
}
function mouseDragged() {
OAVp5.input([0xE0, 0, constrain(round(mouseX / width * 127), 0, 127)]); // no wheel? drag the mouse
}
function draw() {
background(20);
circle(width / 2 + OAVp5.bend * 150, height / 2, 50); // wheel up: right, wheel down: left
text('bend ' + nf(OAVp5.bend, 1, 2), 20, 30);
}Related
pitchBend()You define this function; oav-p5 calls it whenever the pitch wheel moves, with its position from −1 to 1.OAVp5.ccAn 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.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.