xxxxxxxxxx
26
let osc;
function setup() {
let cnv = createCanvas(400, 400);
background(180);
text("Click to start",20,20)
cnv.mousePressed(startOscillator);
osc = new p5.Oscillator();
}
function startOscillator() {
osc.start();
}
function mousePressed(){
background(180);
text("<- PITCH ->",width/3,20)
text(" ^ ",0,height/2-10)
text("VOLUME",0,height/2)
text(" v ",0,height/2+10)
}
function mouseMoved(){
osc.freq(map(mouseX,0,width,100,1200))
outputVolume(map(mouseY,0,height,1,0))
}