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
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 :)
Dominic