Charmaine Qiu – Project 10 – Sonic Sketch

sketch

// Charmaine Qiu
// charmaiq@andrew.cmu.edu
// section E
//Project - 10 - Sonic Sketch


var angle = 0
var b = 0
var bgmusic;
var heySound;
var beat;

function preload() {
    //preload the audios and loop the background music
    beat = loadSound('https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/beat.wav');
    heySound = loadSound('https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/hey.wav');
    bgmusic = loadSound('https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/bgmusic.wav');
    bgmusic.loop();
}

function setup() {
    createCanvas(400, 400);
    //createDiv("p5.dom.js library is loaded.");
    //======== call the following to use sound =========
    useSound();
}

function soundSetup() { // setup for audio generation
    //set the volume for audio and play background music
    bgmusic.setVolume(1);
    bgmusic.play();
    heySound.setVolume(1);
    beat.setVolume(2);
    //setup for oscillation
    osc = new p5.TriOsc();
    osc.freq(500);
    osc.amp(1);
    osc.start();
}

function draw() {
    //set the frequency of oscillation according to placement of mouseX
    osc.freq(mouseX);
    osc.amp();
    //when the mouse is pressed, "hey" plays
    if (mouseIsPressed){
        heySound.play();
    }

   //graphics created from precious project
    fill(b);
    //randomizing the color in greyscale
    b = random (0, 255);
    strokeWeight(0);
    rectMode(CENTER);
    push();
    //square that follows the mouse
    translate(mouseX, mouseY);
    background(0);
    rotate(radians(angle));
    rect(0, 0, 50, 50);
    pop();
    //angle rotates
    angle += 5;

    //rectangle outlines in the center
    noFill();
    stroke(255);
    strokeWeight(5);
    push();
    translate(width / 2, height / 2);
    rect(0, 0, mouseX, mouseY);
    pop();

    stroke(b);
    strokeWeight(1);
    rect(width * 0.5, height * 0.5, mouseY, mouseX);

   //dancing lines in the center
    stroke(255);
    strokeWeight(1);
    line(width / 2 - 40, height / 2, width / 2 - 40, mouseY + 50);
    line(width / 2 - 30, height / 2, width / 2 - 30, mouseY);
    line(width / 2 - 20, height / 2, width / 2 - 20, mouseY - 20);
    line(width / 2 - 10, height / 2, width / 2 - 10, mouseY + 40);
    line(width / 2, height / 2, width / 2, mouseY);
    line(width / 2 + 10, height / 2, width / 2 + 10, mouseY + 60);
    line(width / 2 + 20, height / 2, width / 2 + 20, mouseY + 10);
    line(width / 2 + 30, height / 2, width / 2 + 30, mouseY);
    line(width / 2 + 40, height / 2, width / 2 + 40, mouseY - 30);

   //When the mouse move to the left side of the canvas
    if (mouseX <= width / 2){
        //squares that rotates around the mouse
        push();
        translate(mouseX - 50, mouseY - 50);
        rotate(radians(angle));
        rectMode(CORNER);
        rect(20, 20, 20, 20);
        pop();
        angle = angle + 0.5;

        push();
        translate(mouseX + 50, mouseY + 50);
        rotate(radians(angle));
        rect(0, 0, 10, 10);
        pop();
        angle = angle - 0.5

        //text appears
        textSize(15);
        text('WooHooo!!!', 20, 90);
        textSize(30);
        text('哦耶!', 280, 180);


      } else { //When the mouse move to the right side of the canvas
        fill(0);
        strokeWeight();
        push();
        translate(mouseX, mouseY);
        rotate(radians(angle));
        rectMode(CENTER);
        rect(0, 0, 30, 30);
        pop();
        angle = angle + 5

        //text appears
        textSize(20);
        fill(255);
        text('야호!', 280, 50);
        textSize(25);
        text('ヤッホ〜ー', 70, 350);
       }
}
//when the key "b" is pressed, a beat sound is played
function keyPressed(){
    if(key == "b"){
        beat.play();
    }
}

In this project, I was able to incorporate new knowledge of importing sound and oscillations into my former assignment. I had fun looking for edm music sources online and creating an interactive project that people could play 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();
        }
    }
}

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.

Sammie Kim – Project 10 – Sonic Sketch

sketch

//Sammie Kim
//Section D
//sammiek@andrew.cmu.edu
//Project 10 - Sonic Sketch

