Visual Music Project

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

import g4p_controls.*;

import net.java.games.input.*;
import org.gamecontrolplus.*;
import org.gamecontrolplus.gui.*;

ControlIO control;
ControlDevice stick;

Minim minim;
AudioInput in;
AudioPlayer song;
AudioPlayer song2;
AudioPlayer FCUK;

float px, py;
float ox, oy;
float sx, sy;
float tr;
float tl;
float w = 0;
float freak1;
float freak2;
float freak3;
float freak4;
float freak5;
float freak6;

int a = 0;
int b = 0;
int c = 0;

boolean music = true;
boolean FCUKMODE = false;

color q = color(0, 0, 0);
color f = color(19, 85, 219, 100);
color g = color(56, 127, 232, 100);
color h = color(43, 43, 147, 100);
color j = color(7, 27, 92, 100);
color BG1 = color(115, 138, 215);
color BG2 = color(114, 166, 244);
int iterations;

FFT fft;
BeatDetect beat;

public void setup() {
size(550, 550, P2D);

minim = new Minim(this);
song = minim.loadFile(“Song3.mp3”, 512);
song2 = minim.loadFile(“Song4.mp3”, 512);
FCUK = minim.loadFile(“FCUK.mp3”, 512);
in = minim.getLineIn(Minim.STEREO, 1050);

control = ControlIO.getInstance(this);
stick = control.getMatchedDevice(“XBOX_CONFIGURE”);
}

public void getUserInput() {
px = map(stick.getSlider(“L-Joy-Up/Down”).getValue(), -1, 1, 0, width);
py = map(stick.getSlider(“L-Joy-Left/Right”).getValue(), -1, 1, 0, height);
ox = map(stick.getSlider(“R-Joy-Up/Down”).getValue(), -1, 1, 0, width);
oy = map(stick.getSlider(“R-Joy-Left/Right”).getValue(), -1, 1, 0, height);
tr = map(stick.getSlider(“RT”).getValue(), -1, 1, 0, width);
tl = map(stick.getSlider(“LT”).getValue(), -1, 1, 0, width);
}

