ITERATIVE DESIGN (II)_##4th round##____ STAGE 3&4 (CONSTRUCTION&TEST SEVERAL TIMES)

INDEX

TRIALS:

Adding the sound input:

Adding sound-sensitive shapes to the image, capturing thus the sound factor:

Splitting the image in four with the aim of making a looking-Kaleidoscope image.

Testing it in a different place.

Testing the sensibility of the sound, stoping the image with the lack of it.

Trying to duplicate and flip the image to get a more kaleidoscopic effect

Tests and portraits out doors.

Realise of the need to regulate sound sensibility if there is too much sound such in the following examples:

LAST TRIAL CODE:

MAIN PIECE OF CODE, SETUP AND DRAW


import processing.video.*;
Capture cam;

void setup(){

  cam = new Capture(this, 320, 240, 50);
  cam.start();
  background(255);
  colorMode(HSB);
  size(640, 480);
  frameRate(4);
  smooth();
  soundSetup();
  fondoSetup();

}

int N=0;

void draw() {   

   colours();
    fondoDraw();
    centre();
    soundDraw();
    tint(255,120);
    float k = getAmplitude();

    if (k>0.03){
    pushMatrix();
     translate(width/2, height/2);
     rotate(rot);
     rot = rot + 1;

    image(cam, -320,-240); //TL
    scale(1, -1);
    image(cam, -320, 0); //BL

    image(cam, 0,0); //TL
    scale(1, -1);
    image(cam, 0, -240); //BL

    image(cam, 0,-240); //TL
    scale(1, -1);
    image(cam, -320, -240); //BL

    image(cam, 0,-240); //TL
    scale(-1, 1);
    image(cam, 0, -240); //BL

    popMatrix();
  }

void captureEvent(Capture c){
  c.read();
}

CENTRAL SPINNING SHAPES, SENSITIVE TO SOUND


 int d = 100;
 int n = 50;
 int m = 50;
 int o = 50;
 int p = 50;
 int rot=0;

void centre(){

  float k = getAmplitude();

  if (k>0.03){
    pushMatrix();
      translate(width/2, height/2);
      rotate(rot);
      rot = rot + 1;
      drawCircle(0,0);
    popMatrix();
  }
}

void drawCircle(int x, int y){

  int max = width;

     d=(d+20)%max;

        fill(c2[4],100);
        noStroke();
        rectMode(CENTER);
        rect(x, y, d,d);

    if( d >= 100){
       drawCircle2();
    }
}

void drawCircle2(){

   int max = width; 

        n=(n+20)%max;

     if (brightness(c1[2])<=100){
        fill(c2[1],90);
        noStroke();
        ellipse(0, 0, n,n);
    }else{
        fill(c2[2],60);
        noStroke();
        rectMode(CENTER);
        rect(0, 0, n,n);
    }

     if( n >= 100){
      drawCircle3();
      }
  }

  void drawCircle3(){

   int max = width; 

        m=(m+20)%max;

     if (brightness(c1[3])<=100){
        fill(c2[4],60);
        noStroke();
        ellipse(0, 0, m,m);
    }else{
        fill(c2[0],70);
        noStroke();
        rectMode(CENTER);
        rect(0, 0, m,m);
    }

      if( m >= 100){
      drawCircle4();
    }

  }

    void drawCircle4(){

     int max = width;
      o=(o+20)%max;

     if (brightness(c1[0])<=100){
        fill(c2[1],60);
        noStroke();
        ellipse(0, 0, o,o);
    }else{
        fill(c2[3],80);
        noStroke();
       rectMode(CENTER);
        rect(0, 0, o,o);
    }

      if( m >= 100){

        drawCircle5();

    }

  }

      void drawCircle5(){

   int max = width; 

        p=(p+20)%max;

     if (brightness(c1[2])<=100){
        fill(c2[0],90);
        noStroke();
        ellipse(0, 0, p,p);
    }else{
        fill(c2[2],60);
        noStroke();
        rectMode(CENTER);
        rect(0, 0, p,p);
    }

  }

COLOURS TAKEN FROM WEBCAM


 color[] c1 = new color[5];
 color[] c2 = new color[5];

void colours(){

   c1[0] = cam.get(int(random(width/2)),int(random(height/2)));
   c1[1] = cam.get(int(random(width/2)),int(random(height/2)));
   c1[2] = cam.get(int(random(width/2)),int(random(height/2)));
   c1[3] = cam.get(int(random(width/2)),int(random(height/2)));
   c1[4] = #FFFFFF;

    c2[0] = cam.get(10,15);
    c2[1] = cam.get(250,100);
    c2[2] = cam.get(60,200);
    c2[3] = cam.get(300,160);
    c2[4] = cam.get(160,120);

}

SUBTILE BACKGROUND CIRCLES

AudioInput in;

void fondoSetup(){
  in = minim.getLineIn();
  in.enableMonitoring();

}

void fondoDraw(){

    float k = getAmplitude();
    int w=50;

    if (brightness(c2[4])<=126){
     for(int y=0; y<height; y=y+w){
       for(int x=0; x<width; x=x+w){
         noStroke();
         fill(c1[int(random(1,5))],2);
         rect(x, y, w, w);
       }
     }
    }else{
     for(int y=0; y<height; y=y+w){
       for(int x=0; x<width; x=x+w){
         noStroke();
         fill(c1[int(random(1,5))],2);
         ellipse(x, y, w, w);
       }
     }
}

}    

    float getAmplitude(){

  float n = 0;
  for(int i=0; i < in.bufferSize() - 1; i+=10){
    n += abs(in.mix.get(i));
  }
    println(n/10,"val");

  return n/10;                                   

}

SOUND

import ddf.minim.*;

Minim minim;
AudioPlayer player;

void soundSetup(){
    minim = new Minim(this);
    player = minim.loadFile("infinity.mp3");
    player.play();
}

void soundDraw(){
  float k = getAmplitude();

  for(int i = 0; i < in.bufferSize() - 1; i++)
  {
    float x1 = map( i, 0, in.bufferSize(), 0, width );
    float x2 = map( i+1, 0, in.bufferSize(), 0, width );

    fill(c1[4]);
    noStroke();
    ellipseMode(CENTER);
    ellipse(width/2, height/2, 150 + in.right.get(i)*50,150 + in.right.get(i+1)*1000);
    fill(c2[4]);
    strokeWeight(2);
    noStroke();
    ellipse(width/2, height/2, 50 + in.right.get(i)*1000,50 + in.right.get(i+1)*1000);

if(k>0.01){
    noFill();

    stroke(c2[4]);
    strokeWeight(1);

    line( x1, 450 + in.left.get(i)*1000, x2, 450 + in.left.get(i+1)*1000 );
}

  }

}

INDEX

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s