Code Processing BeatWear PDF .pdf



Nom original: Code Processing BeatWear PDF.pdfTitre: Code Processing BeatWearAuteur: Lirat Mulaj

Ce document au format PDF 1.3 a été généré par TextEdit / Mac OS X 10.6.8 Quartz PDFContext, et a été envoyé sur fichier-pdf.fr le 21/06/2012 à 10:55, depuis l'adresse IP 78.29.x.x. La présente page de téléchargement du fichier a été vue 1276 fois.
Taille du document: 28 Ko (6 pages).
Confidentialité: fichier public


Aperçu du document


import oscP5.*;
import netP5.*;
import processing.serial.*;
int portToListenTo = 9001;
int portToSendTo = 9000;
String ipAddressToSendTo = "localhost";
Serial myPort;
serialcom sc;
String [] q = new String [6];
OscP5 oscP5;
NetAddress myRemoteLocation;
OscBundle myBundle;
OscMessage myMessage;
boolean mouseDown;
PFont f;
int track = 0;
int clip = 0;
boolean touchSense = false;
int timer = 0;
int ImageValue = 0;
PImage img;
PImage abc;
PImage imgsmall;
PImage imgempty;
int cellsize = 3;
int columns, rows;
PFont font;
//////////////////////////////////////////////////////
void setup() {
size(1000,800);
img = loadImage("red-heart.png");
abc = loadImage("concert-wallpaper.png");
imgsmall = loadImage("red-heart_small.png");
imgempty = loadImage("Modif Heart.png");
f = loadFont("BlairMdITCTT-Medium-30.vlw");
columns = img.width / cellsize;
rows = img.height / cellsize;

myPort = new Serial(this, "/dev/tty.usbserial-A700flA3", 115200);
sc = new serialcom(myPort);
oscP5 = new OscP5(this,portToListenTo);
myRemoteLocation = new NetAddress(ipAddressToSendTo, portToSendTo);
myBundle = new OscBundle();
myMessage = new OscMessage("/");
mouseDown = false;
}
////////////////////////////////////////////////////////
void draw() {
background(0);
/*for (int k = 0; k < 50; k++){
ImageValue++;
if(ImageValue > 1000){
//println("bzzz");
ImageValue = 0;
}
}
// Begin loop for columns
for ( int i = 0; i < columns; i++) {
// Begin loop for rows
for ( int j = 0; j < rows; j++) {
int x = i*cellsize + cellsize/2; // x position
int y = j*cellsize + cellsize/2; // y position
int loc = x + y*img.width; // Pixel array location
color c = img.pixels[loc]; // Grab the color
// Calculate a z position as a function of mouseX and pixel brightness
float z = (ImageValue / float(width)) * brightness(img.pixels[loc]) - 20.0;
// Translate to the location, set fill and stroke, and draw the rect
pushMatrix();
translate(x + width/4, y + height/4, z);
fill(c, 204);
noStroke();
rectMode(CENTER);
rect(0, 0, cellsize, cellsize);
popMatrix();
}
}*/
//img = loadImage("red-heart.png");
imageMode(CENTER);
image (abc, width/2, height/2);

imageMode(CENTER);
image (img, width/2, height/2);
//font = loadFont("Arial-Black-24.vlw");
q = sc.takeinformation();
int q0 = Integer.parseInt(q[0]);
int q1 = Integer.parseInt(q[1]);
int q2 = Integer.parseInt(q[2]);
int q3 = Integer.parseInt(q[3]);
int q4 = Integer.parseInt(q[4]);
textFont(f,16);
fill(0);
textAlign(CENTER);
text("Fréquence cardiaque: "+q0+" BPM", width/2, 260);
textAlign(CENTER);
boolean send = false;
// NEXT CLIP ---------------------------------------------------if(q1 > 1000 && touchSense == false){
//println("bzzz");
touchSense = true;
clip++;
if(clip == 4){
clip = 0;
}
myMessage.setAddrPattern("/live/play/clip");
myMessage.add(track);
myMessage.add(clip);
myBundle.add(myMessage);
myMessage.clear();
send = true;
//clip++;
}
// PREVIOUS CLIP -----------------------------------------------if(q2 > 1000 && touchSense == false){
touchSense = true;
clip--;
if(clip == -1){
clip = 4;
}
myMessage.setAddrPattern("/live/play/clip");
myMessage.add(track);
myMessage.add(clip);
myBundle.add(myMessage);

