The spacebar starts it. The up arrow speeds it up to a rate of 2. The left arrow put it to normal or the rate of 1. The down arrow slows it down to the rate of 0.5.
xxxxxxxxxx
// 1. Declare the variable
// 2. Assign it a value
// 3. Use the variable
// 4. Update the variable
let BackToYourPlace
function preload(){
BackToYourPlace = loadSound("BackToYourPlace.mp3")
}
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
}
function keyPressed(){
if (key == " "){
BackToYourPlace.play();
}
if (keyCode == UP_ARROW){
BackToYourPlace.rate(2)
}
if (keyCode == LEFT_ARROW){
BackToYourPlace.rate(1)
}
if (keyCode == DOWN_ARROW){
BackToYourPlace.rate(0.5)
}
}