//Global variables
var facesPic;
var laughingSound;
var cryingSound;
var surprisedSound;
var angrySound;

function preload() {
    //loading image through Imgur
    var facesURL = "https://i.imgur.com/1fPz3CY.jpg";
    facesPic = loadImage(facesURL);
    //loading sound from freesound.org
    laughingSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/laughing.wav");
    cryingSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/crying.wav");
    surpriseSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/surprise.wav");
    angrySound = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/angry.wav");
}

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

function soundSetup() {
    // setup for audio generation
    //setting volume to one for each sound
    laughingSound.setVolume(1);
    cryingSound.setVolume(1);
    surpriseSound.setVolume(1);
    angrySound.setVolume(1);
}

function draw() {
    //drawing out the image on the canvas
    background(255);
    image(facesPic, 0, 0);
}

function mousePressed() {
    //making each sound play and pause based on mouse location on canvas
    if (mouseX > 0 & mouseX < 140 ) {
        surpriseSound.play();
        } else {
        surpriseSound.pause();
        }
    if (mouseX > 140 & mouseX < 230) {
        cryingSound.play();
        } else {
        cryingSound.pause();
        }
    if (mouseX > 230 & mouseX < 336) {
        angrySound.play();
        } else {
        angrySound.pause();
        }
    if (mouseX > 336 & mouseX < width) {
        laughingSound.play();
        } else {
        laughingSound.pause();
        }
}

For this project, I wanted to incorporate sounds that show the emotions of each minion ( happy, sad, surprised, and angry). It took a while to get used to working with terminal and preloading sounds, but I feel I got a better grasp now.

Mihika Bansal – Project 10 – Sonic Sketch

sketch


// Mihika Bansal 
// Section E 
// mbansal@andrew.cmu.edu
// Project 10

var h1 = 35; // varying heights
var h2 = 80;  
var h3 = 50; 

var w1 = 10; //varying widths 
var w2 = 15; 
var w3 = 20; 


function preload() {
    // call loadImage() and loadSound() for all media files here
    //mySnd = loadSound("waves.wav"); 
   // mySnd.setVolume(0.5);
}


function setup() {
    // you can change the next 2 lines:
    rectMode(CENTER); 
    createCanvas(480, 400);
   
    //======== call the following to use sound =========
    useSound();
}


function soundSetup() { // setup for audio generation
    // you can replace any of this with your own audio code:
    s1 = new p5.Oscillator(); //the 4 tones I will be manipulating
    s1.setType('sine');

    s2 = new p5.Oscillator();
    s2.setType("sine"); 

    s3 = new p5.Oscillator();
    s3.setType("sine"); 
    
    s4 = new p5.Oscillator();
    s4.setType("sine"); 

    //starting all the audio files, so all sounds are playing at the same time
    s1.start();
    s2.start(); 
    s3.start();
    s4.start();

}


function draw() {

    //creating visual elements 
    background(15); 
    noStroke(); 

    h1 = map(mouseY, 0, height, 50, 80); 
    h2 = map(mouseX, 0, height, 100, 200);
    h3 = map(mouseY, 0, height, 80, 120); 

    w1 = map(mouseX, 0, width, 10, 30);
    w2 = map(mouseY, 0, width, 20, 40);
    w3 = map(mouseX, 0, width, 15, 35); 

    fill("#355C7D"); 
    rect(26, 200, w1, h1); 
    rect(185, 200, w1, h1);
    rect(344, 200, w1, h1);


    fill("#F67280"); 
    rect(79, 200, w2, h2);
    rect(238, 200, w2, h2);
    rect(397, 200, w2, h2);

    fill("#C06C84"); 
    rect(132, 200, w3, h3);
    rect(291, 200, w3, h3);
    rect(450, 200, w3, h3);

    if(mouseX > 0 & mouseX < 120){ //determing sound based on the mouse, moving the mouse changes the sound
        freq1 = map(mouseX, 0, width, 0, 200); //lowest frequency is to the left of the screen
        //amp1 = map(mouseY, 0, height, 0, 0.3); 
        s1.freq(freq1); 
        s1.amp(0.5); //when in that section of the screen the audio is louder
        //s1.start(); 
    }
    else{
        s1.amp(0); //when outside of that section of the screen, the audio is softer 
    }
    if(mouseX > 120 & mouseX < 240){
        freq2 = map(mouseX, 0, width, 200, 400); // increeasing frequency
        s2.freq(freq2);
        s2.amp(0.5); // louder sounds
        //s2.start(); 
    }
    else{
        s2.amp(0); //softer sounds 
    }
    if(mouseX > 240 & mouseX < 360){
        freq3 = map(mouseX, 0, width, 400, 600); // increasing the frequency 
        s3.freq(freq3);
        s3.amp(0.5); //louder sound
        //s3.start(); 
    }
    else{
        s3.amp(0); //softer sound  
    }
    if(mouseX > 360 & mouseX < 480){
        freq4 = map(mouseX, 0, width, 600, 800); //final increase in the frequency
        s4.freq(freq4);
        s4.amp(0.5);
        //s4.start(); 
    }
    else{
        s4.amp(0);  
    }

}

