GMU:Processing im Park/Josephine Jatzlau

From Medien Wiki

Josephine Jatzlau

homework 1

 

Kolibri





homework 2

 

Moon


 


Moon 2.0


homework 3

 

Grumpy Cat Fusion


Pixel Sorting


















Video Delay

BeeGees Video Delay

Code:

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.png

Code:

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); 
}

My Final Project

For my final project I wanted to explore the world of sound processing. I started to experiment with the visualization of sound (beat detection).And I got more and more interessted into this topic. The semester break gave me the final inspiration for my project. I created an interactive map which shows some clubs in Berlin. With this map you can find the perfect club for you and your music taste. I think that there has never been a map like this. It could be really helpful and people should start to develope those kind of maps for metropolises like Berlin, London or NewYork.

Part 1 Beat Detection

Part 2 - Interactive Club Map

Code Part 1:

import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

import camera3D.*;
import camera3D.generators.*;
import camera3D.generators.util.*;

Minim minim;
AudioPlayer song;
BeatDetect beat;

float eRadius;

PImage img;

void setup() {
 
  size(500, 500, P3D);
 
  minim = new Minim(this);
  song = minim.loadFile("song.mp3", 2040);
  song.play();
  
  beat = new BeatDetect();
  
  rectMode(CENTER);
  eRadius = 20;
  
}

void draw() {
  
  background(0);
  beat.detect(song.mix);
  
  fill( random(255), random(255), random(255), random(255));
  int x = int(random(100, width - 100));
  int y = int(random(100, height -100));
  if (beat.isOnset() )
rect(250, 250, random(width), random(height));
  
}

void mousePressed() { 
   
  minim.stop();
  song.close();
}

void keyPressed()
{
  if ( key == '1') {
    
  minim = new Minim(this);
  song = minim.loadFile("song.mp3", 2040);
  song.play();
    
  }
  
  if ( key == '2') {
    
  minim = new Minim(this);
  song = minim.loadFile("song-2.mp3", 2040);
  song.play();
  }
  
  if ( key == '3') {
    
  minim = new Minim(this);
  song = minim.loadFile("song-3.mp3", 2040);
  song.play();
    
  }
  if ( key == '4') {
    
  minim = new Minim(this);
  song = minim.loadFile("song-4.mp3", 2040);
  song.play();
    
  }
  
  if ( key == '5') {
    
  minim = new Minim(this);
  song = minim.loadFile("song-5.mp3", 2040);
  song.play();
    
  }
  
 if ( key == 'x') {
   
 song.close();  
 minim.stop();   
 }
   
}

Code Part 2:

import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

import camera3D.*;
import camera3D.generators.*;
import camera3D.generators.util.*;

Minim minim;

PImage img;
PImage img1;

PFont font;
PFont font1;

int n = 19; 
int idx;

AudioPlayer song;
BeatDetect beat;

AudioPlayer[] players = new AudioPlayer[n];

float eRadius;

int[][] locations = {

 {545, 276, 10}, //1 Humboldthain
 {782, 470, 10}, //2 Berghain
 {734, 480, 10}, //3 Tresor
 {735, 509, 10}, //4 RitterButzke
 {891, 669, 10}, //5 Grießmühle
 {945, 589, 10}, //6 WildeRenate
 {568, 270, 10}, //7 Brunnen70
 {673, 278, 10}, //8 AlteKantine
 {422, 370, 10}, //9 Metaxabay
 {139, 394, 10}, //10 MiSalsa
 {93, 437, 10}, //11 Goldelse
 {574, 508, 10}, //12 Werk9
 {645, 343, 10}, //13 Sophienclub
 {573, 532, 10}, //14 Gretchen
 {261, 496, 10}, //15 Quasimodo
 {203, 456, 10}, //16 A-Trane
 {746, 440, 10}, //17 GoldenGate
 {526, 373, 10}, //18 BarTausend
 {707, 397, 10}, //19 HouseOfWeekend
 };

int activeLocation = -1; 

void setup() {
  
minim = new Minim(this); 

size(1000, 750);
  
img = loadImage("map2.jpg");
img.resize(1000, 750);
img1 = loadImage("map1.png");
img1.resize(631, 92);

font = loadFont("DejaVuSansCondensed-Bold-60.vlw");
font1 = loadFont("DejaVuSans-ExtraLight-20.vlw");

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

beat = new BeatDetect();
  
rectMode(CORNER);
eRadius = 10;

}

void draw() {

background(img);
image(img1, 209, 100);  

fill(255);
textFont(font, 60);
text("THE SOUND OF BERLIN", 50, 65);

fill(0, 24, 50, 70);
textFont(font, 60);
text("THE SOUND OF BERLIN", 50, 70, -10);

fill(255);
textFont(font1, 20);
text("find the stars and hear the sound of your favorite clubs", 190, 95); 


println(pmouseX, pmouseY);

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

   int x1 = loc[0];
   int y1 = loc[1];
   int r  = loc[2];

   
if(atLocation(x1, y1, r)) {
         
activeLocation = i;
     
 star(x1, y1, 5, 10, 5); 
 fill(255);
 noStroke();
players[i].play();
 }
else {
  
 players[i].pause();  
  }  
 }
}

void star(float x, float y, float radius1, float radius2, int npoints) {
  float angle = TWO_PI / npoints;
  float halfAngle = angle/2.0;
  beginShape();
  for (float a = 0; a < TWO_PI; a += angle) {
    float sx = x + cos(a) * radius2;
    float sy = y + sin(a) * radius2;
    vertex(sx, sy);
    sx = x + cos(a+halfAngle) * radius1;
    sy = y + sin(a+halfAngle) * radius1;
    vertex(sx, sy);
  }
  endShape(CLOSE); 
}

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();
 }
}