open-audiovisual
Search GitHub

oav-p5 reference · Drum machine and rhythm

OAVp5.drums.copyText#

variableoav-p5
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.

Click cells, type a line, find a rhythm you like, and paste this into setup() to keep it. The tempo is the current one, rounded to two decimals.

Type
String

For example startDrums("bd*4, [~ sd]*2, hh*8", 110). Read fresh each time; '' before the machine has loaded.

Examples

jsOpenProcessing ↗
function setup() {
  createCanvas(400, 300);
  startDrums('breakbeat', 120);
  textSize(12);
}

function draw() {
  background(20);
  fill(255);
  text(OAVp5.drums.copyText, 20, 20, width - 40, 200);
}
The line to paste back into setup(); click cells on the grid and it follows.

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.strudelUrl The rhythm that plays now as a link that opens it at strudel.cc, or an empty string when there is none.
  • 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 1496

↑ Back to top · All names