OAVp5.drums.src#
variableoav-p5OAVp5.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.
Show it on the canvas so a recording has it (text(OAVp5.drums.src, 20, 30)), or keep it to come back to the rhythm later with startDrums(src). rhythmChanged() tells you when it changes, and OAVp5.drums.copyText is the same line wrapped in a startDrums("…") call.
- Type
String
Read fresh each time. A preset or a grid you drew shows as the line it is written as, and it changes with every click on a cell and every typed edit.
Before it has a value
It is '' until startDrums() has loaded the machine and the rhythm module, a fraction of a second.
Examples
function setup() {
createCanvas(400, 300);
startDrums('half time', 100);
textAlign(CENTER, CENTER);
}
function draw() {
background(20);
fill(255);
text(OAVp5.drums.src || 'loading…', width / 2, height / 2);
}Related
OAVp5.drums.patternWhat the drum machine plays, as a name: the preset's name,'custom'for a grid, or the line of rhythm itself.OAVp5.drums.copyTextThe text the Copy button on the card puts on the clipboard: the rhythm that plays now as a readystartDrums("…", bpm)call.OAVp5.drums.edit()Plays a line of rhythm as if it was typed on the card, and returns whether it worked and, if not, what is wrong with it.rhythmChanged()An event you define: it is called with the new line of rhythm every time the rhythm changes.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.