Project-10: Sonic Story

For this project, I created a scenery of life under ocean. The four elements in my drawing are a starfish, which makes a sound every 25 frames; a fish, which spits bubbles and make the bubble spitting sound every 15 frames; an octopus, which swimming in up-left direction and makes tentacle sound every 10 frames when it shrinks before the push to swim forward; and the beach on the soft moving ocean floor accompanied by the mysterious sound starting from the beginning of this animation. During the process, I struggled with matching the sound effects with the animation changes, but I made it working eventually.

sketchDownload
/*Name:Camellia(Siyun) Wang; 
Section: C; 
Email Address: siyunw@andrew.cmu.edu;
Assignment-10;*/
//This is a normal day of underocean life
//Violet little fish is spitting bubbles,
//octopus is swimming left upwards,
//and the starfish is just lying on the soft
//moving beach on the ocean floor  
var x = 300;
var dir = 1;
var speed = 5;
var boing;
var xfish;
var yfish;
var dxfish;
var xoct;
var yoct;
var dyoct;
//setup the underwater beach
var marketvalue = [];
var noiseParam = 0;
var noiseStep=0.005;
var count;
//2 arrays to form the starfish
var x = [50, 61, 83, 69, 71, 50, 29, 31, 17, 39];
var y = [18, 37, 43, 60, 82, 73, 82, 60, 43, 37];
//sounds
var ocean;
//variables to change the background
var R = 102;
var G = 178;
var B = 255;

function preload(){
    ocean = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/ocean.wav");
    star = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/star.wav");
    bubble = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/bubble.wav");
    oct = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/oct.wav");
}

function setup() {
    frameRate(3);
    createCanvas(600, 400);
    useSound();
    count = 1;
    //fish setup
    xfish = 200;
    yfish = 250;
    dxfish = 15;
    //oct setup
    xoct = 0;
    yoct = 0;
    dyoct = 3;
    //beach setup
    for(var i = 0; i < 50*width; i++){
        var n = noise(noiseParam);
        var value = map(n,0,1,height / 1.5,height);
        marketvalue.push(value);
        noiseParam+=noiseStep;
    }   
}
function soundSetup(){
    ocean.setVolume(0.1);
    star.setVolume(0.3);
    bubble.setVolume(0.5);
    oct.setVolume(1);
}

function draw() {
    ocean.play();
    background(R,G,B);
    //change background color
    //from light blue to dim blue 
    //to show the change of time
    //from day to night
    R -= 3;
    G -= 5;
    B -= 2;
    //draw the beach
    draw_beach();
    
    //draw fish
    draw_fish();
    xfish += dxfish;
    if (xfish > width-25 || xfish < 25) {
        dxfish = -dxfish;
    }

    //draw octopus
    draw_oct();
    yoct -= dyoct;

    //draw starfish
    draw_starfish();
    

    count += 1;

//end of the short animation
    if(count == 90){
        background(0);
        fill(255);
        textSize(32);
        text('The End', 250, 200);
        noLoop();
        ocean.stop();
        star.stop();
        bubble.stop();
        oct.stop();
    }
}

function draw_beach(){
    marketvalue.shift();
    var n = noise(noiseParam);
    var value = map(n,0,1,height / 1.5,height);
    marketvalue.push(value);
    noiseParam+=noiseStep;
    stroke(255,215,0);
    fill(255,215,0);
    beginShape();
    for(var i = 0; i < 50*width; i++){
        vertex(i*5,height);
        vertex( i*5 ,marketvalue[i]);
        vertex( i*5+5 ,marketvalue[i+1]);
        vertex(i*5+5,height);
    };
    endShape();
    noStroke();
}

