diff --git a/Albers_Pattern/Algoraveset3/Algoraveset3.pde b/Albers_Pattern/Algoraveset3/Algoraveset3.pde index c4fb90e..87d8308 100644 --- a/Albers_Pattern/Algoraveset3/Algoraveset3.pde +++ b/Albers_Pattern/Algoraveset3/Algoraveset3.pde @@ -62,7 +62,7 @@ void setup() { //in = minim.getLineIn(); - song = minim.loadFile("/Users/sisi/Desktop/LiveCoding/Rose.mp3"); + song = minim.loadFile("/Users/sisi/Desktop/LiveCoding/Debut/Nina.mp3"); song.play(); song.loop(4); } @@ -83,78 +83,79 @@ void draw() { beat.detect(song.mix); - cam.beginHUD(); + //cam.beginHUD(); - for (int i=0; i= x) && (mouseX <= x+55) && + (mouseY >= y-24) && (mouseY <= y)) { + x += random(-2, 2); + y += random(-2, 2); + } + text(letters, x, y); + + float freqMix = song.mix.get(int(x)); + float freqLeft = song.left.get(int(x)); + float freqRight = song.right.get(int(x)); + float amplitude = song.mix.level(); + float size = freqMix * spacing * amplification; + float red = map(freqLeft, -1, 1, 0, 200); + float green = map(freqRight, -1, 1, 0, 50); + float blue = map(freqMix, -1, 1, 0, 55); + float opacity = map(amplitude, 0, 0.4, 20, 100); + + translate(width/2, height/2); + for (int i=0; i 0) { + letters = letters.substring(0, letters.length()-1); + } + } else if (textWidth(letters+key) < width) { + letters = letters + key; + } +} + +//class rain +class Rain { + float r = random(width); + float y = random(-height); + + void fall() { + y = y + 7; + // yellow + fill(255,255,0); + //red + //fill(255,0,0); + + //shape of ellipse + ellipse(r, y, 2, 10); + + if(y>height){ + r = random(width); + y = random(-200); + } + + } +} diff --git a/Debut/Agua/sketch.properties b/Debut/Agua/sketch.properties new file mode 100644 index 0000000..bf66ebc --- /dev/null +++ b/Debut/Agua/sketch.properties @@ -0,0 +1,2 @@ +mode=REPL Mode +mode.id=jm.mode.replmode.REPLMode diff --git a/Debut/Lefleur/Lefleur.pde b/Debut/Lefleur/Lefleur.pde new file mode 100644 index 0000000..7023c40 --- /dev/null +++ b/Debut/Lefleur/Lefleur.pde @@ -0,0 +1,128 @@ +//---------------------------------------------------------------------------- +import vsync.*; +import peasy.*; +import processing.serial.*; +import processing.sound.*; + +import ddf.minim.*; +import ddf.minim.analysis.*; +import ddf.minim.effects.*; +import ddf.minim.signals.*; +import ddf.minim.spi.*; +import ddf.minim.ugens.*; + +Minim minim; +AudioIn in2; +AudioInput in; +BeatDetect beat; +AudioPlayer song; + +PeasyCam cam; + +//initialize for Albers +static final int NUM_LINES = 40; +float t; +color line1 = color(45,55,47); +//color line2 = color(148,0,211); +color line2 = color(34,58,116); + + +PImage img; + +//---------------------------------------------------------------------------- +void setup() { + size(600, 600, P3D); + cam = new PeasyCam(this, 500); + + minim = new Minim(this); + //in = minim.getLineIn(Minim, STEREO, 1024); + beat = new BeatDetect(); + beat.setSensitivity(400); + + //Connect to Arduino + //myPort = new Serial(this, "/dev/cu.usbmodem14301", 9600); + //myPort.bufferUntil ( '\n' ); // Receiving the data from the Arduino IDE + + //Audio from synth + //in2 = new AudioIn(this,0); + //in2.start(); + //in2.play(); + //in = minim.getLineIn(); + + img = loadImage("palm.jpg"); + + song = minim.loadFile("/Users/sisi/Desktop/LiveCoding/Debut/Lefleur.mp3"); + song.play(); + song.loop(4); + +} + +void draw() { + background(0,123,62); + beat.detect(song.mix); //change to in.mix + + cam.beginHUD(); + for (int i = 0; i < width; i++) { + stroke(255, song.mix.get(i)*500); + line(i, height/2 + song.mix.get(i)*400, i, height/2 - song.mix.get(i)*400); + } + cam.endHUD(); + + + if (beat.isOnset()) { + background(254,219,0); + //Albers(); + //palm + image(img,-height/4,-width/4, 300,300); + + + } +} + +void Albers(){ + beat.detect(song.mix); + strokeWeight(1); + stroke(255); + translate(width/2, height/2); + for (int i=0; i<300; i++){ + stroke(line1); + line(x1(t+i)*2, y1(t+i)*2, x2(t+i)*2, y2(t+i)*2); + stroke(line2); + line(x3(t+i)*2, y3(t+i)*2, x4(t+i)*2, y4(t+i)*2); + } + //point(x1(t), y1(t)); + //point(x2(t), y2(t)); + t += 0.5; +} + +float x1(float t) { + return -sin(t/10)*100 + sin(t/ 5)*20; +} + +float y1(float t) { + return -cos(t/10)*100; +} + +float x2(float t) { + return sin(t/10)*200 + sin(t)*2; +} + +float y2(float t) { + return cos(t/20)*200 + cos(t/12)*20; +} + +float x3(float t) { + return sin(t/10)*100 + sin(t/ 5)*20; +} + +float y3(float t) { + return cos(t/10)*100; +} + +float x4(float t) { + return sin(t/10)*200 + sin(t)*2; +} + +float y4(float t) { + return cos(t/20)*200 + cos(t/12)*20; +} diff --git a/Debut/Lefleur/data/palm.jpg b/Debut/Lefleur/data/palm.jpg new file mode 100644 index 0000000..91fb3f4 Binary files /dev/null and b/Debut/Lefleur/data/palm.jpg differ diff --git a/Debut/Lefleur/sketch.properties b/Debut/Lefleur/sketch.properties new file mode 100644 index 0000000..bf66ebc --- /dev/null +++ b/Debut/Lefleur/sketch.properties @@ -0,0 +1,2 @@ +mode=REPL Mode +mode.id=jm.mode.replmode.REPLMode diff --git a/Debut/Nina/Nina.pde b/Debut/Nina/Nina.pde new file mode 100644 index 0000000..2c3da9c --- /dev/null +++ b/Debut/Nina/Nina.pde @@ -0,0 +1,227 @@ +// FOR PROCESSING +// looping song code reference: +// 1. http://www.andrew.cmu.edu/course/15-100mns/bn22.pdf +// 2. http://code.compartmental.net/minim/audioplayer_method_loop.html +// livecoding for visuals w/ processing tutorial by Kesson +// https://www.youtube.com/watch?v=fO1uW-xhwtA&t=303s +// MUSIC: NUCLEYA: download link: https://nucleya.bandcamp.com/album/bass-rani + +// sisixiyu x harshikajain + +//---------------------------------------------------------------------------- +import vsync.*; +import peasy.*; +import processing.serial.*; +import processing.sound.*; + +import ddf.minim.*; +import ddf.minim.analysis.*; +import ddf.minim.effects.*; +import ddf.minim.signals.*; +import ddf.minim.spi.*; +import ddf.minim.ugens.*; + +Minim minim; +AudioIn in2; +AudioInput in; +BeatDetect beat; +AudioPlayer song; + +//Serial myPort; //initialise variable myPort for serial communication +float changing_colour; + +PeasyCam cam; + +int loopcount; + +//initialize for Albers +static final int NUM_LINES = 40; +float t; +color line1 = color(45,55,47); +//color line2 = color(148,0,211); +color line2 = color(34,58,116); + +//---------------------------------------------------------------------------- +void setup() { + size(600, 600, P3D); + cam = new PeasyCam(this, 500); + + minim = new Minim(this); + //in = minim.getLineIn(Minim, STEREO, 1024); + beat = new BeatDetect(); + beat.setSensitivity(400); + + //Connect to Arduino + //myPort = new Serial(this, "/dev/cu.usbmodem14301", 9600); + //myPort.bufferUntil ( '\n' ); // Receiving the data from the Arduino IDE + + //Audio from synth + //in2 = new AudioIn(this,0); + //in2.start(); + //in2.play(); + //in = minim.getLineIn(); + + + song = minim.loadFile("/Users/sisi/Desktop/LiveCoding/Debut/Nina.mp3"); + song.play(); + song.loop(4); +} + +//---------------------------------------------------------------------------- +//void serialEvent (Serial myPort) { +// // Changing the background color according to received data +// changing_colour = float (myPort.readStringUntil ( '\n' ) ) ; +//} + +//---------------------------------------------------------------------------- +void draw() { + //comment the background in and out + //background(changing_colour, 150, 50); // Initial background color, when we will open the serial window + background(50, 50, 200); // Initial background color, when we will open the serial window + + + beat.detect(song.mix); + + + //cam.beginHUD(); + + //for (int i=0; i brushes; + +int maxparticles = 40000; + + +//---------------------------------------------------------------------------- +void setup() { + size(600, 600, P3D); + cam = new PeasyCam(this, 500); + + minim = new Minim(this); + //in = minim.getLineIn(Minim, STEREO, 1024); + beat = new BeatDetect(); + beat.setSensitivity(400); + + //Connect to Arduino + //myPort = new Serial(this, "/dev/cu.usbmodem14301", 9600); + //myPort.bufferUntil ( '\n' ); // Receiving the data from the Arduino IDE + + //Audio from synth + //in2 = new AudioIn(this,0); + //in2.start(); + //in2.play(); + //in = minim.getLineIn(); + + + song = minim.loadFile("/Users/sisi/Desktop/LiveCoding/Debut/Uyan.mp3"); + song.play(); + song.loop(4); + + flowfield = new FlowField(50); + brushes = new ArrayList(); + +} + +void draw() { + background(0); + beat.detect(song.mix); //change to in.mix + + cam.beginHUD(); + + //calm flow + for (int i = 0; i < brushes.size (); i++) { + PaintBrush v = brushes.get(i); + v.follow(flowfield); + v.run(); + if (v.isDead()) { + brushes.remove(i); + } + } + addBrushes(); + + + for (int i=0; i= 0.2 && r < 0.4) { + col = color(#8cafd9); + } else if (r >= 0.4 && r < 0.6) { + col = color(#2e48b6); + } else if (r >= 0.6 && r < 0.8) { + col = color(#486dd5); + } else { + col = color(#c8e4f2); + } + } + + public void run() { + update(); + borders(); + display(); + } + + + // Implementing Reynolds' flow field following algorithm + // http://www.red3d.com/cwr/steer/FlowFollow.html + void follow(FlowField flow) { + // What is the vector at that spot in the flow field? + PVector desired = flow.lookup(location); + // Scale it up by maxspeed + desired.mult(maxspeed); + // Steering is desired minus velocity + PVector steer = PVector.sub(desired, velocity); + steer.limit(maxforce); // Limit to maximum steering force + applyForce(steer); + } + + void applyForce(PVector force) { + // We could add mass here if we want A = F / M + acceleration.add(force); + } + + // Method to update location + void update() { + // Update velocity + velocity.add(acceleration); + // Limit speed + velocity.limit(maxspeed); + location.add(velocity); + // Reset accelertion to 0 each cycle + acceleration.mult(0); + } + + void display() { + stroke(col, 175); + strokeWeight(5); + point(location.x, location.y); + } + + // Wraparound + void borders() { + if (location.x < 0-200 || location.x > width+200 || location.y < 0-200 || location.y > height+200) { + dead = true; + } else { + dead = false; + } + } + + boolean isDead() { + return dead; + } +} + +class FlowField { + + // A flow field is a two dimensional array of PVectors + PVector[][] field; + int cols, rows; // Columns and Rows + int resolution; // How large is each "cell" of the flow field + + FlowField(int r) { + resolution = r; + // Determine the number of columns and rows based on sketch's width and height + cols = width/resolution; + rows = height/resolution; + field = new PVector[cols][rows]; + init(); + } + + void init() { + // Reseed noise so we get a new flow field every time + noiseSeed((int)random(10000)); + float xoff = 0; + for (int i = 0; i < cols; i++) { + float yoff = 0; + for (int j = 0; j < rows; j++) { + float theta = map(noise(xoff,yoff),0,1,0,TWO_PI); + // Polar to cartesian coordinate transformation to get x and y components of the vector + field[i][j] = new PVector(cos(theta),sin(theta)); + yoff += 0.1; + } + xoff += 0.1; + } + } + + PVector lookup(PVector lookup) { + int column = int(constrain(lookup.x/resolution,0,cols-1)); + int row = int(constrain(lookup.y/resolution,0,rows-1)); + return field[column][row].get(); + } + + +} diff --git a/Debut/Uyan/sketch.properties b/Debut/Uyan/sketch.properties new file mode 100644 index 0000000..bf66ebc --- /dev/null +++ b/Debut/Uyan/sketch.properties @@ -0,0 +1,2 @@ +mode=REPL Mode +mode.id=jm.mode.replmode.REPLMode