public void draw() {
freak1 = random(0, 50);
freak2 = random(0, 100);
freak3 = random(20, 200);
freak4 = random(500, 150);
freak5 = random(300, 400);
freak6 = random(30, 200);
getUserInput();
background(100);
noStroke();
for (int i = 0; i < song.bufferSize() – 1; i++) {
for (int o = 0; o < 6; o = o+1) {
for (int p = 0; p < 6; p = p+1) {
fill(BG1);
rect(o*(width/5.5), p*(height/5.5), 50+ song.left.get(i+1)*100, 50+ song.left.get(i+1)*100);

fill(BG2);
rect(50+o*(width/5.5), p*(height/5.5), 50+ song.right.get(i+1)*100, 50+ song.right.get(i+1)*100);
rect(o*(width/5.5), p*(height/5.5)+50, 50+ song.right.get(i+1)*100, 50+ song.right.get(i+1)*100);

fill(BG1);
rect(o*(width/5.5)+50, p*(height/5.5)+50, 50+ song.left.get(i+1)*100, 50+ song.left.get(i+1)*100);
iterations ++;
}
}

if (FCUKMODE == false) {
if (stick.getButton(“Start”).pressed()) {
FCUKMODE = true;
}
BG1 = color(115, 138, 215);
BG2 = color(114, 166, 244);
song.play();
song2.play();
song.unmute();
song2.unmute();
song.shiftBalance(-1, 1, 2000);
song2.shiftBalance(1, 1, 2000);
FCUK.play();
FCUK.mute();
noStroke();
q = color(0, 0, 0);
f = color(19, 85, 219, 100);
g = color(56, 127, 232, 100);
h = color(43, 43, 147, 100);
j = color(7, 27, 92, 100);
if (stick.getButton(“RB”).pressed()) {
song.mute();
}
if (stick.getButton(“LB”).pressed()) {
song2.mute();
}

if (stick.getButton(“A-Button”).pressed()) {
fill(g);
ellipse(270, px+150, 100+ song.left.get(i+1)*0, 100+ song.left.get(i+1)*50);
ellipse(270, px+150, 100+ song.right.get(i+1)*50, 100+ song.right.get(i+1)*0);
}
if (stick.getButton(“B-Button”).pressed()) {
fill(f);
ellipse(py+150, 270, 100+ song.left.get(i+1)*0, 100+ song.left.get(i+1)*50);
ellipse(py+150, 270, 100+ song.right.get(i+1)*50, 100+ song.right.get(i+1)*0);
}
if (stick.getButton(“X-Button”).pressed()) {
fill(h);
ellipse(py-150, 270, 100+ song.left.get(i+1)*0, 100+ song.left.get(i+1)*50);
ellipse(py-150, 270, 100+ song.right.get(i+1)*50, 100+ song.right.get(i+1)*0);
}
if (stick.getButton(“Y-Button”).pressed()) {
fill(j);
ellipse(270, px-150, 100+ song.left.get(i+1)*0, 100+ song.left.get(i+1)*50);
ellipse(270, px-150, 100+ song.right.get(i+1)*50, 100+ song.right.get(i+1)*0);
}

}
if (FCUKMODE == true) {
if (stick.getButton(“Select”).pressed()) {
FCUKMODE = false;
}
BG1 = color(53, 10, 10);
BG2 = color(31, 2, 2);

fill(40,6,1);
triangle(0, 550, 50, 550, freak3, freak2);
triangle(0, 550, 50, 550, freak4, freak1);
triangle(400, 550, 550, 550, freak6, freak5);
triangle(400, 550, 550, 550, freak5, freak2);
triangle(100, 0, 0, 0, freak1, freak6);
triangle(100, 0, 0, 0, freak3, freak1);
triangle(550, 0, 450, 0, freak5, freak4);
triangle(550, 0, 450, 0, freak2, freak6);
song.mute();
song2.mute();
FCUK.unmute();
noStroke();
q = color(80, 14, 14, 100);
f = color(203, 246, 211);
g = color(9, 0, 0);
h = color(0, 0, 255);
j = color (255, 255, 0);

if (stick.getButton(“A-Button”).pressed()) {
fill(g);
ellipse(py+freak1, px, freak5, freak3);
fill(59, 0, 0);
ellipse(py+freak1, px, 50, 50);
}
if (stick.getButton(“B-Button”).pressed()) {
fill(50,27,24);
ellipse(py+freak5+50, freak5+50, 50+freak3, freak3);
fill(0,0,0);
ellipse(py+50+freak5, px+50+freak5, 50+freak1, freak1);
ellipse(py+freak5, px+freak5, 50+freak1, freak1);
fill(62,6,0);
ellipse(py+freak5+50, +freak5+50, 50+freak2, freak2);
}
if (stick.getButton(“X-Button”).pressed()) {
fill(52,3,3);
triangle(py+100, px+100, py-100, px-100, 100+ song.left.get(i+1)*0, 100+ song.left.get(i+1)*50); }
if (stick.getButton(“Y-Button”).pressed()) {
fill(0,0,0);
ellipse(py, px+freak2, 100+ song.left.get(i+1)*0, 100+ song.left.get(i+1)*50);
ellipse(py, px+freak2, 100+ song.right.get(i+1)*50, 100+ song.right.get(i+1)*0);
}
}
noStroke();

if (stick.getButton(“D-Up”).pressed()) {
f = color(255, 0, 0);
g = color(0, 255, 0);
h = color(0, 0, 255);
j = color (255, 255, 0);
}
if (stick.getButton(“D-Down”).pressed()) {
f = color(176, 46, 46);
g = color(47, 147, 47);
h = color(43, 43, 147);
j = color(198, 196, 33);
}
fill(BG1);
rect(450, 550, 100, -tr);
rect(0, 550, 100, -tl);

fill(q);
ellipse(py, px, 100+ song.left.get(i+1)*0, 100+ song.left.get(i+1)*50);
ellipse(py, px, 100+ song.right.get(i+1)*50, 100+ song.right.get(i+1)*0);
}
}

Advertisements
This entry was posted in Interactive Authoring, Time-Based and tagged , , . Bookmark the permalink.

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