function draw_fish() {
    fill(127,0,255);
    ellipse(xfish, yfish, 35, 20);
    if (dxfish < 0) {
        triangle(xfish+15, yfish, xfish+25, yfish-5, xfish+25, yfish+5);
    } else {
        triangle(xfish-15, yfish, xfish-25, yfish-5, xfish-25, yfish+5);
    }
     //bubles every 15 frames
     //small first one
    if(count % 15 == 0){
        bubble.play();
        if(dxfish > 0){
            fill(224,255,255);
            ellipse(xfish + 25, yfish - 5, 5, 5);
        }
        
        if(dxfish < 0){
            fill(224,255,255);
            ellipse(xfish - 25, yfish - 5, 5, 5);
        }
    }
    //middle second one
    if(count % 15 == 1){
        bubble.play();
        if(dxfish > 0){
            fill(224,255,255);
            ellipse(xfish + 25, yfish - 5, 5, 5);
            ellipse(xfish + 35, yfish - 15, 10, 10);
        }
        if(dxfish < 0){
            fill(224,255,255);
            ellipse(xfish - 25, yfish - 5, 5, 5);
            ellipse(xfish - 35, yfish - 15, 10, 10);
        }
    }
    //large last one
    if(count % 15 == 2){
        bubble.play();
        if(dxfish > 0){
            fill(224,255,255);
            ellipse(xfish + 25, yfish - 5, 5, 5);
            ellipse(xfish + 35, yfish - 15, 10, 10);
            ellipse(xfish + 45, yfish - 25, 15, 15);
        }
        if(dxfish < 0){
            fill(224,255,255);
            ellipse(xfish - 25, yfish - 5, 5, 5);
            ellipse(xfish - 35, yfish - 15, 10, 10);
            ellipse(xfish - 45, yfish - 25, 15, 15);
        }
    }
}

function draw_oct(){
    if(count % 10 == 1){
        //make sound when shrink to push
        oct.play();
        push();
        translate(400,150);
        rotate(-PI / 3);
        fill(216,191,216);
        strokeWeight(5);
        stroke(216,191,216);
        line(xoct-10,yoct+10,xoct-20,yoct+30);
        line(xoct-20,yoct+30,xoct-10,yoct+50);
        line(xoct+10,yoct+10,xoct+20,yoct+30);
        line(xoct+20,yoct+30,xoct+10,yoct+50);
        line(xoct,yoct+15,xoct,yoct+50);
        ellipse(xoct,yoct,45,35);
        noStroke();
        pop();
    }
    else{
        push();
        translate(400,150);
        rotate(-PI / 3);
        fill(238,130,238);
        stroke(238,130,238);
        strokeWeight(5);
        ellipse(xoct,yoct,30,50);
        line(xoct-10,yoct+10,xoct-30,yoct+50);
        line(xoct,yoct+15,xoct,yoct+55);
        line(xoct+10,yoct+10,xoct+30,yoct+50);
        noStroke();
        pop();
    }
}

function draw_starfish(){
    push();
    translate(450,300);
    var nPoints = x.length;
    fill(244,164,96);
    if(count % 25 == 1){
        fill(255,140,0);
        star.play();
    }
    if(count % 25 == 2){
        fill(255,140,0);
    }
    if(count % 25 == 3){
        fill(255,140,0);
    }
    if(count % 25 == 4){
        fill(255,140,0);
    }
    if(count % 25 == 5){
        fill(255,140,0);
    }
    beginShape();
    for (var i = 0; i < nPoints; i++) {
        vertex( x[i] + random(-3,3), y[i] + random(-3,3) );
    }
    endShape(CLOSE);
    pop();
}

Project 10: Sonic Story

sketch
//Christy Zo
//Section C

var cricketSound;
var roosterSound;
var cowSound;
var pigSound;
var sunHue;

function preload() {
    cricketSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/cricketSound.wav");
    roosterSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/roosterSound.wav");
    cowSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/cowSound.wav");
    pigSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/pigSound.wav")
 }

function soundSetup() {
    osc = new p5.TriOsc();
}
function setup() {
    createCanvas(600, 300);
    useSound();
    frameRate(30);
}



function barn(x) {
    stroke(255);
    strokeWeight(2);
    fill(50);
    rect(x, 100, 200, 150);
    fill(255);
    rect(x+10, 110, 180, 80);
    fill(50);
    rect(x+10, 200, 180, 40);
    line(x+10, 200, x+190, 240);
    line(x+10, 240, x+190, 200);
    triangle(x, 100, x+200, 100, x+100, 30);
    triangle(x+15, 100, x+185, 100, x+100, 40);
}

function rooster(x) {
    stroke(0);
    fill(255);
    line(x, 150, x-30, 190); 
    line(x, 150, x+30, 190);
    circle(x, 150, 50); 
    fill(220);
    circle(x, 180, 20);
    triangle(x, 140, x-10, 110, x+10, 110); 
    fill(150);
    triangle(x, 150, x-10, 160, x+10, 160);
    triangle(x, 170, x-10, 160, x+10, 160);
    fill(255);
    circle(x-10, 145, 5);
    circle(x+10, 145, 5);

}

