Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Confluence
For you

Bits & Atoms IV
Results will update as you type.
  • Bits & Atoms IV 2018
  • Wekinator Example
  • Bits & Atoms IV 2021
  • Bits & Atoms IV 2025

/
Wekinator Example

Wekinator Example

May 03, 2018

Webcam example:

http://www.doc.gold.ac.uk/~mas01rf/WekinatorDownloads/wekinator_examples/all_source_zips/SimpleVideoInputWithProcessing_100Inputs.zip


Simple Output
float p1 = 0.5;
float p2 = 0.5;
float p3 = 0.5;

//Necessary for OSC communication with Wekinator:
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress dest;

void setup() {
  size(640, 360, P2D);
  colorMode(HSB);
  //Initialize OSC communication
  oscP5 = new OscP5(this, 12000); //listen for OSC messages on port 12000 (Wekinator default)
  dest = new NetAddress("127.0.0.1", 6448); //send messages back to Wekinator on port 6448, localhost (this machine) (default)
  rectMode(CENTER);
  noStroke();
}

void draw() {
  background(255);
  float x = width*p1;
  float y = height*p2;
  float colour = 255*p3; 
  fill(colour, 255, 255);
  rect(x, y, 50, 50);
}

//This is called automatically when OSC message is received
void oscEvent(OscMessage theOscMessage) {
  if (theOscMessage.checkAddrPattern("/wek/outputs")==true) {
    if (theOscMessage.checkTypetag("fff")) { //Now looking for 2 parameters
      p1 = theOscMessage.get(0).floatValue(); //get this parameter
      p2 = theOscMessage.get(1).floatValue(); //get 2nd parameter
      p3 = theOscMessage.get(2).floatValue(); //get third parameters
      println("Received new params value from Wekinator");
    } else {
      println("Error: unexpected params type tag received by Processing");
    }
  }
}


, multiple selections available,
{"serverDuration": 71, "requestCorrelationId": "7e84bf55907a4de6a27ac74c90cd12e5"}