Caroline Song – Project 10 – Sonic Sketch

sketch

//Caroline Song
//chsong@andrew.cmu.edu
//Section E
//Project 10 - Sonic Sketch

var crashCymbal;
var rideCymbal;
var bassDrum;
var highTom;
var midTom;

function preload() {
    // call loadImage() and loadSound() for all media files here
    crashCymbal = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/cymbals_1.wav");
    rideCymbal = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/ridecymbal.wav");
    bassDrum = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/bassdrum.wav");
    highTom = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/hightomdrum.wav");
    midTom = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/midtomdrum.wav");
}


function setup() {
    createCanvas(550, 420);
}


function draw() {
    background("pink");

    //drawing right cymbal stand
    push();
    strokeWeight(3)
    line(420, 75, 495, height/2);
    line(495, height/2, 450, 350);
    line(450, 350, 485, 380);
    line(450, 350, 450, 380);
    line(450, 350, 415, 380);
    pop();

    //drawing right cymbal
    push();
    fill(255, 218, 130);
    noStroke();
    translate(420, 75);
    rotate(10/3);
    ellipse(0, 0, 150, 30);
    pop();

    //drawing left cymbal stand
    push();
    strokeWeight(3);
    line(120, 75, 45, height/2);
    line(45, height/2, 90, 350);
    line(90, 350, 55, 380);
    line(90, 350, 90, 380);
    line(90, 350, 125, 380);

    //drawing left cymbal
    push();
    fill(255, 218, 130);
    noStroke();
    translate(120, 75);
    rotate(-10/3);
    ellipse(0, 0, 150, 30);
    pop();

    //drawing middle (bass) drum
    push();
    fill(191, 6, 0);
    noStroke();
    ellipse(width/2 - 15, 280, 200, 200);
    fill(240);
    ellipse(width/2 - 15, 280, 170, 170);
    fill(0);
    rect(width/2 + 65, 280, 25, 10);
    rect(width/2 - 15, 280 + 80, 10, 25);
    rect(width/2 - 120, 280, 25, 10);
    pop();


    //drawing top left drum
    push();
    fill(191, 6, 0);
    noStroke();
    translate(168, 160);
    rotate(10/3);
    rect(-45, -45, 89, 60);
    pop();

    push();
    fill(191, 6, 0);
    noStroke();
    translate(171, 145);
    rotate(10/3);
    ellipse(0, 0, 90, 30);
    pop();

    push();
    fill(240);
    noStroke();
    translate(160, 200);
    rotate(10/3);
    ellipse(0, 0, 90, 30);
    pop();

    //drawing top right drum
    push();
    fill(191, 6, 0);
    noStroke();
    translate(350, 160);
    rotate(-10/3);
    rect(-45, -45, 89, 60);
    pop();

    push();
    fill(191, 6, 0);
    noStroke();
    translate(348, 145);
    rotate(-10/3);
    ellipse(0, 0, 90, 30);
    pop();

    push();
    fill(240);
    noStroke();
    translate(358, 200);
    rotate(-10/3);
    ellipse(0, 0, 90, 30);
    pop();

}

function mousePressed() {
    //crash cymbal sound when clicking on right cymbal
    if(mouseX > 345 & mouseX < 495 && mouseY > 55 && mouseY < 95){
       crashCymbal.play();
   }

   //ride cymbal sound when clicking on left cymbal
   if(mouseX > 40 & mouseX < 190 && mouseY > 55 && mouseY < 95){
       rideCymbal.play();
   }

   //bass drum sound when clicking on middle drum
   if(mouseX > 160 & mouseX < 350 && mouseY > 180 && mouseY < 370){
       bassDrum.play();
   }

   //high tom sound when clicking on right small drum
   if(mouseX > 310 & mouseX < 400 && mouseY > 130 && mouseY < 210){
       highTom.play();
   }

   //mid tom sound when clicking on left small drum
   if(mouseX > 50 & mouseX < 200 && mouseY > 130 && mouseY < 210){
        midTom.play();
   }
}

I had a lot of fun creating this sonic sketch. For this project, I wanted to create a simplified drum set using 5 sounds. When clicking on the different drums and cymbals, the different sounds, in accordance to what the drum or cymbal is, will play.

