Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import codeanticode.syphon.*;
SyphonServer server;
import ddf.minim.*;
AudioPlayer player;
Minim minim;//audio context
PImage YEL;
PImage BLUE;
PImage RED;
float x;
float y;
float alpha;
ArrayList<PImage> yImg;
ArrayList<PImage> bImg;
ArrayList<PImage> rImg;
float yPosition[][];
float bPosition[][];
float rPosition[][];
int count1;
int count2;
int count3;
boolean bState = false;
boolean yState = false;
boolean rState = false;
void setup()
{
size(500, 800, P3D);
minim = new Minim(this);
player = minim.loadFile("Frank_Sinatra-LOVE(mp3vip.eu).mp3", 2048);
smooth();
yImg = new ArrayList<PImage>();
YEL = loadImage("yellow.png");
bImg = new ArrayList<PImage>();
BLUE = loadImage("blue.png");
rImg = new ArrayList<PImage>();
RED = loadImage("red.png");
yPosition = new float[100000][2];
bPosition = new float[100000][2];
rPosition = new float[100000][2];
//println(Serial.list());
server = new SyphonServer(this, "Processing Syphon");
}
void draw()
{
background(0);
for (int n = 0; n < yImg.size (); n+=6)
{
image(yImg.get(n), yPosition[n][0], yPosition[n][1]);
yPosition[n][1] -= 3;
}
for (int n = 0; n < bImg.size (); n+=6)
{
image(bImg.get(n), bPosition[n][0], bPosition[n][1]);
bPosition[n][1] -= 3;
}
for (int n = 0; n < rImg.size (); n+=6)
{
image(rImg.get(n), rPosition[n][0], rPosition[n][1]);
rPosition[n][1] -= 3;
}
if (yState)
{
x = random(0, width);
y = height;
yImg.add(count1, YEL);
yPosition[count1][0] = x;
yPosition[count1][1] = y;
count1++;
}
if (bState)
{
x = random(0, width);
y = height;
bImg.add(count2, BLUE);
bPosition[count2][0] = x;
bPosition[count2][1] = y;
count2++;
}
if (rState)
{
x = random(0, width);
y = height;
rImg.add(count3, RED);
rPosition[count3][0] = x;
rPosition[count3][1] = y;
count3++;
}
server.sendScreen();
}
void keyPressed()
{
if(key == 'b')
{
bState = true;
}
if(key == 'y')
{
yState = true;
}
if(key == 'r')
{
rState = true;
}
if(key == 'p')
{
player.play();
}
if(key =='s')
{
stop();
}
}
void play()
{
}
void stop()
{
player.close();
minim.stop();
super.stop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.