xxxxxxxxxx
31
var song;
var sliderRate;
var sliderPan;
// function preload(){
// song= loadSound("sound2.mp3");
// }
function setup() {
createCanvas(400, 400);
song= loadSound("sound2.mp3",loaded);
song.setVolume(0.5);
sliderRate=createSlider(0,3,1,0.01);
sliderPan=createSlider(-1,1,0,0.01);
// song.play();
song.setVolume(0.1);
}
function loaded(){
song.play();
}
function togglePlaying(){
song.play();
}
function draw() {
background(220);
song.pan(sliderPan.value()); //left-right speaker
song.rate(sliderRate.value()); //speed
}