The bass drum sound will activate when clicking on the middle/ biggest drum

The high tom sound will activate when clicking on the high tom drum (the right small drum)

The low tom sound will activate when clicking on the low tom drum (the left small drum)

The crash cymbal sound will activate when clicking on the right cymbal

The ride cymbal sound will activate when clicking on the left cymbal

Ghalya Alsanea – Project-10 – Sonic Sketch

Unlikely pairings

To play or stop a sound, simply click inside the corresponding circle.

sketch

//Ghalya Alsanea
//galsanea@andrew.cmu.edu
//Section B
//Project 10

var amplitude;          //global amp variable
var defaultSize = 50;   //size of circles if nothing is playing

//compile titles into array for easy access
var titles =
["alien", "bass", "chirp", "snare",
"marimba", "piano", "synth", "hop"];

//have a callerID for the dif sounds for easy access
var callIDs = [];

//X location of all the circles
var xLoc = [];

//set starting booleans for dif sounds
let alienBool = false;
let bassBool = false;
let chirpBool = false;
let kickSnareBool = false;
let marimbaBool = false;
let pianoBool = false;
let synthBool = false;
let hopBool = false;

//store all booleans in an array for easy access
var bools = [alienBool,     bassBool,   chirpBool,  kickSnareBool,
            marimbaBool,    pianoBool,  synthBool,  hopBool]

function preload() {
    //load all sound files
    alienBass = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/alien-bass-loop.wav");
    bassLoop = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/bass-loop.wav");
    chirp = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/electricbirdchirp.wav");
    kickSnare = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/kick-snare-loop.wav");
    marimba = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/marimba-loop.wav");
    piano = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/piano-loop.mp3");
    synth = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/synth-142.wav");
    hop = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/trip-hop.wav");
}

function setup() {
    createCanvas(600, 150);
    useSound();
    amplitude = new p5.Amplitude();
    //assign IDs to each sound
    callIDs = [alienBass, bassLoop, chirp, kickSnare, marimba, piano, synth, hop];
    for (var i = 0; i < callIDs.length; i++) {
        callIDs[i].stop();          //start with no sound
        callIDs[i].setLoop(true);   //make sure it plays a continous loop
        xLoc.push(i * 75 + 37.5);   //assign x location based on ID index
    }
}

function draw() {
    //function call for rendering the circles
    renderCircs();
}

function renderCircs () {
    background(0);
    for (var i = 0; i < callIDs.length; i++) {
        //if the sound is playing, draw as red
        //otherwise render as white
        if (bools[i] === true) {
            fill('red');
        } else {
            fill(255);
        }

        //render circle and text
        circle(xLoc[i], height / 2, figureSize(bools[i]));
        textSize(15);
        textFont("Arial");
        textAlign(CENTER);
        text(titles[i], xLoc[i], height - 30);
    }
}

//configure diameter of circle based on volume
function figureSize(a) {
    //if the sound is playing, assign a size respectively
    if (a === true) {
        let level = amplitude.getLevel();
        let size = floor(map(level, 0, 1, 50, 70));
        return size;
    }
    //if no sound is playing then have the default size
    else {
        return defaultSize;
    }
}

//configure whether to play the sound or stop based on boolean
function soundState(ind) {
    if (bools[ind] === true) {
        callIDs[ind].play();
    } else if (bools[ind] === false) {
        callIDs[ind].stop();
    }
}

//state change when mouse is clicked
function mousePressed() {
    for (var i = 0; i < xLoc.length; i++) {
        //check where the mouse was clicked
        var d = dist(mouseX, mouseY, xLoc[i], height / 2);
        //if it's within one of the circles, then toggle sound state
        if (d < figureSize(bools[i]) / 2) {
            bools[i] = !bools[i];
            soundState(i);
        }
    }
}

function soundSetup() {
    //nothing here
}

For this project, I wanted to create something similar to a looping machine where you have different sounds and you can play them together and start and stop certain loops based on creative desire. I wanted the user to be in control of what’s being played and express themselves through sound. The 8 sounds I chose have the ability to be looped continuously and smoothly. The sounds sometimes work together and sometimes don’t, and the idea behind that is to see what music you can come up with using an unlikely pairing of sounds. Have fun and see what you come up with!

