Browsing articles tagged with " Processing Discourse"

Dance Projection Lights.

Feb 21, 2011   //   by J.Boston   //   Interactive Programs, Portfolio, Processing Sketches  //  No Comments

here is an example i created of how processing could be used as dance projection lights. This could be a really interesting specific piece of software with a bit of development.

Processing Discourse Dance Projection Lights from Joseph Boston on Vimeo.

this is an example of the use of minim library with processing discourse. You can create interesting effects using the minim library. This particular example uses loops to create different sized shapes around the edge. Its only using the audio left and right inputs to create this but you can use FFT (part of the minim library) to make it more accurate to the sounds being produced by the music. Feel free to check out my other projects below also!

Below is the source code for this project:

import ddf.minim.*;
Minim minim;
AudioInput in;
int var1 = 200; 
PImage bg;

void setup()
{

  minim = new Minim(this);
  in = minim.getLineIn(Minim.STEREO, 512);
  bg = loadImage("face.jpg");
  size(500, 500);
  smooth();
  frameRate(25);
  this.rolling();
  
}

void draw(){
filter(BLUR, 3);
float a = 8;
translate(width*0.5, height*0.5);
stroke(255, 120);
strokeWeight(3);
for(int i = 0; i < 40; i++){
fill(in.left.get(i)*var1*3, 140, in.right.get(i)*30, 60);
rotate(PI/10);
rect(in.left.get(i)*70, in.left.get(i)*70, in.right.get(i)*70, in.right.get(i)*70);
fill(in.right.get(i)*var1/10, in.left.get(i)*var1, in.right.get(i)*-var1, 60);
ellipse(-200, in.left.get(i)*70, in.right.get(i)*var1, in.right.get(i)*70);
}
var1 += -10;
if(var1 < 20){
  var1 += 300;
}
}


void stop()
{
  // always close Minim audio classes when you are done with them
  in.close();
  minim.stop();
  
  super.stop();
}

void rolling(){
  int y = 0;
  int x = 0;
  if((y | x) == 0){
  
  for(y = 0; y < height; y ++){
      for(x = 0; x < width; x ++){
        point(x, y);
        stroke(30, 0, 0);
                                      }

                    
                                  }
                                  
            int i;
        for(i = 0; i < width; i++){  
        float r = random(10);
        strokeWeight(r);
        stroke(255, 255, 255, r-4);
        line(i, height, i, 0);
         }
           
        
             }
                                  
                  }

Cong Box v1. Another example of sound interacting with shape generation.

Feb 18, 2011   //   by J.Boston   //   Interactive Programs, Portfolio, Processing Sketches  //  No Comments

This example is using OPENGL to generate a cube.
Using the minim library I have integrated sound to make it decrease and increase in size.
Below is the source code:

/**I created a cube that is colored 
using RGB values when settings the vertex positions. 
I am using the minim library to change the size of the cube.
I also textured the cube in Normalized mode.
On top of this I left two sides untextured to give a cool glitchy seethrough effect.
LIKE A G6.

This 3d shape interacts with sound and is textured. 
**/


import processing.opengl.*;
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;

int si = 30;
PFont fontA;
int var1 = 200; 
PImage img;
Minim minim;
AudioOutput out;
SineWave sine;
AudioPlayer music;


float xmag, ymag = 0;
float newXmag, newYmag = 0, i;
float il = 0;
float il2 = 0;
 
void setup() 
{ 
  size(500, 500, OPENGL); 
  strokeWeight(3);
  stroke(0); 
  textureMode(NORMALIZED);
  img = loadImage("img.jpg");
  minim = new Minim(this);
  music = minim.loadFile("music.mp3", 2048);
  // get a line out from Minim, default sample rate is 44100, default bit depth is 16
  out = minim.getLineOut(Minim.STEREO, 2048);
  fontA = loadFont("HERO.vlw");
 
  // create a sine wave Oscillator, set to 440 Hz, 
//at 0.5 amplitude, sample rate 44100 to match the line out
  //sine = new SineWave(440, 0.5, out.sampleRate());
  // add the oscillator to the line out
  //out.addSignal(sine);
  music.play();
} 
 
void draw() 
{ 
  textFont(fontA, 32);
  stroke(int(random(255)), int(random(255)), int(random(255)));
  
  if(frameCount % 5 == 0){
    background(255);
  }
  if(frameCount % 1700 < 20 && frameCount > 1700){
    //this creates a really awesome feedback glitch
    music = minim.loadFile("music.mp3", 2048);
    music.play();
  }
  println(frameCount);
  pushMatrix(); 
 
  translate(width/2, height/2, -30); 
  
  newXmag = mouseX/float(width) * TWO_PI;
  newYmag = mouseY/float(height) * TWO_PI;
  
  float diff = xmag-newXmag;
  if (abs(diff) >  0.01) { xmag -= diff/4.0; }
  
  diff = ymag-newYmag;
  if (abs(diff) >  0.01) { ymag -= diff/4.0; }
  
  rotateX(-xmag); 
  rotateY(-ymag); 
  
  
  il = music.left.get(1)*100;
  il2 = music.right.get(1)*100;
  float outs = il+il2;
  if(outs < 40){
    outs = 40;
  }
  
  scale(outs);
  beginShape(QUADS);
  texture(img);
  vertex(-1,  1,  1, 0, 0);
  vertex( 1,  1,  1, 1, 0);
  vertex( 1, -1,  1, 1, 1);
  vertex(-1, -1,  1, 0, 1);

  vertex( 1,  1,  1, 0, 0);
  vertex( 1,  1, -1, 1, 0);
  vertex( 1, -1, -1, 1, 1);
  vertex( 1, -1,  1, 0, 1);

  vertex( 1,  1, -1, 0, 0);
  vertex(-1,  1, -1, 1, 0);
  vertex(-1, -1, -1, 1, 1);
  vertex( 1, -1, -1, 0, 1);

  vertex(-1,  1, -1, 0, 0);
  vertex(-1,  1,  1, 1, 0);
  vertex(-1, -1,  1, 1, 1);
  vertex(-1, -1, -1, 0, 1);

  vertex(-1,  1, -1);
  vertex( 1,  1, -1);
  vertex( 1,  1,  1);
  vertex(-1,  1,  1);

  vertex(-1, -1, -1);
  vertex( 1, -1, -1);
  vertex( 1, -1,  1);
  vertex(-1, -1,  1);

  endShape();
  
  
  popMatrix(); 
  
  fill( int(random(255)), int(random(255)), int(random(255)));
  stroke( int(random(255)), int(random(255)), int(random(255)));
  text("Cong   Box        v1.0", width/2-100, 30 );
}



void stop()
{
  // always close Minim audio classes when you are done with them
  out.close();
  minim.stop();
 
  super.stop();
}


void musicalVar()
{
  stroke(255);
  // draw the waveforms
  for(int i = 0; i < out.bufferSize() - 1; i++)
  {
    line(i, 50 + out.left.get(i)*50, i+1, 50 + out.left.get(i+1)*50);
    line(i, 150 + out.right.get(i)*50, i+1, 150 + out.right.get(i+1)*50);
  }
}



Get In touch!

contact@jaboston.com
Add me on LinkedIn
Check out my Illustrations

Long cat