Input in: center of mass dancers + beatDetector track = screen viz
Source Code: https://www.dropbox.com/sh/etb2jxd98sh49yb/IrXRLIRJnS

Code
We used the oscP5message code by andreas schlegel to receive data from the Center Of Mass Server for Kinect by Nick Puckett.
From this base we added on pieces of code from this example:
http://www.openprocessing.org/sketch/2271 that was modified to create a substantially different output.
We then added code to convert the input from the Kinect into visuals based on the Kinect Server code by Nick Puckett.
Near the end of the project our awesome DF classmate Lindy Wilkins helped us out
/**
* oscP5message by andreas schlegel
* example shows how to create osc messages.
* oscP5 website at http://www.sojamo.de/oscP5
*/
import oscP5.*;
import netP5.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import gifAnimation.*;
//import processing.net.*;
Minim minim;
AudioPlayer song;
FFT fft;
PImage[] animation;
Gif loopingGif;
Gif nonLoopingGif;
float kickSize, snareSize, hatSize;
OscP5 oscP5;
NetAddress myRemoteLocation;
int connectionPort = 5206;
float SW1 = 0;
String pattern1 = “/Person1”;
//float x3d1;
//float y3d1;
//float z3d1;
float x2d1;
float y2d1;
float x2d1Prev;
float y2d1Prev;
float x2d2Prev;
float y2d2Prev;
float vel1;
float vel2;
String pattern2 = “/Person2”;
//float x3d2;
//float y3d2;
//float z3d2;
float x2d2;
float y2d2;
//String pattern3 = “/Person3”;
//float x3d3;
//float y3d3;
//float z3d3;
//float x2d3;
//float y2d3;
//String pattern4 = “/Person4”;
//float x3d4;
//float y3d4;
//float z3d4;
//float x2d4;
//float y2d4;
//
//String pattern5 = “/Person5”;
//float x3d5;
//float y3d5;
//float z3d5;
//float x2d5;
//float y2d5;
//
//String pattern6 = “/Person6”;
//float x3d6;
//float y3d6;
//float z3d6;
//float x2d6;
//float y2d6;
float dis1_2;
float SWdist1_2;
float SCvel1;
float SCvel2;
void setup() {
size(1024,768);
// frameRate(24);
oscP5 = new OscP5(this,connectionPort);
//smooth();
minim = new Minim(this);
song = minim.loadFile(“04 Common People.mp3”, 512);
song.play();
fft = new FFT(song.bufferSize(), song.sampleRate());
loopingGif = new Gif(this, “rain.gif”);
loopingGif.loop();
//nonLoopingGif = new Gif(this, “rain.gif”);
//nonLoopingGif.play();
minim = new Minim(this);
}
void draw() {
background(0);
noStroke();
//draw a vertical line that follows User 1 horizontally
//println (y2d1);
SW1 = int(map(y2d1,0.0,450.0,10.0,320.0));
SCvel1 = map(vel1,10.0,25.0,120.0,255.0);
SCvel2 = map(vel2,10.0,25.0,120.0,255.0);
SWdist1_2 = map(dis1_2,40.0,120.0,10.0,100);
fill(SCvel1,40,40,100);
rect(x2d1,0,SW1,displayHeight);
//draw a horizontal line that follows User 2 vertitally
fill(40,40,SCvel2,90);
rect(0,x2d2,displayHeight,SWdist1_2);
//draw a vertical line that follows User 3 horizontally
// fill(175,20,40,70);
// rect(x2d3,0,40,displayHeight);
//draw a horizontal line that follows User 4 vertitally
//fill(200,200,20,70);
//rect(0,x2d4,displayHeight,40);
//draw a vertical line that follows User 5 horizontally
//fill(20,200,200,70);
//rect(x2d5,0,40,displayHeight);
//draw a horizontal line that follows User 6 vertitally
//fill(200,20,200,70);
//rect(0,x2d6,displayHeight,40);
image(loopingGif,0,0,1024,768);
tint(12,123,12,95);
//background(255);
println (song.bufferSize());
strokeWeight(1);
for (int i = 0; i < song.bufferSize() – 256; i++)
{
//rect(width, 900, song.left.get(i)*5000, song.left.get(i)*500);
//noFill();
//stroke(0,255,0,40);
ellipse(width/2, -20, song.left.get(i)*2600, song.left.get(i)*800);
noFill();
stroke(0,200,0,40);
}
dis1_2= dist(x2d1,y2d1,x2d2,y2d2);
//println((“dist 1 2: “+dis1_2));
vel1= dist(x2d1,y2d1,x2d1Prev,y2d1Prev);
x2d1Prev=x2d1;
y2d1Prev=y2d1;
vel2= dist(x2d2,y2d2,x2d2Prev,y2d2Prev);
x2d2Prev=x2d2;
y2d2Prev=y2d2;
//println((“velocity “+ vel1));
}
/* incoming osc message are forwarded to the oscEvent method. */
void oscEvent(OscMessage theOscMessage) {
if(theOscMessage.checkAddrPattern(pattern1)==true) {
//x3d1=theOscMessage.get(0).intValue();
//y3d1=theOscMessage.get(1).intValue();
//z3d1=theOscMessage.get(2).intValue();
x2d1=theOscMessage.get(3).intValue();
y2d1=theOscMessage.get(4).intValue();
}
if(theOscMessage.checkAddrPattern(pattern2)==true) {
//x3d2=theOscMessage.get(0).intValue();
//y3d2=theOscMessage.get(1).intValue();
//z3d2=theOscMessage.get(2).intValue();
x2d2=theOscMessage.get(3).intValue();
y2d2=theOscMessage.get(4).intValue();
}
// if(theOscMessage.checkAddrPattern(pattern3)==true) {
// x3d3=theOscMessage.get(0).intValue();
// y3d3=theOscMessage.get(1).intValue();
// z3d3=theOscMessage.get(2).intValue();
// x2d3=theOscMessage.get(3).intValue();
// y2d3=theOscMessage.get(4).intValue();
// }
// if(theOscMessage.checkAddrPattern(pattern4)==true) {
// x3d4=theOscMessage.get(0).intValue();
// y3d4=theOscMessage.get(1).intValue();
// z3d4=theOscMessage.get(2).intValue();
// x2d4=theOscMessage.get(3).intValue();
// y2d4=theOscMessage.get(4).intValue();
// }
// if(theOscMessage.checkAddrPattern(pattern5)==true) {
// x3d5=theOscMessage.get(0).intValue();
// y3d5=theOscMessage.get(1).intValue();
// z3d5=theOscMessage.get(2).intValue();
// x2d5=theOscMessage.get(3).intValue();
// y2d5=theOscMessage.get(4).intValue();
// }
// if(theOscMessage.checkAddrPattern(pattern6)==true) {
// x3d6=theOscMessage.get(0).intValue();
// y3d6=theOscMessage.get(1).intValue();
// z3d6=theOscMessage.get(2).intValue();
// x2d6=theOscMessage.get(3).intValue();
// y2d6=theOscMessage.get(4).intValue();
//
// }
}
void stop()
{
song.close();
minim.stop();
super.stop();
}
References
We used code samples from the following at various points:
http://code.compartmental.net/minim/examples/BeatDetect/FrequencyEnergy/FrequencyEnergy.pde
http://code.compartmental.net/minim/examples/BeatDetect/FrequencyEnergy/BeatListener.pde
Cheers to our lovely dancers! We are the night. Let’s take over the world~
Mazi, Hank, Torin