GMU:Processing im Park/Josephine Jatzlau: Difference between revisions

From Medien Wiki
Line 173: Line 173:


===  ''Sound Processing - Interactive'' ===
===  ''Sound Processing - Interactive'' ===
[[File:Parkhöhle-1.png]]


import ddf.minim.*;
import ddf.minim.*;

Revision as of 19:05, 25 January 2016

Josephine Jatzlau

homework 1

Kolibri.gif

Kolibri



here is my first homework didn't manage it to upload the code


homework 2

Moon-collage.jpg

Moon



Moon-Collage2.jpg


Moon 2.0


homework 3

Grumpy.jpg

Grumpy Cat Fusion


Pixel Sorting

Pxl-old.png


















Video Delay

BeeGees Video Delay

// import processing.video.*; Movie myMovie; int maxFrames; int d = 4; boolean recording = false; ArrayList frames = new ArrayList();

void setup() {

 size(1280, 720);
 maxFrames = width / d;
 
 myMovie = new Movie(this, "NightFever.mp4");
 myMovie.loop();
 
 PImage img = createImage(width, height, RGB);
 frames.add(img);

}

void draw() {

  int n = frames.size();
  
 image(myMovie, 0, 0);
 
  // iterate over vertical strips
 for(int i = 0; i < n; i++) {

   // get snip from the frame
   PImage img = (PImage) frames.get(i);

   // x coordinate for the left side of the current strip
   int x1 = int(map(i, 0, n-1, 0, width/2 - 100));
   int y1 = int(map(i, 0, n-1, 0, height/2 - 100));

   int x2 = width - x1;
   int y2 = height - y1;

   int w = x2 - y1;
   int h = y2 - y1;

   PImage snip = img.get(x1, y1, w, h);

   // show strip on screen
   //tint(255, 50);
    image(snip, x1, y1);

}

if(recording) {

  saveFrame("frame/####.png");

   // recording feedback
   stroke(255, 0, 0);
   noFill();
   strokeWeight(5);
   rect(0, 0, width, height);

 }

}

void keyPressed() {

 recording = !recording;

}


void movieEvent(Movie m) {

 m.read();
 
  PImage img = myMovie.get();

 frames.add(img);

 if( frames.size() > maxFrames) {
   frames.remove(0);
 } 

}


Sound Processing - Interactive

File:Parkhöhle-1.png

import ddf.minim.*;

Minim minim;

int n = 8; int idx;

AudioPlayer[] players = new AudioPlayer[n];

int[][] locations = {

 {307, 234, 10}, //1 
 {425, 222, 10}, //2
 {377, 305, 10}, //3
 {426, 383, 10}, //4
 {552, 224, 10}, //5
 {552, 385, 10}, //6
 {661, 420, 10}, //7
 {560, 310, 10}, //8
 

};

int activeLocation = -1;

PImage img;


void setup() {

size(800, 600);

minim = new Minim(this);

img = loadImage("parkhöhle.jpg");


for (int i = 0; i < n; i++) {
players[i] = minim.loadFile(“test-" + (i + 1) + ".mp3");
}
 

}


void draw() {

 image(img, 0, 0);
 fill(255, 150);
 noStroke();


 activeLocation = -1; 
 
 for(int i = 0; i < locations.length; i ++) {
   int[] loc = locations[i];
   

   int x = loc[0];
   int y = loc[1];
   int r = loc[2];
   
   
if(atLocation(x, y, r)) {
         
activeLocation = i;
     
ellipse(x, y, 2*r, 2*r);
fill(250, 0); 
     
   }
   
 }

}


boolean atLocation(int x, int y, int r) {

 return mouseX > (x - r) && mouseX < (x + r) && mouseY > (y - r) && mouseY < (y + r);

}


void mousePressed() {


 if(activeLocation != -1) {
   
 
   for (int i = 0; i < n; i++) {
     players[i].pause();
   }
   
   println("Sound number " + (activeLocation + 1));
   players[activeLocation].rewind();
   players[activeLocation].play();
 
 }
 

}


void keyPressed() {

 for (int i = 0; i < n; i++) {
   players[i].pause();
 }
 int i = (key - '1');
 
 if (i >= 0 && i < n) {
   println("Sound number " + (i + 1));
   players[i].rewind();
   players[i].play();
 }
 

}


void keyPressed() {

 println(pmouseX, pmouseY); 
 

}