A Processing sketch to an Isadora stage
-
I am new to Processing. I have a Processing 2.1.1 sketch running a flocking algorithm and I would like to get it onto an Izzy stage. Is the Syphon server Izzy actor the way to go? Is there a Processing library I need? Do I need to write code for my Processing sketch? I have searched the Isadora and Processing forums without success. Thanks for your assistance.
-
Dear Vanderzee,
You need to use either the Syphon to Video or Syphon to Image actors to receive the image.This post seems to cover getting Syphon Output from Processing. http://forum.garagecube.com/viewtopic.php?f=20&t=7924Once you've achieved that, it should be a simple matter to use the Sypon to Video or Syphon to Image actors to receive the image.Best Wishes,Mark -
Processing over syphon to isadora is definitely the way to go and works very well
you will need the libs for processing: https://code.google.com/p/syphon-implementations/downloads/listand this might be useful: http://codeanticode.wordpress.com/2012/02/21/syphon-client-working-in-processing/if you get that example going, you should be seeing that same syphon stream in isadora with the actors mark mentioned.fubbi -
Excellent! I have downloaded the library and successfully run the Syphon server demo into Izzy. I found a tutorial (http://lab.millumin.com/tutorials/?name=processing) that contained the Processing code necessary to create the server. I can work backwards from this to get the code I need in my sketch. This Millumin app looks interesting. Anyone with experience? I will investigate later.
Thanks for the tips! -
@Vanderzee
I have been using Syphoner to get about any software/video stream on my screen into Isadora, including Processing:
http://syphoner.sigma6.ch/ -
@stj : I am looking at the Syphoner demo later today. Thanks.
-
A simpler, but more limited method, that I've used is to record your Processing sketch using saveFrame in the Draw loop, and then use Movie Maker to create a mov file from the saved images.
e.g. saveFrame("/Users/eric/Documents/Processing/images/evo/####.tiff"); -
@vanderzee, Camtwist 2.5 (for free) uses screen grab, desktop, plus syphon out, and the camera in also works with Isadora. Processing with OSC is simple to use, syphon out is more difficult. thanks for the inspiration.
-
or just use syphoner: http://syphoner.sigma6.ch/
streams out any window -
SYPHONER is not a good way to go. Latest cam twist supports syphon.
-
Interesting comments. Thanks everyone. I think creating a Syphon server in my Processing code and using Izzy's Syphon Server actor is the way I'm going. Here is a simple example of a rotating cube:
import codeanticode.syphon.*;PGraphics canvas;SyphonServer server;void setup(){size(400,400, P3D);canvas = createGraphics(400, 400, P3D);// Create syhpon server to send frames out.server = new SyphonServer(this,"eureka");}void draw(){canvas.beginDraw();canvas.background(0);canvas.lights();canvas.translate(width/2, height/2);canvas.rotateX(frameCount * 0.009);canvas.rotateY(frameCount * 0.009);canvas.box(200);canvas.endDraw();image(canvas,0,0);server.sendImage(canvas);} -
import codeanticode.syphon.*;
import oscP5.*;import netP5.*;PGraphics canvas;SyphonServer server;OscP5 oscP5;NetAddress myBroadcastLocation;float factor;void setup(){
// DISPLAY SETUP
size(640, 480, P3D);
canvas = createGraphics(width, height, P3D);
initTheScene();
// SYPHON SETUP
server = new SyphonServer(this, "Processing Cube");
// OSC SETUP
oscP5 = new OscP5(this, 5001);
myBroadcastLocation = new NetAddress("127.0.0.1", 5000);
factor = 1;
}
// RENDER AND SEND TO SYPHON
void draw()
{
canvas.beginDraw();
renderTheScene();
canvas.endDraw();
image(canvas, 0, 0);
server.sendImage(canvas);
}
// SEND ORDER TO MILLUMIN
void mouseMoved()
{
OscMessage myOscMessage = new OscMessage("/millumin/layer/opacity/0");
myOscMessage.add(100*mouseX/width);
oscP5.send(myOscMessage, myBroadcastLocation);
}
// RECEIVE ORDER FROM MILLUMIN
void oscEvent(OscMessage theOscMessage)
{
if ( theOscMessage.addrPattern().equals("/millumin/layer/scale/0") )
{
factor = theOscMessage.get(0).floatValue()/100;
}
}
-
rest of the code, must be put together, was too much for one message, sorry, can post the txt file as zip.
void initTheScene() {
}
void renderTheScene() {
background(0);
noStroke();
rect(0, 0, width, height);
float sine = sin(phasor * TWO_PI);
float angle = map(sine, -1.0, 1.0, -HALF_PI, HALF_PI);
float divPoint = map(sine, -1.0, 1.0, 1.0, 0.5);
for (int i = 0; i < nBranches; i++) {
float L = startingLength;
float a = TWO_PI / (float) nBranches * (float) i;
PVector v1 = new PVector(width / 2, height / 2);
PVector v2 = getVCoordinates(v1, L, a);
while (L > 2) {
canvas.stroke(random(255), 255, 0, 32);
L *= 0.95;
canvas.line(v1.x, v1.y, v2.x, v2.y);
a += angle;
v1.x = lerp(v1.x, v2.x, divPoint);
v1.y = lerp(v1.y, v2.y, divPoint);
v2 = getVCoordinates(v1, L, a);
}
}
phasor += rate;
if (phasor >= 1.0) {
phasor -= 1.0;
}
}
-
@rainbow: I copy/pasted your code and I get an error at line 87, "cannot find anything named "phasor". I am a Processing beginner with no debugging skills yet. Can you help? Also can you describe what your sketch does? Thanks.
-
@vanderzee: sorry some code is missing, I used Gras.pde and Organic.pde for examples, also a Processing beginner.
thanks for the inspiration.rainbow -
@rainbow: just took a quick look. i'm traveling for next couple days. i will look carefully when i get to my studio. thx.
-
Millumin ia a very nice piece of software. Not really a competitor for Isadora. because less interactivity, no 3D, but it is very simple, well structured, timeline based and does softedge, osc, midi, syphon. It is a great player and does some real time too. I was surprised. The programmer is great, (lives in Lyon, France) responsive and very generous. The soft is quite expensive (double that izzy las time I saw).
By the way, I tried your code and as strange as it seems processing syphons out to mad mapper but doesn't in Isadora... any clue?Thanks -
Well, on my hardware its working, I am beginner, and share some knowledge, I just like Processing syphon oSC tools ;)
-
@Armando: this processing code sends the rotating cube to an izzy syphon to video actor and projector and shows on stage 1. I cannot comment on MadMapper.
import codeanticode.syphon.*;PGraphics canvas;SyphonServer server;void setup(){size(400,400, P3D);canvas = createGraphics(400, 400, P3D);// Create syhpon server to send frames out.server = new SyphonServer(this,"eureka");}void draw(){canvas.beginDraw();canvas.background(0);canvas.lights();canvas.translate(width/2, height/2);canvas.rotateX(frameCount * 0.009);canvas.rotateY(frameCount * 0.009);canvas.box(200);canvas.endDraw();image(canvas,0,0);server.sendImage(canvas);} -
Thanks. Vanderzee the problem might be on my version I'm testing a higher prerelease. Your code works on on syphon recorder, works on mad mapper but doesn't in my version. I'll file a bug report.
Thanks So this is the code for the CI and the Texture. Bur it is not the code for the video actors isn't it? It works (partially only with image and texture actors.