Author Archives: Joseph Samuels

JS Final – Sliding Images Music of Rachels and Images of Egon Schiele

Here is Version 3 of my Slide Show algorithm!

 

This Program works simply by using one of the two slide potentiometers to control the picture on screen as well as the music in the background. The volume level of the sample just called as well as the volume level of the background music can be controlled.

 

It’s the prototype for an Art Installation that requires user participation to “mix” the music with these selectable fragments/

 

Problems: Overall it was not too challenging getting everything working, the only hurdle encountered was truly getting a grasp for how the serial commands work. The handshake between the serial port and processing can be tricky which is why a number of lines of code are needed to make sure the data streams are lined up properly. I was accidently streaming data in before the system was ready to accept any data, that lead to a number of issues that were cleanly resolved with a if statement that checked if the data stream was truly ready to be read in.

 

In regards to the program I will hit some of the highlight functions. I built a custom class duoPA that was able to load in the music files as well as the pictures and pair them together. So whenever my sample selector would select a point it would be referencing two files. Also have a pixel scrambler running in the background as well as a function that randomly selects sections of a loaded in picture and throw it into the main screen. Everything is controlled by millis() and modulo division looking for zero for timing.

 

It was a ton of fun getting this all working and I can’t wait to ship out v4!

 

-JS

 

 

What Programming Means to Me – JS

What Programming Means to me?

Coding in and of itself is a very simple idea; manipulation of the binary states that an object can exist in to create something greater than itself. In light of developing new medias in combination with fast processing power, programming is quickly becoming a bottomless pit worth of potential.

With respect to new media such as 3D processes, Virtual Reality, even the simple script of most of the internet (javascript), one can easily see the diversity coding allows for coupled with the depth of design that can exist. Even in this class where a very high level language such as Processing is used, one can easily see that we barely scraped the surface in the realm of possibility of what can be done withint this paradigm.

All in all, programming is not an end in itself for me; I believe programming is a tool to create more tools to enrich our ability to create – and more importantly- recreate media of the past. A simple example that was provided in the Manovich reading alludes to the evolution of the cinema and how over time we have managed to digitize most aspects of the analog realm in respect to movies. This recreation of cinema allows for a greater source level control of the media (ie. more exciting and realistic CGI).

For example, in my code City of Acid I have the flexibility and freedom to completely alter the state of the image all within the computers realm of control. It was a totally hands off process for me because the computer was able to take the instructions and create at my will.

This very simple manipulation of binary states became able to manipulate something very complex. Moving forward, I will continue to code and learn more about it as all media is moving towards the world of digitization just because of the amount of power and control it affords the user to have over their creations. And as programming languages approach an even higher level that arne’t based in text editing; for example something akin to a protools, a photoshop, or even a MAX/MSP; more users will be able to create and manipulate their media without having to learn how to code. On top of this, the amount of control these “higher” level languages have is ever increasing, soon controlling and creating all media will move to a point where learning the text coding will become an artifact of the past.

Image

Let the Bubbles Hit the Floor ~

Hey Y’all Below is the Code for both Arduino and Process for a Simple Button that spawns a bubble while the wiper from the motor dictates the speed/direction the bubble is flung against the imaginary walls.

Please Feel Free to Ask Any Questions!

 

-JS

 

Dribbling Basketball Code

Hey Y’all,

Here is my ball bouncing off the wall(s)! There are 2 Examples of the Code Working. One is as a Normal Basketball the next is as a Rainbow Ball.

Please Feel Free to ask any questions. Thanks! (By the Way the Video will be Choppy, the code doesn’t run choppy though).

 

Dribbling_Basketball

final float g= 9.807;
final float time_to_run = 10000;//Changes How Long the Program Runs(Keep Value >10000)
float iniX;
float iniY;
float xPos;
float yPos;
float xDir = 1;
float yDir = 1;
int curMinHeight = 0;
float time;
float time_of_run;
float speedconstraint;
int time_check = 0;
boolean lets_go = false;
float yUpdate;