myMessage.clear();
send = true;
//clip--;
}
// STOP MUSIC ------------------------------------------------if(q3 > 1000 && touchSense == false){
touchSense = true;
myMessage.setAddrPattern("/live/stop");
myBundle.add(myMessage);
myMessage.clear();
send = true;
}
// CONTINUE PLAYING MUSIC --------------------------------------if(q4 > 1000 && touchSense == false){
touchSense = true;
myMessage.setAddrPattern("/live/play/continue");
myBundle.add(myMessage);
myMessage.clear();
send = true;
}
// TIMER -------------------------------------------------------if(touchSense == true){
timer++;
if(timer == 25){
touchSense = false;
timer = 0;
}
}
// HEART RATE TEMPO 100 -----------------------------------------if(q0>=55 && q0<=72){
image (imgsmall, 100, 450);
image (imgsmall, 900, 450);
image (imgempty, 100, 350);
image (imgempty, 900, 350);
image (imgempty, 100, 250);
image (imgempty, 900, 250);
image (imgempty, 100, 150);
image (imgempty, 900, 150);
image (imgempty, 100, 50);
image (imgempty, 900, 50);
textAlign(CENTER);
text("TEMPO 100", width/2, height/2);
myMessage.setAddrPattern("/live/tempo");
myMessage.add(100);
myBundle.add(myMessage);
myMessage.clear();
send = true;

}
// HEART RATE TEMPO 120 -----------------------------------------if(q0>72 && q0<=89){
image (imgsmall, 100, 450);
image (imgsmall, 900, 450);
image (imgsmall, 100, 350);
image (imgsmall, 900, 350);
image (imgempty, 100, 250);
image (imgempty, 900, 250);
image (imgempty, 100, 150);
image (imgempty, 900, 150);
image (imgempty, 100, 50);
image (imgempty, 900, 50);
textAlign(CENTER);
text("TEMPO 120", width/2, height/2);
myMessage.setAddrPattern("/live/tempo");
myMessage.add(120);
myBundle.add(myMessage);
myMessage.clear();
send = true;
}
// HEART RATE TEMPO 140 -----------------------------------------if(q0>89 && q0<=106){
image (imgsmall, 100, 450);
image (imgsmall, 900, 450);
image (imgsmall, 100, 350);
image (imgsmall, 900, 350);
image (imgsmall, 100, 250);
image (imgsmall, 900, 250);
image (imgempty, 100, 150);
image (imgempty, 900, 150);
image (imgempty, 100, 50);
image (imgempty, 900, 50);
textAlign(CENTER);
text("TEMPO 140", width/2, height/2);
myMessage.setAddrPattern("/live/tempo");
myMessage.add(140);
myBundle.add(myMessage);
myMessage.clear();
send = true;
}
// HEART RATE TEMPO 160 -----------------------------------------if(q0>106 && q0<=125){
image (imgsmall, 100, 450);
image (imgsmall, 900, 450);
image (imgsmall, 100, 350);
image (imgsmall, 900, 350);

image (imgsmall, 100, 250);
image (imgsmall, 900, 250);
image (imgsmall, 100, 150);
image (imgsmall, 900, 150);
image (imgempty, 100, 50);
image (imgempty, 900, 50);
textAlign(CENTER);
text("TEMPO 160", width/2, height/2);
myMessage.setAddrPattern("/live/tempo");
myMessage.add(160);
myBundle.add(myMessage);
myMessage.clear();
send = true;
}
// HEART RATE TEMPO 180 -----------------------------------------if(q0>125 && q0<=140){
image (imgsmall, 100, 450);
image (imgsmall, 900, 450);
image (imgsmall, 100, 350);
image (imgsmall, 900, 350);
image (imgsmall, 100, 250);
image (imgsmall, 900, 250);
image (imgsmall, 100, 150);
image (imgsmall, 900, 150);
image (imgsmall, 100, 50);
image (imgsmall, 900, 50);
textAlign(CENTER);
text("TEMPO 180", width/2, height/2);
myMessage.setAddrPattern("/live/tempo");
myMessage.add(180);
myBundle.add(myMessage);
myMessage.clear();
send = true;
}

/* send the bundle*/
if (send)
oscP5.send(myBundle, myRemoteLocation);
myBundle.clear();

}


Aperçu du document Code Processing BeatWear PDF.pdf - page 1/6

Aperçu du document Code Processing BeatWear PDF.pdf - page 2/6

Aperçu du document Code Processing BeatWear PDF.pdf - page 3/6

Aperçu du document Code Processing BeatWear PDF.pdf - page 4/6

Aperçu du document Code Processing BeatWear PDF.pdf - page 5/6

Aperçu du document Code Processing BeatWear PDF.pdf - page 6/6




Télécharger le fichier (PDF)


Télécharger
Formats alternatifs: ZIP Texte



Documents similaires


code processing beatwear pdf
style paletttejlb 28 10 2012t bloc notes
for sale
stackoverflow com questions 27110158 how to center group of
specs formats applications natives 28012015
cours css3

Sur le même sujet..




🚀  Page générée en 0.009s