xxxxxxxxxx
let osc;
function setup() {
createCanvas(400, 400);
osc = new p5.Oscillator();
osc.freq(220);
osc.setType('sawtooth');
osc.amp(0.5);
osc.start();
}
function draw() {
}
function mousePressed() {
if (osc.started) {
osc.stop();
}
else {
osc.start();
}
}