function cow(x) {
    fill(255);
    stroke(0);
    rect(x, 125, 50, 50);
    fill(200);
    ellipse(x+25, 170, 52, 30); //nose
    fill(255);
    circle(x+12, 170, 10);
    circle(x+37, 170, 10);
    circle(x+15, 145, 5);
    circle(x+35, 145, 5);
    ellipse(x-10, 125, 25, 10); //ears
    ellipse(x+55, 125, 25, 10);
    line(x, 150, x-30, 190);
    line(x+50, 150, x+80, 190);

}

function pig(x) {
    line(x, 150, x-30, 190);
    line(x, 150, x+30, 190);
    circle(x, 150, 60);
    circle(x-10, 145, 5);
    circle(x+10, 145, 5);
    fill(150);
    ellipse(x, 160, 30, 15);
    fill(255);
    circle(x-5, 160, 5);
    circle(x+5, 160, 5);
    fill(100);
    triangle(x-20, 120, x-25, 130, x-15, 125);
    triangle(x+20, 120, x+25, 130, x+15, 125);

    

}

var light = 0;
var position = 255;
function draw() {
    
    background(light);
    fill(light);
    rect(0, 0, 600, 300);

    sunHue = map(position, 0, height, 255, 0);
    fill(sunHue, 150, 0);
    ellipse(200, position, 50, 50);
    if (position < -50) {
        position = 300;
        light = 0;
        frameCount = 0;

    }
    fill(220);
    noStroke();
    rect(0, 200, 600, 300);
    barn(0);
    barn(200);
    barn(400);



    rooster(100);
    cow(275);
    pig(500);

    light = light + 1;
    position = position - 1;
    if (frameCount == 30) {
        cricketSound.play();
    }
    if (frameCount == 80) {
        roosterSound.play();

    } else if (frameCount == 140) {
        cowSound.play();
    } else if (frameCount == 200) {
        pigSound.play();
    }

    if (roosterSound.isPlaying()) {
        fill(255,0,0);
        circle(100, 180, 20);
        triangle(100, 140, 90, 110, 110, 110);
        fill(255,255,0);
        triangle(100, 150, 100-10, 160, 100+10, 160);
        triangle(100, 170, 100-10, 160, 100+10, 160);
    } else if (cowSound.isPlaying()) {
        fill(165,42,42);
        ellipse(275+25, 170, 52, 30);
        fill(255);
        circle(275+12, 170, 10);
        circle(275+37, 170, 10);
    } else if (pigSound.isPlaying()) {
        fill(255, 192, 203);
        triangle(500-20, 120, 500-25, 130, 500-15, 125);
        triangle(500+20, 120, 500+25, 130, 500+15, 125);
        ellipse(500, 160, 30, 15);
        fill(255);
        circle(500-5, 160, 5);
        circle(500+5, 160, 5);

    }

}


I was reminded of the story Animal Farm, and wanted to create a simple yet cute! I wanted to make everything greyscale, but emphasize the colors when each of the animals sound play!

Project-10-Sonic Story

sketch

//Tim Nelson-Pyne
//tnelsonp@andrew.cmu.edu
//section C
//Assignment-10-Project
//a sound bomb drops from the sky as a zombie rises from the grave
//the sound bomb makes a musical explosion and the zombie dances to the beat

var noteImg
var explosionImg
var danceGifImg
var danceGif
var fall
var explosion
var tam
var beat


var i = 0;


function preload() {
    noteImg = loadImage("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/eighthNote.png");
    explosionImg = loadImage("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/musicExplosion.png");
    danceGifImg = loadImage("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/Mojo_the_zombie.gif");  
    fall = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/falling.wav");
    explosion = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/explosion.wav");
    tam = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/Tam95bpm.wav");
    beat = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/Beat189bpm.wav")
    danceGif = createImg("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/Mojo_the_zombie.gif");
    danceGif.hide();
}

function setup() {
    createCanvas(480, 600);
    useSound();
    background(255);
    frameRate(60);
}

function soundSetup() { 
    
}


