OAVp5.drums.pattern#
variableoav-p5OAVp5.drums.pattern
What the drum machine plays, as a name: the preset's name, 'custom' for a grid, or the line of rhythm itself.
After startDrums('breakbeat') it is 'breakbeat', after startDrums({ kick: 'x...x...x...x...' }) it is 'custom', and after startDrums('bd*4, hh*8') it is that line. A click on a cell of a preset makes it 'custom'. To get the line of rhythm in every case, read OAVp5.drums.src: a preset also has one.
- Type
String
'four on floor' until you choose another. It follows what plays, including clicks on the grid.
Examples
function setup() {
createCanvas(400, 300);
startDrums('breakbeat', 110);
textAlign(CENTER, CENTER);
textSize(24);
}
function draw() {
background(20);
fill(255);
text(OAVp5.drums.pattern, width / 2, height / 2);
}Related
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.drums.srcThe line of rhythm that plays now, such as'bd*4, [~ sd]*2, hh*8'; an empty string until the machine has loaded.rhythmChanged()An event you define: it is called with the new line of rhythm every time the rhythm changes.