drums#
optionoav-p5?oav_drums=lookahead | frame
How the drum machine is clocked: lookahead (hits scheduled ahead on the audio clock) or frame (moved by animation frames, 0.5's way).
With lookahead, a heartbeat in a Web Worker hands the hits to the audio clock a little ahead of time, so the beat stays steady when frames stutter or the tab is busy, and the sketch is told when each hit is heard. With frame, the machine is moved by the animation frames instead, as it was in oav-p5 0.5. It is the safety net: where the lookahead machine misbehaves, frame brings the old behaviour back, and the timing is then only as steady as the frame rate.
- Type
String- Values
lookahead | frame- default
lookahead
Anything except frame means lookahead.
Notes
OAVp5.drums.clockand the 🩺 check-up say which clock is running.- Set it before oav-p5 loads.
window.OAV_P5 = { drums: … };above the loader line wins, then?oav_drums=…on the page address, then?drums=…on the script's own URL. Values inwindow.OAV_P5are turned into text, so write'off', notfalse. On OpenProcessing the page address takes?sketch_oav_drums=…(the project's README says OpenProcessing forwards it to the sketch).
Examples
window.OAV_P5 = { drums: 'frame' };
function setup() {
createCanvas(400, 300);
startDrums('bd*4, [~ sd]*2, hh*8', 108);
}
function draw() {
background(20);
fill(255);
text('drums: ' + OAVp5.options.drums + ' (clock: ' + OAVp5.drums.clock.clock + ')', 20, 30);
circle(width / 2, height / 2, 50 + env('kick', 0.01, 0.3) * 200);
}Related
drumlatencyHow long it takes a drum hit to be heard after oav-p5 hands it to the audio clock, so pictures land with the sound:autoor milliseconds.startDrums()Starts a drum machine: a 16-step grid on the page that plays a preset, your own grid or one line of rhythm, and counts the bars for your sketch.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.