function draw() {
    //adds one to i each frame
    i ++;
    background(3, 0, 50);
    imageMode(CENTER);
    //makes the background flash multi colors when the sound bomb drops
    if(i >= 600 & i % 30 < 15) {
        fill(random(100, 255), random(100, 255), random(100,255));
        rect(0,0, 480, 400);
    }
    fill(23, 150, 20);
    noStroke();
    rect(0, 400, 480, 200);
    fill(100);
    rect(250, 325, 100, 150);
    //writes RIP on grave
    fill(0);
    textAlign(CENTER);
    text("RIP", 300, 375);
    //static zombie image rises from the grave
    if (i < 600){
        image(danceGifImg, 300, 700 - map(i, 0, 600, 0, 350), 400, 400);
        fill(23, 150, 20);
        rect(0, 500, 480, 100); 
    }
    //plays the cartoon falling noise and tambourine loop @ start
    if (i == 1) {
        fall.play();
        tam.play();
    }
    //displays the noteImg falling
    if (i < height - 25){
        image(noteImg, 100, i, 50, 50);
    }
    //when the noteImg hits the ground the explosion sound plays
    if (i == height - 25) {
        explosion.play();
    }
    //when the noteImg hits the ground the explosion image flashes
    if (i >= height - 25 & i % 30 < 15 && i < 800) {
        image(explosionImg, 100, height-150, 300, 300);
    }
    //a moment after the noteImg hits the groud the beat starts
    if (i == 600){
        beat.play();
    }
    //and the zombie dances
    if(i >= 600) {
        danceGif.show();
        danceGif.position(0,100);
    }
    //after the beat is over everything goes black
    if (i >= 1800) {
        danceGif.remove();
        fill(0);
        rect(0, 0, 480, 600);
        noLoop();
    }


    
}

Project 10 – Sonic Story

sketch-beansDownload
//global variables
var frameCount = 0;
var sky;
var cat;
var sofa;
var clock;
var playlist;
var table;
var rain = [];
const numOfRaindrops = 100;

function preload() { 
  //preload images
  sky = loadImage("https://i.imgur.com/6PCHwrN.png");
  cat = loadImage("https://i.imgur.com/qApZuXa.png");
  sofa = loadImage("https://i.imgur.com/sESZJWa.png");
  clock = loadImage("https://i.imgur.com/hbfe35l.png");
  playlist = loadImage("https://i.imgur.com/wKD6EsD.png");
  table = loadImage("https://i.imgur.com/74DxEGR.png");

  //preload sounds
  clockSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/clock.wav");
  playlistSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/playlist.wav");
  rainSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/rain-1.wav");
  catSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/cat.wav");
  // clockSound = loadSound("clock.wav");
  // playlistSound = loadSound("playlist.wav");
  // rainSound = loadSound("rain.wav");
  // catSound = loadSound("cat.wav");
}

function setup() {
  createCanvas(480, 400);
  useSound();
  frameRate(20);

  //rain
  rain_color = color(225, 235, 244);
  background_color = color(21, 39, 56);
  for (var i = 0; i < numOfRaindrops; i++) {
    rain[i] = new drawFallingRain();
  }
}

function soundSetup() {
  clockSound.setVolume(0.4);
  playlistSound.setVolume(0.7);
  rainSound.setVolume(0.5);
  catSound.setVolume(0.4);
}

function draw() {

  background(background_color);

  //gradient sky
  image(sky, 0, 0, width, 210);

  //rain
  for (var i = 0; i < rain.length; i ++) {
      rain[i].rainDisplay();
      rain[i].rainDrop();
  }

  //room wall
  fill(109, 115, 147);
  noStroke();
  rect(0, 0, 100, 600);
  rect(400, 0, 100, 600);
  rect(0, 210, 800, 300);
  fill(88, 87, 103);
  rect(-100, 340, 800, 300);

  //window
  fill(109, 115, 147);
  rect(100, 100, 300, 10);
  rect(250, 0, 10, 200);
  fill(71, 72, 90);
  rect(100, 200, 300, 15);
  fill(144);
  rect(100, 200, 300, 5);

  //clock
  image(clock, 385, 30, 90, 140);

  //sofa
  image(sofa, -55, 10, 420, 400);

  //cat
  image(cat, 290, 130, 80, 80);

  //table
  image(table, 340, 250, 150, 150);

  //playlist
  image(playlist, 375, 230, 80, 80)

    if (frameCount % 460 == 0 || frameCount % 460 == 1) {
        rainSound.stop();
        rainSound.play();
    }
    if (frameCount % 340 == 0 || frameCount % 340 == 1) {
        print("Starting playlist")
        playlistSound.stop();
        playlistSound.play();
    }
    if (frameCount % 200 == 0 || frameCount % 200 == 1) {
        catSound.stop();
        catSound.play();
    }
    if (frameCount % 160 == 0 || frameCount % 160 == 1) {
        clockSound.stop();
        clockSound.play();
    }
    frameCount += 1;
}