With this project, I created a sound piece that depends on the location of the mouse on the page. When the mouse is off of the screen the sound stops, but as long as it is on the page, a frequency will be emitted. The visuals correspond with the sound that is being emitted because I used the map function for both. Move the mouse completely to the left to stop emitting the sound on wordpress.

ilona altman – project 09

sketch

var theImage;

function preload() {
    //loading my image
    var myImageURL = "https://i.imgur.com/3SFfZCZ.jpg";
    theImage = loadImage(myImageURL);
}

function setup() {
    createCanvas(480, 480);
    background(250,250,250);
    theImage.loadPixels();

    // going through each pixel 
    for (x = 0; x < width+10; x = x+3) {
        for (y = 0; y < height+10; y = y+2) {
            var pixelColorXY = theImage.get(x, y);
            if (brightness(pixelColorXY) >= 0 & brightness(pixelColorXY) <= 20) {
                //light pink
                stroke(255,230,230,70);
                line(x, y, x-1,y-1);
            } else if (brightness(pixelColorXY) >= 20 & brightness(pixelColorXY) <= 50) {
                //orange
                stroke(250,170,160);
                line(x, y, x+3, y+3);
            } else if (brightness(pixelColorXY) >= 50 & brightness(pixelColorXY) <= 55) {
                //pink
                stroke(230,130,160);
                line(x, y, x+3, y+3);
            } else if (brightness(pixelColorXY) >= 55 & brightness(pixelColorXY) <= 60) {
                // light green
                stroke(180,195,200);
                line(x, y, x-1,y-1);
            } else if (brightness(pixelColorXY) >= 65 & brightness(pixelColorXY) <= 70) {
                //yellow orange
                stroke(235,180, 100);
                line(x, y, x-2, y-2);
            } else if (brightness(pixelColorXY) >= 75 & brightness(pixelColorXY) <= 85) {
                //blue
                stroke(196,130,130);
                line(x, y, x-1, y-1);
            } else if (brightness(pixelColorXY) >= 85 & brightness(pixelColorXY) <= 95) {
                //dark red
                stroke(220,80,80);
                line(x, y, x-1, y-1);
            } else if (brightness(pixelColorXY) >= 95 & brightness(pixelColorXY) <= 110){
                //pink
                stroke(220,69,90);
                line(x, y, x+2, y+2); 
            } else if(brightness(pixelColorXY) >= 110 & brightness(pixelColorXY) <= 130){
                //medium blue
                stroke(80,130,60);
                line(x, y, x+1, y+1); 
            } else if (brightness(pixelColorXY) >= 130 & brightness(pixelColorXY) <= 160){
                //light orange
                stroke(220,170,130);
                line(x, y, x+1, y+1);
            } else if (brightness(pixelColorXY) >= 130 & brightness(pixelColorXY) <= 160){
                //light orange
                stroke(202,70, 100);
                line(x, y, x+1, y+1);
            } else if (brightness(pixelColorXY) >= 160 & brightness(pixelColorXY) <= 190){
                //white
                stroke(255,255, 255);
                line(x, y, x+3, y+3);
            } else if (brightness(pixelColorXY) >= 190 & brightness(pixelColorXY) <= 220){
                //yellow
                stroke(150,130, 90);
                line(x, y, x+3, y+3);
            } else if (brightness(pixelColorXY) >= 220 & brightness(pixelColorXY) <= 255){
                //yellow
                stroke(200,60,60);
                line(x, y, x+3, y+3);

            }
         
         }   
    }

}
function draw() {

}

