Open Sound Control (OSC) is a protocol for communication among computers, sound synthesizers, and other multimedia devices that is optimized for modern networking technology. It is particularly common to use OSC with MAX/MSP -- which in fact is what I am doing, using OSC with Python to talk to another subsystem in MAX.

There are a bunch of python modules that support OSC. Great. And they all claim to be simple, useful, and perfect. At the risk of verging into subjective territory, what use cases does your experience suggest for the following modules?

I suppose a simple implementation would serve me best since I have only a glancing familiarity with OSC. And I'm using Python 2.7.

share|improve this question
    
About to post the same question, when I found yours. Thanks! – Luis Miguel Jun 25 '15 at 22:15
up vote 9 down vote accepted

I have used pyOSC with great success on OSX. The code isn't under much development but this is most likely due to it's stability and simplicity. I briefly tried txosc and it may warrant further testing.

My usage of pyosc is limited but it works well. eg.

import OSC
c = OSC.OSCClient()
c.connect(('127.0.0.1', 57120))   # connect to SuperCollider
oscmsg = OSC.OSCMessage()
oscmsg.setAddress("/startup")
oscmsg.append('HELLO')
c.send(oscmsg)
share|improve this answer
    
Thanks. I struggled with a couple until I settled on pyOSC. However, a caveat: None of the versions in repos that I pulled down with easy_install worked in OSX for python2.7. I grabbed the latest dev version on gitorious and installed it the old skool way and ran setup.py which rebuilt for my machine. – Wes Modes Mar 4 '14 at 20:49
3  
This worked for me: sudo pip install pyosc --pre – ptr Mar 6 '14 at 13:27
    
Have you tried any iOS app with OSC? I am curious: I was going to post a similar question to the one above but also asking about iOS apps compatible with python libraries – Luis Miguel Jun 25 '15 at 22:17

This isn't exactly what the question asked, but I think it's something worth mentioning here: one annoying thing about the various Python OSC modules is that most work with either Python 2.x or with Python 3.x but not with both, which means that you might have to change code base and rewrite part of your app in the future.

The only one I found that targets both Python 2.x and 3.x is Pyliblo, which is actually a wrapper for the C library Liblo. Liblo has been specifically tested to work with Pd and SuperCollider (see note at the end of its main page), which is what I mostly cared about when using such libraries... A downside of Liblo is that it's a bit harder to get working on MS Windows because it supports only POSIX threads (pthreads) but not the native win32 thread API, so you need an emulation library as explained at http://liblo.sourceforge.net/README-platforms.html. But you can also compile it with threading disabled on Windows.

share|improve this answer

I've been using pyOSC for years... and "I was there" when it migrated from Python 2 to 3. Well... if I don't remember well, I asked the maintainer in that moment (Artem Baguinski) to do it!

Now, there're two pages that host pyOSC... and, regarding to your question, one of the pages (the oldest) host Python2 version. And the one in Github (that it is old, too, and not developed any more), the Python3 version.

I'm not sure of pyOSC versions, because OSC.py changelog says nothing about Python version. Maybe it was not correctly docummented.

pyOSC 0.3.5 (Python2): https://trac.v2.nl/wiki/pyOSC

pyOSC 0.3.6 (Python3): https://github.com/ptone/pyosc

As ptr said, it's very easy to implement. I use to connect Blender Game Engine with PureData.

share|improve this answer
    
agreed, pyOSC is very easy to use - I'm using it with python 2.7 (via PsychoPy) to send marker events into the OSC stream and it was very straightforward (I'd previously tried compiling pyliblo on Windows but gave up having failed to created a dll) – jacanterbury Nov 2 '16 at 15:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.