function drawFallingRain() {
    this.rx = random(0, 400); //width of the canvas
    this.ry = random(0, 400); //height of the canvas
    this.rain_size = random(0, 8);
    this.rain_rate = map(this.rain_size, 0, 10, 8, 10);
    this.rain_range = map(this.rain_size, 0, 10, 7, 18);

    this.rainDisplay = function() {
        var raindrop_size = map(this.rain_size, 0, 20, 0.7, 0.3);
        stroke(rain_color);
        strokeWeight(raindrop_size);
        line(this.rx, this.ry, this.rx, this.ry + this.rain_range);
    }
    this.rainDrop = function() {
        this.ry = this.ry + this.rain_rate;
        var dropsOfRain = map(this.rain_size, 0, 10, 2, 1); //indicates the raindrop rate
        this.rain_rate = dropsOfRain + this.rain_rate;
        if (this.ry >= 300) { //continue raining
            this.ry = random(-100, 0);
            this.rain_rate = map(this.rain_size, 0, 10, 3, 15);
        }
    }
}

For this project, I decided to illustrate a chill scenery of a room with a cat on a rainy night (or in the early morning). The four characters I used were: raining sound, clock ticking, LP playlist, and cat meowing. I found sounds on freesound.org and found some free png images on free sites like Imgur. At first I found it challenging with the instructions of how the sound works in both my server outside of WordPress and on WordPress as blog entry, but I managed to figure it out! This was super fun project to work with.

Project 10: Sonic Story

project 10 sketch copy


var windowOpen = true;
var pane;
var bird;
var windowNoise;
var alarm;
var framee = 0;
var cx;
var cy;
var secRadius;
var minRadius;
var hrRadius;
var cDiam;


function preload() {
    alarm=loadSound("http://localhost:8000/clock-ticking.wav");
    pane=loadSound("http://localhost:8000/star.wav");
    windowNoise=loadSound("http://localhost:8000/creaking.wav");
    bird=loadSound("http://localhost:8000/bird.wav");
}

function setup() {
    createCanvas(480, 480);
    useSound();
    frameRate(1);
}

function soundSetup() {
    alarm.setVolume(0.2);
    pane.setVolume(0.2);
    windowNoise.setVolume(0.3);
    bird.setVolume(0.2);
}

function draw() {
    background(225,207,166);
    drawScene();
    
    if (framee>7 & framee<=10) {
        drawBird();
        bird.play();
    }

    if (framee>1 & framee <=2) {
        alarm.play();
    }
    
    push();
    translate(354, 315);
    scale(0.15);
    drawAlarm();
    
    if (framee>1 & framee <=2) {
        pane.play();
    }

    noStroke();
    fill(255);
    drawPane();
    pop();

    //when window noises occur
    drawWindow();
    if (framee>6 & framee<=12){
        windowOpen=false;
    }
    if (framee==7){
        windowNoise.play();
    }
    if (framee>11){
        windowOpen=true;
    }
    if (framee==14){
        windowNoise.play;
    }

    framee++;
    if (framee>=22){
        framee=0;
    }
  
}

function drawAlarm() {
  
    //this alarm clock is from the p5js ref website
    var radius = min(width, height) / 2;
    secRadius=radius*0.71;
    minRadius=radius*0.6;
    hrRadius=radius*0.5;
    cDiam=radius*1.7;
  
    cx=width/2;
    cy=height/2;
  
    noStroke();
    fill(0);
    ellipse(cx, cy, cDiam+25, cDiam+25);
    fill(220);
    ellipse(cx, cy, cDiam, cDiam);
  
    var s=map(second(), 0, 60, 0, TWO_PI)-HALF_PI;
    var m=map(minute()+norm(second(), 0, 60), 0, 60, 0, TWO_PI)-HALF_PI;
    var h=map(hour()+norm(minute(), 0, 60), 0, 24, 0, TWO_PI*2)-HALF_PI;
  
    stroke(0);
    strokeWeight(1);
    line(cx, cy, cx+cos(s)*secRadius, cy+sin(s)*secRadius);
    strokeWeight(2);
    line(cx, cy, cx+cos(m)*minRadius, cy+sin(m)*minRadius);
    strokeWeight(4);
    line(cx, cy, cx+cos(h)*hrRadius, cy+sin(h)*hrRadius);
  
    strokeWeight(2);
    beginShape(POINTS);
    for (var i=0; i<360; i+=6){
         var angle=radians(i);
         var x=cx+cos(angle)*secRadius;
         var y=cy+sin(angle)*secRadius;
         vertex(x, y);
  }
  
  endShape();
}

