xxxxxxxxxx
51
let osc;
let currentfrequency;
let x = currentfrequency + 1;
function setup() {
let cnv = createCanvas(400, 400);
cnv.mousePressed(startOscillator);
osc = new p5.Oscillator();
osc.freq();
}
function startOscillator() {
osc.start();
}
function draw() {
background(220);
//print(mouseX, mouseY);
startfrequency = osc.freq;
square(100, 125, 75);
square(100, 200, 75);
square(225, 125, 75);
square(225, 200, 75);
textSize(20);
text("Volume", 240, 100);
text("Pitch", 120, 100);
textSize(16);
text("up", 125, 170);
text("up", 255, 170);
text("down", 125, 250);
text("down", 245, 250);
}
function mousePressed() {
if (mouseX > 100 && mouseX < 175 && mouseY > 125 && mouseY < 200) {
osc.freq();
}
if (mouseX > 100 && mouseX < 175 && mouseY > 200 && mouseY < 275) {
osc.freq();
}
if (mouseX > 200 && mouseX < 300 && mouseY > 125 && mouseY < 200) {
//utputVolume;
}
if (mouseX > 200 && mouseX < 300 && mouseY > 200 && mouseY < 275) {
}
}