Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bayan #2

Open
wants to merge 3 commits into
base: Bayan
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified java/bin/.DS_Store
Binary file not shown.
169 changes: 123 additions & 46 deletions java/src/ie/tudublin/Audio1.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
package ie.tudublin;
/*package ie.tudublin;



import ddf.minim.AudioBuffer;
import ddf.minim.AudioInput;
import ddf.minim.AudioPlayer;
import ddf.minim.Minim;
import processing.core.PApplet;
import ddf.minim.analysis.*;
//import ddf.minim.*;
//import ddf.minim.signals.*;


public class Audio1 extends PApplet
{
Minim minim;
AudioPlayer ap;
AudioInput ai;
AudioBuffer ab;
FFT fft;
Minim m;

float n4;
float n6;

float radius1 = 150;
float radius2 = 75;


int mode = 0;

Expand All @@ -37,7 +52,9 @@ public void keyPressed() {

public void settings()
{
size(1024, 1000); //fullScreen(P3D, SPAN);
size(1024, 1000);
//fullScreen(P3D, SPAN);
noStroke();
}

public void setup()
Expand All @@ -52,25 +69,26 @@ public void setup()
ap.play();
ab = ap.mix;
colorMode(HSB);
noCursor();
smooth();
frameRate(24);

y = height / 2;
smoothedY = y;

for (int i = 0; i < planets.length; i++ ) {
planets[i] = new Planet(64 + i*32,24);
/* for (int i = 0; i < planets.length; i++ ) {
planets[i] = new Plane();
}
}




float off = 0;

float lerpedBuffer[] = new float[1024];
float lerpedBuffer[] = new float[1024];*/

public void draw()
/*public void draw()
{
//background(0);
}
/* //background(0);
float halfH = height / 2;
float average = 0;
float sum = 0;
Expand All @@ -94,28 +112,28 @@ public void draw()

switch (mode) {
case 0:
background(0);
for(int i = 0 ; i < ab.size() ; i ++)
{
//float c = map(ab.get(i), -1, 1, 0, 255);
float c = map(i, 0, ab.size(), 0, 255);
stroke(c, 255, 255);
float f = lerpedBuffer[i] * halfH * 4.0f;
line(i, halfH + f, i, halfH - f);
}
break;
background(0);
for(int i = 0 ; i < ab.size() ; i ++)
{
//float c = map(ab.get(i), -1, 1, 0, 255);
float c = map(i, 0, ab.size(), 0, 255);
stroke(c, 255, 255);
float f = lerpedBuffer[i] * halfH * 4.0f;
line(i, halfH + f, i, halfH - f);
}
break;
case 1:
background(0);
int from = color(255, 0, 0);
int to = color(0, 255);
int c1 = lerpColor(from, to, (float) 0.33);
int c2 = lerpColor(from, to, (float) 0.66);
for (int i = 0; i < 15; i++) {
fill(from);
quad(
random(-40, 220), random(height),
random(-40, 220), random(height),
random(-40, 220), random(height),
int from = color(255, 0, 0);
int to = color(0, 255);
int c1 = lerpColor(from, to, (float) 0.33);
int c2 = lerpColor(from, to, (float) 0.66);
for (int i = 0; i < 15; i++) {
fill(from);
quad(
random(-40, 220), random(height),
random(-40, 220), random(height),
random(-40, 220), random(height),
random(-40, 220), random(height)
);
fill(c1);
Expand Down Expand Up @@ -158,23 +176,77 @@ public void draw()
break;

case 3:
background(0);
// Drawing the Sun
pushMatrix();
translate(width/2,height/2);
stroke(0);
background(0);
fill(0,50);
noStroke();
rect(0, 0, width, height);
translate(width/2, height/2);

for (int i = 0; i < ap.bufferSize() - 1; i++) {

float angle = sin(i+n4)* 10;
float angle2 = sin(i+n6)* 300;

float x = sin(radians(i))*(angle2+30);
float y = cos(radians(i))*(angle2+30);

float x3 = sin(radians(i))*(500/angle);
float y3 = cos(radians(i))*(500/angle);

fill (0, 0, 0, 90); //yellow
ellipse(x, y, ap.left.get(i)*10, ap.left.get(i)*10);

fill ( 255, 255, 255, 60); //wt
rect(x3, y3, ap.left.get(i)*20, ap.left.get(i)*10);

fill ( 255, 152, 0, 90); //orange
rect(x, y, ap.right.get(i)*10, ap.left.get(i)*10);

fill( 255, 255, 255, 70); //wt
rect(x3, y3, ap.right.get(i)*10, ap.right.get(i)*20);
}

n4 += 0.008;
n6 += 0.04;
break;

case 4:
noStroke();
noCursor();

fill(0, 100);
rect(0, 0, width, height);
fill(255);
ellipse(0,0,64,64);
translate(width / 2, height / 2);
for(int ang1 = 0; ang1 < 360; ang1 +=5)
{
float radian1 = radians(ang1);
pushMatrix();
translate(radius1 * cos(radian1), radius1 * sin(radian1));
for(float ang2 = 0; ang2 < 90; ang2 += 10){
float radian2 = (float) (radians(ang2) - frameCount * 0.02 + radian1);
ellipse(radius2 * cos(radian2), radius2 * sin(radian2), 2, 2);
}

// Drawing all Planets
for (int i = 0; i < planets.length; i++ ) {
planets[i].update();
planets[i].display();
}
popMatrix();
popMatrix();
saveFrame("line-######.png");
break;
}*/


/*case 4:
background(0);
int n=0;
translate (width/2,height/2);
for (int i = 0; i < ap. bufferSize () - 2; i++) {
rotate(n*-PI/200*0.1);
fill (255,0,0) ;
ellipse(i,i,ap. left.get (i) *50,ap. left.get (i) *50) ;
} n++;
break;

}
}*/


// Other examples we made in the class
/*
Expand All @@ -187,7 +259,12 @@ public void draw()
y += random(-10, 10);
smoothedY = lerp(smoothedY, y, 0.1f);
circle(200, smoothedY, 50);
*/


}
}




}
}
*/
6 changes: 3 additions & 3 deletions java/src/ie/tudublin/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ public class Main



public static void Audio1()
public static void test3()
{
String[] a = {"MAIN"};
processing.core.PApplet.runSketch( a, new Audio1());
processing.core.PApplet.runSketch( a, new test3());
}
public static void main(String[] args)
{
Audio1();
test3();
}
}
11 changes: 0 additions & 11 deletions java/src/ie/tudublin/ParticleSystem.java

This file was deleted.

14 changes: 0 additions & 14 deletions java/src/ie/tudublin/Planet.java

This file was deleted.

30 changes: 30 additions & 0 deletions java/src/ie/tudublin/project.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//package ie.tudublin;

/*public class project{
float radius1 = 150;
float radius2 = 75;

void setup(){
size(500, 500);
noStroke();
}

void draw(){
fill(0, 100);
rect(0, 0, width, height);
fill(255);
translate(width / 2, height / 2);
for(float ang1 = 0; ang1 < 360; ang1 += 5){
float radian1 = radians(ang1);
pushMatrix();
translate(radius1 * cos(radian1), radius1 * sin(radian1));
for(float ang2 = 0; ang2 < 90; ang2 += 10){
float radian2 = radians(ang2) - frameCount * 0.02 + radian1;
ellipse(radius2 * cos(radian2), radius2 * sin(radian2), 2, 2);
}
popMatrix();
saveFrame("line-######.png");

}
}
}*/
Loading