xxxxxxxxxx
20
let osc;
function setup() {
createCanvas(400, 400);
osc = new p5.Oscillator();
osc.start();
}
function draw() {
background(220);
let pitch = map(mouseX, 0, width, 200, 800);
pitch = constrain(pitch, 200, 800);
osc.freq(pitch);
let vol = map(mouseY, 0, height, 1, 0, true);
osc.amp(vol);
rect(width / 2 - 25, mouseY, 50, height - mouseY);
}