xxxxxxxxxx
32
let abs; // variable here, which is going to keep tracck of all of our beatstep data.
let x = []; // initialize an array with these brackets
let y = [];
function setup() {
createCanvas(400, 400);
abs = new BeatStep("Arturia BeatStep");
for (let i = 0; i < 16; i++) {
x[i] = random(width); // initialize with random width values
y[i] = random(height); // initialize with random height values
}
}
function draw() {
background(0);
for (let i = 0; i < 16; i++) {
let spd = map(abs.dials[i],0,127,-4,4); // midi is 127, range will become 0 - 2;
y[i]+=spd;
circle(x[i], y[i], 20);
if (y[i] >= width && spd > 0) {
y[i] = 0;
}
if (y[i] <= width && spd < 0) {
y[i] = width;
}
}
}