In this project, I was thinking about memories with my family and about my grandma. I took some photos this summer of her teaching the rest of my family how to make Lithuanian dumplings. In my psychology class it is interesting because we have been learning about how distortion happens to what we remember over time. This is why I chose to make my image a bit distorted, and not so clear. I also love gradient maps, and wanted to emulate this with this piece. Yellow, green and red are the colors of the Lithuanian flag as well.

SooA Kim: Looking Outwards-09


I’m citing on the week 5 of Looking Outwards and the topic was on 3D Computer Graphics. As a person who follows this artist’s work on instagram, I thought Sydney Salamy’s topic on Tyson Ibele’s work would be enthusiastic.

I agree on the peer’s assessment with the psychological play of the imagery in the work. The artist approached the viewer, using realistic texture and simulations to create the animation. Nowadays, most of the 3D animation software programs provide these simulations with scripts encoded. So, it gives more flexibility and options for 3D artist to just apply their objects/polygons to soft body or cloth simulation tag. Some of these software programs, such as Maya, provide a script content window for VFX artist to write their own Python code and generate it. Every time I watch this video post, it gives me chills as if my limbs were getting cut off; pretty similar to the reaction when you see someone getting a paper cut. However, there is this weird, visual pleasure of watching his 3D generative animation post in loop.

Peer’s link: https://courses.ideate.cmu.edu/15-104/f2019/2019/09/21/sydney-salamy-looking-outwards-05/

Sean Leo – project 09 – Portrait

sleo-project-09

//Sean B. Leo
//Sleo@andrew.cmu.edu
//Section C

//Project 09 Portrait

function preload() {
    var myImageURL = "https://static.wixstatic.com/media/b109e8_9226598d042f4ca2b17fd70a4e0d7319~mv2.jpg/v1/fill/w_572,h_680,al_c,q_85,usm_0.66_1.00_0.01/b109e8_9226598d042f4ca2b17fd70a4e0d7319~mv2.webp"; 
  
    IMG = loadImage(myImageURL);

}

function setup() {
    createCanvas(480, 480);
    background(0);
    IMG.loadPixels();
    frameRate(60);
  imageMode(CENTER);
}

function draw() {
    var px = random(width);
    var py = random(height);
    var ix = constrain(floor(px), 0, width-1);
  //print (ix);
    var iy = constrain(floor(py), 0, height-1);
  //print(iy);
    var rx = px + random(0,10); // randomize x-value
    var ry = py + random(0,10); // randomize y-value
    var rs = random(1,10); // randomize stroke weight
    var theColorAtLocationXY = IMG.get(ix, iy);

    strokeWeight(rs);
    stroke(theColorAtLocationXY);
    line(px,py,rx,ry);
}

Starting
Mid-render
Original Photo

William Su – Project – 09 – Portrait

sketch

// William Su
// Section E
// wsu1@andrew.cmu.edu
// Porject 09

var underlyingImage;

function preload() {
    var myImageURL = "https://i.imgur.com/zvGQCAe.jpg"; //My image
    underlyingImage = loadImage(myImageURL);
}

function setup() {
    createCanvas(384, 480);
    background(0);
    underlyingImage.resize(384,480); //resize portrait image to fit the canvas
    underlyingImage.loadPixels();
    frameRate(1000); //Increased framerate
}

function draw() {
    //All similar to example
    var px = random(width);
    var py = random(height);
    var ix = constrain(floor(px), 0, width-1);
    var iy = constrain(floor(py), 0, height-1);
    var theColorAtLocationXY = underlyingImage.get(ix, iy);

    //random number generator from 0 - 2
    let r = int(random(0,2));

    strokeWeight(r);
    stroke(100 * r);
    fill(theColorAtLocationXY);
    rect(px, py, 10, 10); //Fill rectangle at location of sampled color.

    var theColorAtTheMouse = underlyingImage.get(mouseX, mouseY);

    var HiImWill = ["Hi", "I'm", "Will"]; //Initializing a simple list of words.

    fill(theColorAtTheMouse); //fill color at mouse location
    textSize(16);
    //draws random words from list
    text(HiImWill[r],mouseX, mouseY); 
}

Portrait
Original Photo

For this project, I used a combination of squares, strokes, and words to generate a portrait of myself. I added variability