Protocol communication beginner - how to use OSC to output from a python program to processing sketch?

Hi, I’m a total beginner in using OSC, I don’t fully understand how it works even. Could someone please explain how I could output values from a Python program and receive them in my processing sketch. For example, a python program which calculates the x,y,w,h parameters of an ellipse based on some arbitrary algorithm and outputs it via OSC to processing, where I receive the values and update the parameters of my ellipse in the sketch.

I would really appreciate a full explanation, with any useful links and resources to get going. Thanks!

Is your Python program running in Processing Python mode?

To understand how OSC works, you should run the server and client demos both in Processing as two different sketches to see the library in action. Get this working first and understand how it works (or the intended behavior before proceeding further). Next, investigate an OSC version on the python side (Start here) I have never tried this but I am willing to bet it will work.

As an alternative, you can run a flask application and setup a processing server and you will use simple HTTP. This is more standard and it should work off the bat.

Kf

1 Like

Thanks. Will look into it, um it’s a Python program running a ML model with output probabilities. I want to send the values of these probabilities to a port via OSC and receive them in Processing.

See also:

and previous discussion of using Python mode (Processing.py) for OSC – which I don’t think is what you want, but might be relevant depending on your goals:

1 Like