Processing Final

My final project for Interactive Authoring. For this I wanted to create a more complicated visual music program. I added more visuals and was able to keep adding new visuals later in the song compared to my last project, which repeated halfway through. For the visuals I wanted to use abstract geometry appearing and disappearing to represent the different notes in the song. The song I’m using is Zephyr by Madeon.

import ddf.minim.*;
import ddf.minim.analysis.*;

Minim minim;
AudioPlayer song;

boolean stage0 = true;
boolean stage1 = true;
boolean stage2 = false;
boolean stage3 = false;
boolean stage4 = false;
boolean stage5 = false;
boolean stage6 = false;
boolean lines2 = false;
boolean SF = false;
boolean background = true;
color F1 = color(0);
color F2 = color(0);
color F3 = color(0);
color F4 = color(0);
color D1 = color(0,0,0,0);
color E1 = color(0);
color E2 = color(0);
color E3 = color(0);
color E4 = color(0);
color E5 = color(0);
color E6 = color(0);

float spin = 0.0;

int step = 1;
int LS1 = 0;
int LS2 = 800;
int CR = 500;

void setup() {
size(1200,800,P3D);
minim = new Minim(this);
song = minim.loadFile(“01-08- Zephyr.mp3”);
song.play();
}

public void draw(){
//spin code taken from https://www.openprocessing.org/sketch/154
if (spin <= TWO_PI) spin = spin + 0.01;
else spin = 0.0;
//spotlight code taken from processing tutorial
if ( SF == true) {
spotLight(255, 255, 255, width/2, height/2, 400, 0, 0, -1, PI/4, 2);
}

if (stage0 == true) {
pushMatrix();
fill(D1);
noStroke();
rect(200,175,110,110);
popMatrix();
}

if (stage1 == true) {
stroke(0);
pushMatrix();
fill(F1);
translate(240,380,-343);
box(100,450,100);
popMatrix();

pushMatrix();
fill(F2);
translate(480,380,-343);
box(100,450,100);
popMatrix();

pushMatrix();
fill(F3);
translate(720,380,-343);
box(100,450,100);
popMatrix();

pushMatrix();
fill(F4);
translate(960,380,-343);
box(100,450,100);
popMatrix();

}

if (stage2 == true) {
pushMatrix();
translate(width/2,height/2);
if (SF == false){
noFill();
}
else if (SF == true){
fill(255);
}
stroke(0,255,0);
rotateX(spin);
rotateZ(spin);
sphere(280);
popMatrix();
}

if (stage3 == true) {
pushMatrix();
if (SF == false){
noFill();
}
else if (SF == true){
fill(255);
}
translate(width/2, height/2, 0);
stroke(255,0,0);
rotateX(spin);
rotateZ(spin);

beginShape();
vertex(-200, -200, -200);
vertex( 200, -200, -200);
vertex( 0, 0, 200);

vertex( 200, -200, -200);
vertex( 200, 200, -200);
vertex( 0, 0, 200);

vertex( 200, 200, -200);
vertex(-200, 200, -200);
vertex( 0, 0, 200);

vertex(-200, 200, -200);
vertex(-200, -200, -200);
vertex( 0, 0, 200);
endShape();
popMatrix();
}

if (stage4 == true) {
pushMatrix();
translate(width/2,height/2,0);
stroke(0,0,255);
rotateX(spin);
rotateZ(spin);
if (SF == false){
noFill();
}
else if (SF == true){
fill(255);
}
box(300,300,300);
popMatrix();
}

if(stage6 == true) {
stroke(0);
pushMatrix();
fill(E1);
translate(-158,600,-502);
box(100,450,100);
popMatrix();

pushMatrix();
fill(E2);
translate(156,452,-442);
box(100,450,100);
popMatrix();

pushMatrix();
fill(E3);
translate(545,518,-434);
box(100,450,100);
popMatrix();

pushMatrix();
fill(E4);
translate(887,366,-439);
box(100,450,100);
popMatrix();

pushMatrix();
fill(E5);
translate(1222,529,-477);
box(100,450,100);
popMatrix();

pushMatrix();
fill(E6);
translate(1317,287,-343);
box(100,450,100);
popMatrix();
}

if(background == true){
pushMatrix();
fill(0);
translate(0,0,-716);
rect(-700,-600,2800,2800);
popMatrix();
}

if(lines2 == true){
line(width/2,height/2,random(0,1200),random(0,800));
line(width/2,height/2,random(0,1200),random(0,800));
line(width/2,height/2,random(0,1200),random(0,800));
line(width/2,height/2,random(0,1200),random(0,800));
line(width/2,height/2,random(0,1200),random(0,800));
line(width/2,height/2,random(0,1200),random(0,800));
}

if (keyPressed) {
if (key == ‘q’) {
F1 = color(255);
}
if (key == ‘w’) {
F2 = color(255);
}

if (key == ‘e’) {
F3 = color(255);
}
if (key == ‘r’) {
F4 = color(255);
}
if (key == ‘a’) {
D1 = color(255,255,255,255);
}
if (key == ‘s’) {
pushMatrix();
fill(255);
noStroke();
rect(400,320,110,110);
popMatrix();
}
if (key == ‘d’) {
pushMatrix();
fill(255);
noStroke();
rect(600,175,110,110);
popMatrix();
}
if (key == ‘f’) {
pushMatrix();
fill(255);
noStroke();
rect(800,320,110,110);
popMatrix();
}
if (key == ‘z’) {
E1 = color(255);
}
if (key == ‘x’) {
E2 = color(255);
}
if (key == ‘c’) {
E3 = color(255);
}
if (key == ‘v’) {
E4 = color(255);
}
if (key == ‘b’) {
E5 = color(255);
}
if (key ==’n’) {
E6 = color(255);
}
}
}

void keyPressed() {
if (key == ‘1’) {
if (stage1 == true) {
stage1 = false;
}
else if (stage1 == false) {
stage1 = true;
stage6 = false;
}
}
if (key == ‘2’) {
if (stage2 == true) {
stage2 = false;
}
else if (stage2 == false) {
stage2 = true;
}
}
if (key == ‘3’) {
if (stage3 == true) {
stage3 = false;
}
else if (stage3 == false) {
stage3 = true;
}
}
if (key == ‘4’) {
if (stage4 == true) {
stage4 = false;
}
else if (stage4 == false) {
stage4 = true;
}
}
if (key == ‘5’) {
if (stage6 == true) {
stage6 = false;
}
else if (stage6 == false) {
stage6 = true;
stage1 = false;
}
}
if (key == ‘i’) {
if (background == true) {
background = false;
stage0 = false;
}
else if (background == false) {
background = true;
stage0 = true;
}
}
if (key == ‘o’) {
if (SF == false) {
SF = true;
}
else if (SF == true) {
SF = false;
}
}
if (key == ‘p’) {
if (lines2 == false) {
lines2 = true;
}
else if (lines2 == true) {
lines2 = false;
}
}
}

void keyReleased() {
if (key == ‘q’) {
F1 = color(0);
}
if (key == ‘w’) {
F2 = color(0);
}
if (key == ‘e’) {
F3 = color(0);
}
if (key == ‘r’) {
F4 = color(0);
}
if (key == ‘a’) {
D1 = color(0,0,0,0);
}
if (key == ‘z’) {
E1 = color(0);
}
if (key == ‘x’) {
E2 = color(0);
}
if (key == ‘c’) {
E3 = color(0);
}
if (key == ‘v’) {
E4 = color(0);
}
if (key == ‘b’) {
E5 = color(0);
}
if (key == ‘n’) {
E6 = color(0);
}
}

Advertisements
This entry was posted in 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