xxxxxxxxxx
36
function setup() {
noCanvas();
noLoop();
let osc = [
new p5.Oscillator('sine'),
new p5.Oscillator('sine'),
new p5.Oscillator('sine')
]
osc[0].amp(0.3);
osc[1].amp(0.3);
osc[2].amp(0.3);
chord(osc, 440, 523, 659)
setTimeout(()=>stop(osc), 500);
}
function chord(osc, f1, f2, f3) {
osc[0].freq(f1);
osc[1].freq(f2);
osc[2].freq(f3);
osc[0].start();
osc[1].start();
osc[2].start();
}
function stop(osc) {
osc[0].stop();
osc[1].stop();
osc[2].stop();
}
function draw() {
}