Nadia Susanto – Project 10 – Sonic Sketch

sketch

// Nadia Susanto
// nsusanto@andrew.cmu.edu
// Section B
// Project-10-Interactive Sonic Sketch


function preload() {
    //loaded image from imgur
    TigerWoodsImg = loadImage("https://i.imgur.com/ETVJsHl.jpg");
    golfhitSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/golfhit.wav");
    tigerRoarSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/tigerroar.wav");
    golfBallCupSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/golfballincup.wav");
    cheeringSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/cheering.wav");
}


function setup() {
    createCanvas(600, 600);
    TigerWoodsImg.resize(600, 600);
    useSound();
}


function soundSetup() { // setup for audio generation
    golfhitSound.setVolume(1);
    tigerRoarSound.setVolume(1);
    golfBallCupSound.setVolume(1);
    cheeringSound.setVolume(1, 3);
}


function draw() {
    background(200);
    image(TigerWoodsImg, 0, 0);
}

function mousePressed() {
    //sound of a golf ball being hit when clicked on the caddy
    if (mouseX > 400 & mouseX < 500 && mouseY > 400) {
        golfhitSound.play();
    }
    else {
        golfhitSound.pause();
    }

    //sound of cheering when clicked on the crowd behind the green
    if (mouseY < 300 & mouseY > 150) {
        cheeringSound.play();
    }
    else {
        cheeringSound.pause();
    }

    //sound of a tiger roar when clicked on Tiger Woods
    if (mouseX < 300 & mouseX > 200 && mouseY > 350) {
        tigerRoarSound.play();
    }
    else {
        tigerRoarSound.pause();
    }

    //sound of a golf ball going in the hole when clicked on flag
    if (mouseX < 330 & mouseX > 300 && mouseY > 250 && mouseY < 320) {
        golfBallCupSound.play();
    }
    else {
        golfBallCupSound.pause();
    }
}

In the spirit of Tiger Woods winning his 82nd PGA Tour win this past weekend, I wanted to use a picture of him at Augusta National for the Masters and incorporate multiple sounds. I included a tiger roar from the animal itself when you click on Tiger Woods, a sound of the golf ball being hit when clicked on Tiger’s caddy on the right, a sound of the crowd cheering when clicked on the many people in the back of the green, and the sound of a golf ball going into the hole when clicked on the yellow flag on the green.

Leave a Reply