Syphon Available Errors in Processing

Home Forums Syphon Syphon Implementations – User Syphon Available Errors in Processing

Tagged: ,

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • #59002

    I have been experiencing trouble using the syphon.Available() in Processing.

    I am trying to use it to check if there is an available syphon feed, if so, read it. If not, use another image.

    This runs, but it produces errors where the statements switch back and forth rapidly almost as if it is alternating between true and false even though there is no disruption in the feed. I added the code below. I am wondering if I am doing something wrong or if this is a limitation in Processing.

    The feed coming into the sketch is from another Processing App that reads it from the camera. Using the Simple Syphon Client shows the disruption as well.

    I have a youtube video pending upload that shows this in action.

    import controlP5.*;
    import codeanticode.syphon.*;
    SyphonClient syphonIn;
    SyphonServer syphonOut;
    ControlP5 cp5;
    PGraphics canvas;
    PImage  rawImg, defaultImg;
    Boolean syphonState = false;
    // GUI Variables
    boolean render = true;
    int threshold = 82;
    void setup() {
      size(640, 640, P3D);
      // Create a place to draw everything
      canvas = createGraphics(320, 320, P3D);
      // Create Syphon Client for specific source
      //  syphonIn = new SyphonClient(this, "Sandbox_Soft_Server", "Sandbox Soft Server");
      // Create Syphon Client for any source
      syphonIn = new SyphonClient(this);
      // Create Syphon Server
      syphonOut = new SyphonServer(this, "Sandbox Soft Server");
      // Used as an image in case there is no available Syphon Feed
      defaultImg = loadImage("Room Default 640x640.png");
    void draw() {
        if (syphonIn.available() == true) {
        syphonState = true;
      } else {
        syphonState = false;
      if (syphonState == true) {
        rawImg = syphonIn.getImage(rawImg);
      if (syphonState == false) {
        rawImg = defaultImg;
      // Draw everything in this PGraphics to be sent out via Syphon
      canvas.image(rawImg, 0, 0);
      canvas.filter(THRESHOLD, map(threshold, 0, 255, 0, 1));
      // Draws to Processing window to see
      if (render == true) {
        image(canvas, 0, 0, width, height);
      // Uses frames from the main PGraphics and sends out via Syphon
      // Shows FPS at the bottom
      text("FPS: " + int(frameRate), 40, height - 40);

    Here is the video



    The available() function is confusingly named – it indicates the availability of a new frame since you last retrieved one, not the availability of the server.

    I’ve opened an issue to request a function to do what you want – until then I’m not sure quite what to suggest – you might have to parse the result of listServers().

    Processing’s SyphonClient could use some work…


    @Bangnoise, thanks for the rundown. That explains a lot!

    I was under the impression that it was available in totality and not just every fresh frame. That explains why it would flippantly go back and forth if the framerate of the sketch and feed were not “in phase”.

    With the listServers() are you suggesting I check the list to be more than 0 to determine of a feed is available? I think that may work. I have used that approach on other webcam based sketches in the past.

    While we’re talking about the Processing implementation of Syphon, is there a reference for all of these functions? I have looked through the examples but I would love to see what else I may be missing!


    With the listServers() are you suggesting I check the list to be more than 0 to determine of a feed is available?


    There’s documentation in libraries/Syphon/reference in your Processing folder.


    Has any of this been addressed since the 3.o rollout of Processing?


    If you follow the link to the issue I posted above, you will see the answer… (yes).


    I am not the best at interpreting this stuff. Is this what you meant? I did not get it to work…

    Tried to implement


    In Processing 3.0 I tried this. It looks like some things have changed.

    I tried the “active” part again but it would not compute. All I was able to do is set the frameRate to (30) and it wouldn’t bug out.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.