-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Fri, Oct 12, 2007 at 02:20:38PM +0200, Dominic Sacr? wrote:
On 10/12/07, Ken Restivo <ken(a)restivo.org>
wrote:
Is there an OSC interactive interpreter anywhere?
sendOSC does half of it, dumpOSC does the other half, but they can't run at the same
time on the same socket! Which makes them kind of useless when a synth or other OSC device
is expecting to reply to the socket from which the packet was received.
What I'm basically looking for is a program that combines sendOSC and dumpOSC into
one interactive, readline-enabled thang.
I vaguely remember coming across something like an "OSC shell", that
thinly-wrapped libOSC using python or perl (IIRC), but I don't remember where it was
and I can't seem to find it anymore.
I don't know if there already is an interactive OSC shell the way you
describe, but you may want to take a look at pyliblo
(
http://das.nasophon.de/pyliblo/). It's an OSC module for Python, and
also includes two scripts, send_osc.py and dump_osc.py, which
Thanks! That may have been the one I was thinking of, but couldn't remember.
implement most of the functionality of sendOSC and
dumpOSC, in just a
few lines of Python code. It wouldn't be difficult to build something
that can both send and receive messages, possibly using Python's
readline module.
Actually, depending on your needs, you could just use pyliblo in an
interactive Python interpreter, giving you readline editing and lots
of other possibilities for free:
>> from liblo import *
>>
>> class Dump(ServerThread):
... @make_method(None, None)
... def callback(self, path, args):
... print path, args
...
>> s = Dump(1234)
>> s.start()
>>
>> s.send(1234, '/foo', 23, 42, 'bar')
>> /foo [23, 42, 'bar']
Of course this is just a minimal example, sending one message to
itself, but there's a lot more you can do in an interactive Python
session :)
That is actually perfect, since the scripts I'm writing/debugging will be in Python
anyway.
I've found 4 mutually-incompatible OSC Python libraries on my system, all of which
seem to have come from the same codebase :-(. OSC.py is apparently from Patrick Kidd,
which is broken, and produces invalid OSC packets according to jackmidimix (I lost over 2
hours chasing that down last night). Another is osctools.py from the SuperCollider scosc
library, and the only working one appears to be osc.py, from somewhere I can't figure
out where it came from, but somebody stuck it in /usr/lib/python2.4 (it wasn't part of
any Debian package).
So far I've been able to hack together a script that uses the RTMIDI library for
Python, to take MIDI in and send volumes via OSC to jackminimix, so I now have a simple
JACK mixer that I can control from my MIDI controller. Yay.
I'll try pyliblo, it looks a lot cleaner and more capable, and I love the threaded
server-- very nice.
- -ken
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFHEAbre8HF+6xeOIcRAphEAJ421818CIEr3QKE4//ns6ufXlbpEACfcKRd
DWHBgpGKL85U1rvp20CfvRc=
=BDsg
-----END PGP SIGNATURE-----