Hyejo Seo-Project 10 – Sonic Sketch


sketch

When I was brainstorming about what to do for this project, it happened to be pouring outside with thunder and lightening (yesterday). Hence, I decided to create this cozy night starter pack on rainy days. Since I created my background image on Illustrator, I had to define each icon by using rect() function. This was just for myself to write the conditional functions. Overall, I am happy with my work. 

/*
Hyejo Seo
Section A
hyejos@andrew.cmu.edu
Project 10 - Sonic Sketch 
*/
var backgroundPic;
var rainSound;
var thunderSound;
var kettleSound;
var matchesSound;

function preload() {
    // loading my background image
    var backgroundURL = "https://i.imgur.com/pIas40A.jpg";
    backgroundPic = loadImage(backgroundURL);
    // loading the sound files 
    rainSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/rain.wav");
    rainSound.setVolume(1);
    thunderSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/thunder.wav");
    thunderSound.setVolume(1);
    kettleSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/kettle.wav");
    kettleSound.setVolume(1);
    matchesSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/10/matches.wav");
    matchesSound.setVolume(1);

}
function setup() {
    createCanvas(500, 400);
    backgroundPic.resize(500, 400); // resizing my background picture to fit the canvas
    // useSound();

}

function draw() {
    image(backgroundPic, 0, 0); 
    noFill();
    stroke(255, 248, 240);
    strokeWeight(2);
    // Thunder cloud area
    rect(3, 4, 223, 130);
    // Rain cloud area
    rect(285, 18, 215, 110);
    // Candles area
    rect(5, 240, 220, 155);
    // Tea area
    rect(310, 295, 137, 95);
}

function mousePressed() {
    // thunder sound conditional statement 
    if(mouseX > 3 & mouseX < 226 && mouseY < height / 2){
        if(thunderSound.isLooping()){
            thunderSound.pause();
        } else {
            thunderSound.loop();

        }
    }
    // rain sound conditional statement 
    if(mouseX > 285 & mouseX < 500 && mouseY < height / 2){
            if(rainSound.isLooping()){
                rainSound.pause();
        } else {
            rainSound.loop();
        }
    }


    // candle sound conditional statement 
    if(mouseX > 5 & mouseX < 225 && mouseY > height / 2){
        if(matchesSound.isLooping()){
            matchesSound.pause();
        } else {
        matchesSound.loop();
        }
    }

    // kettle sound conditional statement 
    if(mouseX > 310 & mouseX < 447 && mouseY > height / 2){
        if(kettleSound.isLooping()){
            kettleSound.pause();
        } else {
        kettleSound.loop();
        }
    }
}

Ellan Suder Project 10: Interactive Sonic Sketch

When you click the program, it generates a random cat and plays the corresponding sound. At first I tried putting all the sound links in an array and using sound = loadImage(catSounds[randomCat]); like I did with the cat images, but it didn’t load fast enough and I ended up needing to load every sound at the beginning manually.

happy halloween!

var catLinks;
var catSounds;
var catInd;

function preload() {
    angrySound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/es_angrymeow.wav");
    regularSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/es_meow.wav");
    scaredSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/es_hiss.wav");
    happySound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/es_purr.wav");
    
    angrySound.setVolume(1);
    regularSound.setVolume(1);
    scaredSound.setVolume(1);
    happySound.setVolume(1);

    catSounds = [
    angrySound,
    regularSound,
    scaredSound,
    happySound];

    catLinks = [
    "https://i.imgur.com/NxERNed.png", //angry
    "https://i.imgur.com/OX62vqE.png", //regular
    "https://i.imgur.com/uba4Kxv.png", //scared
    "https://i.imgur.com/pZwffK9.png"]; //happy
    
    //chooses random array number
    randomCat = floor(random(catLinks.length));
    //loads random cat image from array
    cat = loadImage(catLinks[randomCat]);
}


function setup() {
    createCanvas(300, 300);
}

function draw() {
    background(255, 90, 0);
    image(cat,0,0);
}

