PYTHON SCRIPTS: Literally more than 100 new possibilities!

Hi everyone,

this is just insane! Machine Learning & AI in OSC? Let's get to it! ;D
With the <py-script> tags, we are actually able to include python scripts in OSC. Honestly, I'm blown away. Python is not just one of my prefered languages, it comes with a huge amount of packages and therefor so many possibilities for our beloved OSC! And I just noticed this today ā€¦

I've set this to "General Discussion", because to me this seems just like the beginning of pyscript and it's implementation and Iā€˜d love to read what you think. However I also created a session as a tutorial for everyone to use. (7.4 KB)

Feel free to edit and add to it, but please share it again with the rest of the community. All necessary explanation is in the session. Let me know if you encounter problems. I've only included very basic concepts.

The implementation right now is far from good. There are several issues:

  1. Workaround:
    Python can't be inserted in the html widget, since it does not allow the <head> tag, which is necessary. So I had to find a workaround using the frame widget. That way, one can load a .html document in the sessions directory and view it in OSC.

  2. Alpha:
    pyscript is still in the alpha, so there are still known issues and bugs. Also it'll probably change from time to time

  3. Compatibility:
    I tried loading some big python packages, but not all of them are supported. An error message is raised saying that it's an "unsupported platform". So before you plan your ideas, first load the package and check if it's working.

  4. Calling filepaths:
    Until now, I did not find a way to load scripts via the <py-script src="">, since it does not find the path on the server. Please let me know if you get this to work in any way. Calling a file from within a script doesn't work either.
    For now you can read files over an url(). There's an example in the session using github and pandas/numpy.

  5. Communication
    It's fairly easy to let python communicate with javascript natively. But I'm still searching for a good way to manage this inside of OSC. So far it's a bit clumsy.

There are so many things I havn't tried yet ... Time runs so fast.

What do you think?
How could we use this in OSC? Do you have ideas already?
Would it make sense to have a python widget some day or would it be useless?

If you want to wrap your head around it, make sure to look at my example and these official ressources:

Best wishes to you all and enjoy your music (or whatever you are up to with OSC :heart: )

1 Like