OAVp5.drums.clock#
objectoav-p5OAVp5.drums.clock
How the drum machine keeps time: which clock moves it, how far ahead it schedules and how long the callbacks wait for the speakers.
This is the diagnostic behind the 🩺 check-up. When drum hits feel late or early, look here first: the handbook puts a Bluetooth speaker at 0.15 to 0.25 seconds of latency, and ?oav_drumlatency=200 sets it by hand. late, skipped, warning and why are further notes the check-up reads.
- Type
Object- Range
{ clock, heartbeat, lookahead, latency, audio, extended, preDraw, … }
A new object on every read. clock is 'lookahead' (hits are handed to the audio clock ahead of time, the default) or 'frame' (moved by the frames, the drums option). heartbeat is 'worker' (a Web Worker wakes it every 25 ms), 'interval' (the fallback), 'frame' with the frame clock, or 'none' before the machine exists. lookahead is the seconds scheduled ahead and extended is true when a slow draw() made it look further ahead. latency is the seconds the callbacks wait for the output of the speakers, audio whether the kit's audio clock is running, and preDraw the p5 hook that delivers the callbacks right before draw().
Examples
function setup() {
createCanvas(400, 300);
startDrums('four on floor', 120);
textSize(14);
}
function draw() {
background(20);
fill(255);
const c = OAVp5.drums.clock;
text('clock: ' + c.clock + ' (' + c.heartbeat + ')', 20, 30);
text('lookahead: ' + c.lookahead + ' s', 20, 60);
text('latency: ' + c.latency + ' s', 20, 90);
text('hook before draw: ' + (c.preDraw || 'none'), 20, 120);
}To be confirmed
What exactly late, skipped, warning and why count was not checked.
Related
OAVp5.drumsThe object behind the drum names: the state of the machine, its counters, the line of rhythm, its history and the loaded machine.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.drumPhaseHow far through the current bar the drum machine is, smoothly from 0 up to just below 1, as it is heard.