function mousePressed() {
    //catInd records last randomCat array number
    catInd=randomCat;
    //If array number is same, pick new one. 
    //Don't show same cat in a row.
    while(randomCat==catInd)
    {
      randomCat = floor(random(catLinks.length));
    }

    cat = loadImage(catLinks[randomCat]);
    catSounds[randomCat].play();
}

Paul Greenway – Project 10 – Sonic Sketch

pgreenwa_sonic_sketch

// Paul Greenway
// pgreenwa
// pgreenwa@andrew.cmu.edu
// Project-10-Sonic Sketch


let osc;

function preload() {

  
    //load sound files
  
    mySnd1 = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/boop.wav");
    mySnd1.setVolume(0.2);
  
    mySnd2 = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/alert.wav");
    mySnd2.setVolume(0.5);
  
    mySnd3 = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/alertHigh.wav");
    mySnd3.setVolume(0.5);
  
    mySnd4 = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/bump.wav");
    mySnd4.setVolume(0.5);
    
}


function setup() {
  
    createCanvas(640, 480);
  
    //set frequency and amplitude
  
    osc = new p5.TriOsc(); 
    osc.amp(0.5);

 
    osc.start();
  
}

function soundSetup() {
    
    myOsc = new p5.Tri0sc();
    
    myOsc.freq(800.0);
  
    myOsc.start();
    myOsc.freq(400); 
}

function draw() {
  
    background(170, 190, mouseY);
    noStroke();
    
    let maxX = constrain(mouseX, 0, width-mouseX);
  
    // left circles 

    fill(170, 190, mouseY);
    //rotate(radians(angle));
    square(maxX, 0, mouseX/2, mouseY/5);
  
    fill(mouseY, 190, 200);
    //rotate(radians(angle));
    square(maxX, 50, mouseX/2, mouseY/5);
  
    fill(170, 190, mouseY);
    //rotate(radians(angle));
    square(maxX, 100, mouseX/2, mouseY/5);
  
    fill(mouseY, 190, 200);
    //rotate(radians(angle));
    square(maxX, 150, mouseX/2, mouseY/5);
  
    fill(170, 190, mouseY);
    //rotate(radians(angle));
    square(maxX, 200, mouseX/2, mouseY/5);
  
    fill(mouseY, 190, 200);
    //rotate(radians(angle));
    square(maxX, 250, mouseX/2, mouseY/5);
  
    fill(170, 190, mouseY);
    //rotate(radians(angle));
    square(maxX, 300, mouseX/2, mouseY/5);
  
    fill(mouseY, 190, 200);
    //rotate(radians(angle));
    square(maxX, 350, mouseX/2, mouseY/5);
  
    fill(170, 190, mouseY);
    //rotate(radians(angle));
    square(maxX, 400, mouseX/2, mouseY/5);
  
    fill(mouseY, 190, 200);
    //rotate(radians(angle));
    square(maxX, 450, mouseX/2, mouseY/5);
  
  
  
    // play sound effects at canvas borders
      
    if (mouseY > 470) {
    
        mySnd2.play();
    }
  
    if (mouseY < 10) {
    
        mySnd3.play();
    }
  
    if (mouseX < 10) {
    
        mySnd4.play();
    }
  
    if (mouseX > 630) {
    
        mySnd4.play();
    }
  
    //modulate sound while mouse is moving
  
    let freq = map(mouseX, 0, width, 40, 880);
    osc.freq(freq);

    let amp = map(mouseY, 0, height, 1, 0.01);
    osc.amp(amp);
  
}


For this project, I used my project 3 dynamic drawing as a starting point. I then decided to use sound effects based on the mouse position on the canvas. The user is able to control the frequency of the base sound with the mouse and can also trigger different sound effects at each border of the canvas.

Jina Lee – Project 10

sketch

// Jina Lee
// jinal2@andrew.cmu.edu
// Section E
// Project 10
var x = 0;
var cloudmove = 1;
var boathorn;
var seagulls;
var wave;
var help;

function preload() {
    help = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/help.wav");
    boathorn = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/boathorn.wav");
    seagulls = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/seagulls.wav");
    waves = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/waves.wav");
}


