Monica Chang – Project 10 – Sonic Sketch

sketch

//Monica Chang
//mjchang@andrew.cmu.edu
//Section D
//Project-10-Sonic-Sketch

function preload() {
    // call loadImage() and loadSound() for all media files here

    //the chalkboard
    classroomURL = "https://i.imgur.com/HudNKW3.png"
    classroom = loadImage(classroomURL);

    // load six sounds for each student
    cough = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/cough.wav");
    giggle = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/giggle.wav");
    sneeze = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/achoo.wav");
    fart = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/fart.wav");
    writing = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/writing.wav");
    sniffles = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/sniffles.wav");
}


function setup() {
    createCanvas(365, 329);

}

function draw() {
    // image of classroom
    background(255, 223, 171);
    image(classroom, 0, 0);

}

function mousePressed() {

    //Play giggle noise when mouse is pressed on female student in the front(with a ponytail)
    if(mouseX > 135 & mouseX < 210 & mouseY > 85 & mouseY < 165){
        cough.play();
    }

    //Play fart noise when mouse is pressed on male student closer to the teacher
    if(mouseX > 53 & mouseX < 120 & mouseY > 135 & mouseY < 245){
        fart.play();
    }
    //Play writing sounds when mouse is pressed on female student with black hair(no ponytail)
    if(mouseX > 210 & mouseX < 285 & mouseY > 124 & mouseY < 200){
        writing.play();
    }
    //Play giggle sound when mouse is pressed on female student with a bun
    if(mouseX > 113 & mouseX < 186 & mouseY > 187 & mouseY < 270){
        giggle.play();
    }
    //Play sneeze noise when mouse is pressed on male student in the back
    if(mouseX > 280 & mouseX < width & mouseY > 155 & mouseY < 260){
        sneeze.play();
    } 
    //Play sniffling noise when mouse is pressed on female student in the back(with a ponytail)
    if(mouseX > 170 & mouseX < 250 & mouseY > 228 & mouseY < 310) {
        sniffles.play();
    }
}

For this project, I used an image of a classroom and further integrated sounds you would typically hear in a class setting(besides the farting noise) via the students. The sounds I used were: farting, sniffling, coughing, writing, giggling and sneezing.

Leave a Reply