void setup(){
size(800,600,P3D);//Includes 3D for Sphere
background(#FFFFFF);
xPos= random(10,width/2);//Picks a Random Point to Start Bouncing Ball
iniX = xPos;//Saves the Initial points
yPos=random(200,height/2);
iniY = yPos;
time = millis();//Keeping Track of Time
}
void draw(){
println(time_to_run-time);//CountDown Timer
drawBall();//Draw Ball
updateBall();//Update Ball Position
yUpdate = gravityBall(yPos,yDir);//Changes Speed of Ball
yDir = yUpdate;
checkBounds();//Sees where Ball is
stopball();//Stops Ball if Time comes
// if((mouseX >= xPos+100 || mouseX <= xPos-100) && (mouseY >= yPos+100 || mouseY <= yPos-100)){
// println(“got it”);
}
void drawBall(){
background(#000000);
fill(#EF5328);//Basketball Orange
//fill(color(random(0,255),random(0,255),random(0,255)));//Rainbowsnake
smooth();
lights();//For 3D
translate(xPos,yPos,0);// Pust Ball in Correct Position
sphere(50);
//ellipse(xPos,yPos,50,50);
//line(xPos,yPos,50,50);
}
void updateBall(){
xPos = xPos+xDir;
yPos = yPos+yDir;
}
void checkBounds(){
if(xPos> width ){
xDir = xDir*-1;// Change Direction of Ball
}
if (xPos<0){
xDir = xDir*-1;//Change Direction of Sign
}
if (yPos> height){
yDir = yDir*-1; //change Direction of Sign
time = millis();//Updates Time
}
if (yPos<curMinHeight){//Lowers the Ceiling so Ball Drops Better
yDir = yDir*-1; // change direction of sign
}
}
float gravityBall( float y, float yd){
float temp;
speedconstraint = ((100000-time)/100000);// Arbitrary Rate for Ball to Slow Down
if(lets_go){//
temp = (.1* sqrt(2*g*(millis()-time))) * speedconstraint;//Basically Uses the Distance Traveled Since Hitting the Bottom to Adjust Speed
}
else
temp = (.1* sqrt(2*g*(millis()-time))) * speedconstraint*((time/time_to_run)+1);//Same as Above but Increases Speed as the Ceiling Gets Lower
if(yd<0) temp = temp*-1;//Makes sure is not NAN
return temp;
}
void stopball(){
curMinHeight = round((time/time_to_run)*height);//Current Ceiling Height
if (curMinHeight>=height/10) lets_go=true;//Tells the Ball to Speed Up
if(curMinHeight>=height){//Stops the Ball
yPos= height;
yDir = 0;
xDir = 0;
//Tells How Far the Ball has Traveled
println(“Starting Position:” , iniX , iniY);
println(“Ending Position:” , xPos, yPos);
println(“X Distance Traveled”, abs(iniX-xPos));
}
}

Code for Image Manipulation

PImage face;
float redValavg;
float greenValavg;
float blueValavg;
color buf;
int randp1;
color hold;
boolean same_face = true;
int pos_lr = 0;
int pos_ud = 0;
int dimension;
int pix_mix=2;
void setup() {
size(640, 426);
face = loadImage(“Joe_Face_2.jpg”);
}
void draw() {
image(face, pos_lr, pos_ud);
}

void keyPressed(){
if( key == ‘v’){// Exchanges Pixels Randomly
dimension = face.width * face.height;
face= sameface(face);
face.loadPixels();
for (int i = 0; i < dimension; i += pix_mix) {
randp1=round(random(0,dimension-1));
hold = face.pixels[i];
face.pixels[i] = face.pixels[randp1];
face.pixels[randp1]=hold;
}
face.updatePixels();
}
if( key == ‘t’) same_face= !same_face; //Resets to FirstState
if ( key == ‘b’){ //Adds Random Colors instead of Pixels;
face= sameface(face);
dimension = face.width * face.height;
face.loadPixels();
for (int i = 0; i < dimension; i += pix_mix) {
face.pixels[i] = color(0, 0, 0);
redValavg = random(0,255);
greenValavg= random(0,255);
blueValavg=random(0,255);
buf= color(redValavg,greenValavg,blueValavg);
if(i%2==0)face.pixels[i]=buf;
}
face.updatePixels();

}
if( key ==’c’){// Darkens
face= sameface(face);
dimension = face.width * face.height;
face.loadPixels();
for (int i = 0; i < dimension; i += pix_mix) {
face.pixels[i] = color(0, 0, 0);
}
face.updatePixels();

}
if( key ==’x’){// Brightens
face= sameface(face);
dimension = face.width * face.height;
face.loadPixels();
for (int i = 0; i < dimension; i += pix_mix) {
face.pixels[i] = color(255, 255, 255);
}
face.updatePixels();

}
//Moving the Image
if( keyCode == UP){
background(#FFFFFF);
pos_ud+=50;
}
if( keyCode == DOWN){
background(#FFFFFF);
pos_ud-=50;
}
if( keyCode == RIGHT){
background(#FFFFFF);
pos_lr+=50;
}
if( keyCode == LEFT){
background(#FFFFFF);
pos_lr-=50;
}
//pix_mix
if(key == ‘a’){
pix_mix=2*pix_mix;
println(“pixel num:” + pix_mix);
}
if(key == ‘s’){
if(pix_mix>1)pix_mix=pix_mix/2;
println(“pixel num:” + pix_mix);
}
if( key ==’m’) setup();

}

PImage sameface(PImage option){
if(same_face) return option;
return option = loadImage(“Joe_Face_2.jpg”);
}

Joe’s Medicine Ball Switch

Video is short and sweet, but please feel free to ask any questions!