function setup() {
    createCanvas(480, 480);
    background(173, 216, 230);
}

function draw() {

    cloudDraw();
    //person
    noStroke();
    fill(226, 63, 41);
    ellipse(300, 200, 15, 40);
    fill(229, 194, 152);
    ellipse(300, 170, 20, 20);
    //flag
    fill(255);
    triangle(200, 100, 200, 130, 250, 115);
    stroke(0);
    strokeWeight(5);
    line(200, 100, 200, 300);
    //boat
    noStroke();
    fill(101, 67, 33);
    arc(250, 200, 350, 400, 0, PI, TWO_PI);
    fill(150);
    rect(150, 170, 30, 30);
    arc(165, 160, 50, 50, 0, PI, TWO_PI);
    //waterwaves
    fill(0, 143, 198);
    rect(0, 320, width, 160);
    for (var i = 0; i < 700; i += 30) {
        push();
        translate(-200 * 1, 0);
        fill(0, 143, 198);
        triangle(i, 320, i + 20, 290, i + 40, 320);
        pop();
    }
}

function cloudDraw() {
    noStroke();
    //sky color
    fill(173, 216, 230);
    rect(0, 0, width, height/2);
    //cloud color
    fill(230);
    //cloud move
    x = x + cloudmove;
    if(x >= width + 10){
        x = 0;
    }
    //cloud parts and drawing multiple clouds in sky section
    for (i = 0; i <= 10; i++) {
        push();
        translate(-200 * i, 0);
        ellipse(x + 10, height / 4, 50, 50);
        ellipse(x + 50, height / 4 + 5, 50, 50);
        ellipse(x + 90, height / 4, 50, 40);
        ellipse(x + 30, height / 4 - 20, 40, 40);
        ellipse(x + 70, height / 4 - 20, 40, 35);
        pop();
    }
}


function mousePressed(){
    // when you press the grey horn
    // then a boat horn will start playing
    var b = dist(mouseX, mouseY, 150, 170);
    if (b < 50) {
        boathorn.play();
    }
    // when you press the person
    // the person shouts for help
    var d = dist(mouseX, mouseY, 300, 170);
    if (d < 20) {
        help.play();
    }
    // when you press the ocean
    // the waves start playing
    if (mouseX > 0 & mouseX < width && mouseY > 320 && mouseY < height) {
        waves.play();
    }
    // when you press the sky
    // seagulls will start chirpping
    if (mouseX > 0 & mouseX < width && mouseY > 0 && mouseY < 320) {
        seagulls.play();
    }
}

For this week, I wanted to create a person lost at sea. When you press the sky, you will hear seagulls everywhere. When you click on the person’s head, you can hear him saying “help, help.” When you press the water, you will hear the ocean waves. When you press the grey horn, you will hear a boat horn go off.

Nawon Choi— Project 10 Sonic Sketch


sketch

Clicking on the red balloon will expand it, until it pops and returns back to its original size. Clicking on the top or bottom half will play different types of background music.

I had fun playing around with the whimsical visualizations and sounds, as well as the interactive visual and audio elements.

// Nawon Choi
// Section C
// nawonc@andrew.cmu.edu
// Project 10 Sonic Sketch

var s = 50;
// balloon coordinates
var balloonY = 200;
var balloonX = 200;
// balloon width & height
var bw;
var bh;

function preload() {
    p = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/pop-1.wav");
    p.setVolume(0.5);

    air = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/air.wav");
    air.setVolume(0.5);

    // top bgm
    bgm = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/background.wav");
    bgm.setVolume(0.5);
    // bottom bgm
    bgm2 = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/bgm2.wav");
    bgm2.setVolume(0.5);

}


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


function soundSetup() { // setup for audio generation
    // you can replace any of this with your own audio code:
    osc = new p5.TriOsc();
    osc.freq(880.0);
    osc.amp(0.1);
    // osc.start();

    bgm.amp(0);
    bgm2.amp(0);
    bgm.play();
    bgm2.play();
}