function drawScene() {
    //window
    noStroke();
    fill(51,0,25);
    square(25, 25, 300);
    fill(153,204,255);
    square(50, 50, 250);
    
    //table
    fill(181,137,34);
    rect(330,390,150,50);
    
    //alarm clock stand
    fill(0);
    triangle(370,390,410,390,390,370);
  
    //cloud
    fill(255);
    ellipse(100, 100, 70, 60);
    ellipse(125, 125, 70, 50);
    ellipse(140, 110, 60, 55); 
    ellipse(160, 115, 60, 50); 

}

function drawPane() {
    var paneX = [50, 61, 83, 69, 71, 50, 29, 31, 17, 39];
    var paneY = [18, 37, 43, 60, 82, 73, 82, 60, 43, 37];
    var nPoints = paneX.length;

}

function drawBird() {
    fill(153,0,0);
    circle(227,175,20);
    rect(226,168,20,7);
    rect(226,175,20,7);    
}

function drawWindow() {
    stroke(51,0,25);
    strokeWeight(10);
    noFill();
    if (windowOpen == true) {
        line(175, 30, 175, 320);
        line(30, 175, 320, 175);
  }
    
    if (windowOpen == false) {
        line(175, 30, 175, 320);
        line(30, 175, 170, 175);
        line(210, 80, 320, 40);
        line(210, 80, 210, 360);
        line(210, 360, 320, 320);
        line(210, 220, 320, 180);
  }

}

The fours sounds I used were the clock ticking, the alarm ringing, the window opening and the birds chirping. I wanted to create a scene of how my mornings go, as I’m always awaken by an alarm clock and hear a lot of birds outside my window.

Project 10: Sonic Story

My project is a simple animation of a bee flying through some daisies and a sunflower to collect nectar. For my process, I created several objects that I animated first. Afterward, I inserted sounds that at different places within the story where the action was happening.

Canvas is 900 pixels wide so you can see the right side on here 🙁

sketch
//Anthony Pan
//Section C

var index = 0;
var duration = 0;
var sunflower;
var daisy;
var daisy2;
var bee;
var cloud;

//sounds
var beeSound;
var windSound;
var popSound;
var yumSound;



//bee positions
var beex = [900, 880, 860, 840, 820, 800, 780, 760, 740, 720, 700, 
680, 660, 640, 620, 600, 580, 560, 540, 540, 540, 540, 540, 540, 540, 540, 500, 450, 400, 200, -100];

//noise for beey heights
var noiseParam = 0;
var noiseStep = 0.05;
var beey = [];

//cloud positions
var cloudX = [];

function preload() {
    beeSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/beeBuzz.wav");
    windSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/wind.wav");
    popSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/pop.wav");
    yumSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2021/wp-content/uploads/2021/11/yum.wav");

}


function soundSetup() {
    windSound.amp(0.4);
    beeSound.amp(0.8);
    popSound.amp(1.0);
    yumSound.amp(0.8);
}



function setup() {
    createCanvas(900, 400);
    frameRate(1);
    useSound();

    //random y positions of beey
    for(var i=0; i < 30; i++) {
        var n = noise(noiseParam);
        var value = map(n, 0, 1, 0, height);
        beey.push(value);
        noiseParam += noiseStep;
    }

    //positions for cloudX
    for(var j = 0; j < 30; j++) {
        var cloudvalue = 900 - (j * 20);
        cloudX.push(cloudvalue);

    }


    //make objects
    daisy = makeDaisy(width/2, 2* height/3, 100);
    sunflower = makeSunflower(width/4, height/2, 80);
    daisy2 = makeDaisy(2 * width/3, height/3, 100);
    bee = makeBee(beex[index], beey[index]);
    cloud = makeCloud();

    
}

