OAVp5#
objectoav-p5OAVp5Also: midi oavMidi
The object oav-p5 hangs everything on: MIDI state, the panel, the microphone, the clock, the check-up. midi and oavMidi are the same object.
It is there as soon as oav-p5 has loaded, in setup() and draw() alike. The plain names of the p5 style (knob1, note, micLevel) are the easy way in. OAVp5 is the way in when you want more: the raw MIDI state (OAVp5.note, OAVp5.cc, OAVp5.bend, OAVp5.held, OAVp5.last), subscriptions (OAVp5.on()), a way to send bytes (OAVp5.input()), the microphone's numbers (OAVp5.mic), the external clock (OAVp5.clock), the link (OAVp5.link), the values over time (OAVp5.chop) and the check-up (OAVp5.check()).
Three names, one object. OAVp5 is always there. oavMidi is always there too. midi is there unless the page already had a midi of its own, in which case it is left alone and the console says to read OAVp5 instead. OAVp5.options holds the loading options as oav-p5 read them: OAVp5.options.mic, and so on for each of the loading options (for example mic).
Before it has a value
Only the loader line. If it has not loaded, OAVp5 is not defined, and a sketch that reads it stops with "OAVp5 is not defined".
Notes
midiandoavMidiare the same object under other names.
Examples
function setup() {
createCanvas(400, 300);
}
function draw() {
background(20);
fill(255);
text('same object: ' + (OAVp5 === midi && OAVp5 === oavMidi), 20, 30);
text('version: ' + OAVp5.version, 20, 60);
text('MIDI hardware: ' + OAVp5.hardware, 20, 90);
text('microphone: ' + OAVp5.mic.state, 20, 120); // reading the state does not start it
text('external clock: ' + OAVp5.clock.info.state, 20, 150);
}Related
OAVp5.versionThe version of oav-p5 that loaded, as text such as'0.8.0'.OAVp5.on()Listens to a MIDI event by name without defining a global function, and returns a function that stops listening.OAVp5.input()Sends one MIDI message into oav-p5 by hand, as bytes: the whole sketch reacts as if a controller had sent it.OAVp5.check()Runs the 🩺 check-up: the version, page, browser, microphone, MIDI, sound, drums, recording, wiring and hints, as a card to screenshot and as an object.OAVp5.micThe microphone under the plain names: its state, the numbers ofmicLevelandbassthat never turn it on when read, the raw loudness, start, stop and events.OAVp5.clockWhat oav-p5 hears of an external MIDI clock: its state, tempo and where it is in the bar. Nothing until another program or device starts sending one.OAVp5.chopThe CHOP functions under one roof, plus the state of the module behind them:OAVp5.chop.lag(…),.state,.slots(),.reset().