function draw() {
    background("#FFDC73");
    fill("#FFBF00");
    rect(0, 200, 400, 200);


    // balloon
    strokeWeight(5);
    stroke("white");
    line(balloonX, height, balloonX, balloonY);


    bw = s + 25;
    bh = s + 50;
    noStroke();
    fill("#eb3713");
    ellipse(balloonX, balloonY, bw, bh);
    // triangle(100, 135, 110, 150, 90, 150);

}

function mousePressed() {
    // balloon grows when clicked
    var xdist = bw / 2;
    var ydist = bh / 2;
    if (mouseX > (balloonX - xdist) & mouseX < (balloonX + xdist)) {
        if (mouseY > (balloonY - ydist) && mouseY < (balloonY + ydist)) {
            if (s >= 50 && s < 100) {
                air.play();
                s += 10;
            } else if (s >= 100) {
                // balloon pops and resets
                p.play();
                s = 50;
            }
        }
    }

    // play different bgm based on top or bottom half click
    if (mouseY < 200) {
        bgm.amp(1);
        bgm2.amp(0);
        
    } else if (mouseY > 200) {
        bgm.amp(0);
        bgm2.amp(1);
    } 
}

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.

Joseph Zhang – Project 10 – Sonic Sketch

sketch

// Joseph
// Section E
// Project 10 - Sonic 

var px, py;
var diam = 30;
var distance = 20;
var count = 0;

//load sounds
function preload() {
    up = loadSound('https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/up.wav');
    right = loadSound('https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/right.wav');
    left = loadSound('https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/left.wav');
    down = loadSound('https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/down.wav');
    warningSound = loadSound('https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/warning.wav');
}

function setup() {
    // you can change the next 2 lines:
    createCanvas(400, 400);
    px = width/2;
    py = height/2;
    dx = 0;
    dy = 0;
    useSound();
}

// for some reason wont work if not included
function soundSetup() {
}

function draw() {
    background(200, 220, 250);

    //red background - DANGER
    if(px < 50 || px > 350 || py < 50 || py > 350){
        background('red');
        fill('black');
        text("COME BACK!", width / 2 - 40, height / 2);
    }
    //blue background - SAFE
    else {
        background(200, 220, 250);
        fill('black');
        text("DON'T CROSS THE LINE ;)", width / 2, 30);
    }

    //creating movable circle, square boundary, and directions

    if(count === 0){
        text('UP / DOWN / LEFT / RIGHT ARROWS TO MOVE', 67, height - 20);
    }

    rectMode(CENTER);
    noFill();
    rect(width/2, height/2, 300, 300);


    //change color if inside/outside of boundary box
    if(px > 350 || px < 50 || py > 350 || py < 50){
        fill('blue');
    } else {
        fill('yellow');
    }

    //draw ellipse
    ellipse(px, py, diam, diam);

    //when the ball moves off the screen
    if(px < 0){
        px = height - diam/2;
    } if(px > width){
        px = 0;
    }
}

function keyPressed() {
    //press left key
    if (keyCode === LEFT_ARROW) {
        px -= distance;
        if(px < 50 || px > 350 || py < 50 || py > 350){
            warningSound.play();
        }
        else{
            left.play();
            warningSound.stop();
        }
        count++;
    }
    //press right key
    else if (keyCode === RIGHT_ARROW) {
        px += distance;
        if(px < 50 || px > 350 || py < 50 || py > 350){
            warningSound.play();
        }
        else{
            right.play();
            warningSound.stop();
        }
        count++;
    }
    //press up key
    else if (keyCode === UP_ARROW) {
        py -= distance;
        if(px < 50 || px > 350 || py < 50 || py > 350){
            warningSound.play();
        }
        else{
            up.play();
            warningSound.stop();
        }
        count++;
    }
    //press down key
    else if (keyCode === DOWN_ARROW) {
        py += distance;
        if(px < 50 || px > 350 || py < 50 || py > 350){
            warningSound.play();
        }
        else{
            down.play();
            warningSound.stop();
        }
        count++;
    }
}

In this project, I used the metaphor of the ball as me as a young adult. There are boundaries that we’re given and often times we’re tempted to cross them. We’re often warned, but we’re not stopped. Ultimately, it’s up to us.

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.