open-audiovisual
Search GitHub

oav-p5 reference · Drum machine and rhythm

OAVp5.drums.strudelUrl#

variableoav-p5
OAVp5.drums.strudelUrl

The rhythm that plays now as a link that opens it at strudel.cc, or an empty string when there is none.

It holds the line as s("…") with setcpm(bpm/4) (one bar here is one Strudel cycle of four beats), the same thing the "Open in Strudel" link on the card opens. Open it in a new tab: window.open(OAVp5.drums.strudelUrl) from a click handler.

Type
String

A https://strudel.cc/#… address, read fresh each time. '' before the machine has loaded.

Examples

jsOpenProcessing ↗
function setup() {
  createCanvas(400, 300);
  startDrums('bd*4, [~ sd]*2, hh*8', 110);
  textAlign(CENTER, CENTER);
}

function mousePressed() {
  if (OAVp5.drums.strudelUrl) window.open(OAVp5.drums.strudelUrl, '_blank');
}

function draw() {
  background(20);
  fill(255);
  text('click to open this rhythm in strudel.cc', width / 2, height / 2 - 15);
  text(OAVp5.drums.strudelUrl.slice(0, 40) + '…', width / 2, height / 2 + 15);
}
Shows the start of the link; a click opens it at strudel.cc in a new tab.

To be confirmed

Not tried: whether the sketch frame of OpenProcessing lets window.open open the link.

Related

  • OAVp5.drums.src The line of rhythm that plays now, such as 'bd*4, [~ sd]*2, hh*8'; an empty string until the machine has loaded.
  • OAVp5.drums.copyText The text the Copy button on the card puts on the clipboard: the rhythm that plays now as a ready startDrums("…", bpm) call.
  • 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.

p5/oav-p5.js, line 1488

↑ Back to top · All names