Visuals AND music with Processing?

I don’t have anything off-the-shelf – I stumbled on some incidental evidence that @aparrish had problems getting oscp5 to work with Processing.py, although I haven’t tried it myself.

https://github.com/jdf/processing.py/issues/201

Keep in mind that in Processing.py you can mix pure Python 2.7 libraries with Java libraries and they both work together. So if the Java-based oscp5 library isn’t working for some reason then you could just use standard python and import any pure python osc module, then pass its signals to your Processing code for display.

Another argument against this annoying callback convention in Processing libraries. I know a polling mechanism was requested for oscP5 but don’t think it was ever implemented. This would also help with the threading issues. At least callbacks should be queued on the animation thread! I’m sure @CrouchingPython will enjoy explaining the principles of concurrent programming to his 13 year olds. :wink:

1 Like

If I’m confused (very likely!), my apologies. I’ve been down the rabbit hole with Processing, Praxis, Pd, Python, TouchDesigner, yada yada…

What I meant was that for my purpose, which is teaching middle school students brand new to text-based coding, I didn’t see PL as a solution. I was under the impression that PL was built on Java and I recall looking at the code and thinking… not sure my kids could pull this off!

But thanks so much for your dialogue and let’s keep talking!
Bob

1 Like

No problem! There are many rabbit holes. :grinning:

Well, yes, and so is Processing. If you create a video patch with a video:gl:p2d or video:gl:p3d node connected to the video output, and right-click and edit code, you’ll effectively have a Processing sketch that you can live program with (almost identical to PDE). Mind you, I think I said exactly that above. I didn’t bring up PraxisLIVE in this thread originally, but I do think it’s as least as suitable as PDE for what you’re talking about doing. And it has the benefit that your students can live code the Processing code like they do in Sonic Pi.

I can build you a simple base project if you want, with OSC messages pre-mapped in the Processing node so that your students can literally just run and code if you want? It looks like Sonic Pi can send to whatever addresses you want - although that doc doesn’t actually seem to show how to send values! :confused:

1 Like

Thanks! I’d LOVE to see some sample code. I’ve been fiddling with SonicPi (which is built in Ruby) sending OSC messages to JythonMusic (which is Python syntax built in Java…), and have been at least able to send some text messages successfully. The attraction there is that I already have introduced my students to some Python (coding Minecraft), so they might recognize some of that syntax.

But yes, if you would do that, I’d be ecstatic to have some sample code to play with! Haven’t decided which direction to go, and taking this year to experiment and find what might work best in my classes.

Thanks!

Have replied on the PraxisLIVE support chat because I don’t think I can attach files here?

https://files.gitter.im/praxis-live/support/gC1m/OSC-P3D.zip

Hopefully makes sense - currently maps a single OSC parameter in the code. Send an OSC message to localhost:1234, address /video/p3d.size, value between 0 and 1.

The node to access code editing is commented, and will appear when you run the project - starts with a sphere.

Thanks! I’m not “there” yet. But checked out your vids on YT, and they’re super impressive. And inspiring! Can Sonic Pi be an input to PraxisLive?

1 Like

Thanks! :blush:

If you want to send OSC messages from Sonic Pi, then that is what that project is intended to demonstrate. At the moment it will only respond to a single OSC address, but hopefully you can see how to add more to that (add an annotated variable in the code and a line in the OSC tab)

On the Sonic Pi side (I’ve not used it so this is based on a blog post) I think you use (where the 0.5 can be any value between 0 and 1 in this case).

use_osc "localhost",1234
osc "/video/p3d.size",0.5

That should control the size of the sphere the default Processing code is drawing.

1 Like