function draw() {
    //draw sky
    background(149, 217, 255);
    cloud.draw(cloudX[index], 100);

    //play windSound at end
    if(frameCount >= 28 & frameCount <= 31) {
        windSound.play();

    } 
    
    sunflower.draw();
    daisy.draw();
    daisy2.draw();

    //daisy petal fall 
    if(index >= 20) {
        fill(255);
        ellipse(600, index * 15, 60, 160);
    }

    //daisy petal pop
    if(frameCount >= 23 & frameCount <= 24) {
        popSound.play();
    }

    //play yum sound when bee is above flower
    if(index >= 20 & index < 21) {
        yumSound.play();
    }

    //sunflower petal pop
    if(frameCount >= 24 & frameCount <= 25) {
        popSound.play();
    }

    //sunflower petal fall
    if(index >= 24) {
        fill("yellow");
        ellipse(width/4, 50+index*15, 20, 180);
        ellipse(1.25 * width/4, 50+index*15, 20, 180);

    }

    bee.draw(beex[index], beey[index]);

    //play bee sound at beginning
    if(frameCount >= 0 & frameCount <= 3) {
        beeSound.play();

    }

    
    index += 1;

    //stop sounds at 30 seconds
    if(index >= 32) {
        popSound.stop();
        windSound.stop();
        beeSound.stop();
        yumSound.stop();
        background(0);
        noLoop();
    }





}

//cloud constructor
function makeCloud(cx, cy) {
    var cloud = {x: cx, y: cy, draw: drawCloud}
    return cloud;

}

//draw cloud
function drawCloud() {
    fill(230);
    ellipse(cloudX[index], 100, 300, 100);
    ellipse(cloudX[index]-90, 110, 100, 80);
    ellipse(cloudX[index]-30, 120, 100, 80);
    ellipse(cloudX[index]+30, 120, 100, 80);
    ellipse(cloudX[index]+90, 110, 100, 80);

    ellipse(cloudX[index]-90, 90, 100, 80);
    ellipse(cloudX[index]-30, 80, 100, 80);
    ellipse(cloudX[index]+30, 80, 100, 80);
    ellipse(cloudX[index]+90, 90, 100, 80);

}

//constructor for daisy
function makeDaisy(fx, fy, fh) {
    var daisy = {x: fx, y: fy, height: fh, draw: drawDaisy}
    return daisy; //return daisy as object

}

//draw daisy
function drawDaisy() {
    fill(10, 200, 20);
    rect(this.x, this.y, 40, height);
    //petals
    for(var i = 0; i < 10; i++) {
        push();
        translate(this.x, this.y);
        noStroke();
        var rotationAngle = radians(36);
        rotate(i * rotationAngle);
        fill(255);
        ellipse(0, -60, 60, 160);
        pop();

    }

    fill("yellow");
    noStroke();
    circle(this.x, this.y, 80);

}

//constructor for sunflower
function makeSunflower(sx, sy, sh) {
    var sunflower = {x: sx, y: sy, height: sh, draw: drawSunflower}
    return sunflower;

}

function drawSunflower() {
    fill(10, 200, 20);
    rect(this.x, this.y, 40, height/2);
    for(var i = 0; i < 40; i++) {
        push();
        translate(this.x, this.y);
        var rotationAngle2 = radians(9);
        rotate(i * rotationAngle2);
        fill("yellow");
        ellipse(0, -80, 20, 180);
        pop();
    }
    fill(33, 12, 11);
    circle(this.x, this.y, 200);
}


//bee constructor
function makeBee(bx, by) {
    var bee = {x: bx, y: by, draw: drawBee}
    return bee;

}

function drawBee() {
    //wings
    stroke(0);
    fill(255);
    ellipse(beex[index]-5, beey[index]-30, 20, 40);
    ellipse(beex[index]+10, beey[index]-20, 20, 40);

    //body
    fill(0);
    ellipse(beex[index], beey[index], 60, 40);

    //stinger
    triangle(beex[index]+25, beey[index]+5, beex[index]+40, beey[index], beex[index]+25, beey[index]-5);

    //stripes
    noStroke();
    fill("yellow");
    rect(beex[index], beey[index]-20,5, 40);
    rect(beex[index]-10, beey[index]-20, 5, 40);
    rect(beex[index]+10, beey[index]-20, 5, 40);


}


