Sound Test

Sound Test

type 1 2 3 4 to sketch to play sounds

playfour

var one, two, three, four;


function preload() {
    one = loadSound("https://courses.ideate.cmu.edu/15-104/f2017/wp-content/uploads/2017/12/one.wav");
    two = loadSound("https://courses.ideate.cmu.edu/15-104/f2017/wp-content/uploads/2017/12/two.wav");
    three = loadSound("https://courses.ideate.cmu.edu/15-104/f2017/wp-content/uploads/2017/12/three.wav");
    four = loadSound("https://courses.ideate.cmu.edu/15-104/f2017/wp-content/uploads/2017/12/four.wav");
}


function setup() {
    createCanvas(200, 200);
    background(200);
}

function keyPressed() {
    print("" + keyCode);
    if (keyCode == 49) one.play();
    else if (keyCode == 50) two.play();
    else if (keyCode == 51) three.play();
    else if (keyCode == 52) four.play();

}