Project 09: Portrait

sketch

//Jacky Lococo
//jlococo
//Section C
var photoFace; //stores the image
var size = 10 //stores size of the images

function preload() {
    photoFace = loadImage('https://i.imgur.com/vdN43xy.png?1');
}

function setup() {
    createCanvas(345, 400);
    imageMode(CENTER);
    noStroke();
    photoFace.loadPixels(); 
}

function draw() {
    background(255);
    drawPixleate();
    fill(0);
    textSize(15)
    text('P R E S S', mouseX, mouseY); // writes press
    size = map(mouseX, 0, width, 10, 50); // will map the size of the 
    if (size == 0) size = 1;


}

function drawPixleate(){
    for (var y = 5; y < height + 50; y += size) {
        for (var x = 5; x < width + 50; x += size) {
            print(photoFace.width);
            var pix = photoFace.get(x, y); //extracts color from the image
            fill(pix);
            if(mouseIsPressed){
                ellipse(x, y, size, size); //ellipse instead of rectangles when mouse is pressed
            } else {
                rect(x, y, size, size);//rectangled when mouse is not pressed
            }
        }
    }
}



LO: A Focus on Women and Non-binary Practitioners in Computational Art

One female artist that I find inspiring is Eva Schindling. She got a MSc. in art and technology from Chalmers University in Sweden. She “creates hardware and software solutions in the interdisciplinary zone between art, science, technology and design.” Her work has been exhibited all over the world including the Japan Media Arts festival, Hong Kong’s Museum of Art, Moscow’s Biennale of Contemporary Art, and even Burning Man! A project that I find very interesting from her portfolio is La Figure de la Terre. This was a work for the contemporary Finish Opera La Figure de la Terr and it is an Audio-reactive video software. There is not that much explaining the piece, but from the images it seems like this was used as a background to the opera itself. I think it is always exciting to see different applications of computer generated art, and this marriage between theater and computer generated art is especially inspiring!

Link: http://www.evsc.net/projects/la-figure-de-la-terre
Artist: Eva Schindling

Project 09 Portrait

sketch

//Tim Nelson-Pyne
//tnelsonp@andrew.cmu.edu
//section C
//Assignment-09-Project



var img;
var x = [];
var y = [];
    



function preload() {
    //loads the walking Images
    img = loadImage('https://i.imgur.com/gCoIwkQ.jpg');
    
}

function setup() {
    createCanvas(480, 480);
    img.resize(width, height);
    background(255);
    img.loadPixels();

    
}




function draw() {
    //ellipse width
    var w = 1;
    //change in ellipse width
    var dw = .8;
    
    for(var row = 0; row < width; row += 5) {
        for (var col = 0; col < height; col +=5) {
            //gets the color of the current pixel location
            var pix = img.get(col, row);
            //generates an inverse color reading of the image
            var invR = 255 - pix[0];
            var invG = 255 - pix[1];
            var invB = 255 - pix[2];
            noStroke();
            fill(invR, invG, invB);
            //draws the inverse image in background
            rect(col, row, 5, 5)
            fill(pix);
            //changes the width of ellipses
            w += dw;
            if (w > 6 || w < 1) {
                dw = - dw;
            }

            ellipse(col, row, w, 6);
        }
    }

    



noLoop();
}

LO 9

Asking the Neural Network to Imagine a Chimera

Ex.icon

This project consists of a combination of text, AI generated images, and screenshots that work together to explore the idea of a chimera. It is a sort of back and forth between human and machine that interrogates the differences between human perception and machine perception and the opportunities that either offer for imagination and also interrogation of the existing repertoire of ideas and images. I find this combination of written theory and imagery particularly compelling because unlike many artworks this allows the viewer to follow the thought process of the artist in a much more direct way. The text situates the images in the context of the thought process rather than assuming that the viewer has all of the prerequisite knowledge to know how to interpret them. This particular artist has very little information about them online so it is not really possible to do a comprehensive biography. However, their artist statement tells us that their work uses various forms of play to decode the mythology of dualisms built into society, and interrogate human existence within late capitalism and technology. They work across many mediums, but much of the work seems to be related to experience within digital spaces.

Artist Website:

https://ex-icon.com/

Project:

https://ex-icon.com/asking-the-neural-network-to-imagine