pythonclient-serveroscchuck

OSC messages from a python-osc client are not picked up by ChucK server


I'm trying to set up communication between chuck and python via the OSC (Open Sound Control) protocol. On the python side we're using the python-osc library and chuck natively supports the OSC protocol. It appears that the messages we send from the python side do not arrive at the chuck side. All other combinations, i.e. python to python, chuck to chuck and chuck to python are working fine though. I'm running python 3.4.4 on windows 7. What could be going wrong here?

Here are the four files with the client/server implementations I'm using for testing.

chuck_client.py:

OscSend xmit;
xmit.setHost("localhost", 5005);
<<<"Sending">>>;
xmit.startMsg("/debug");

chuck_server.py:

OscRecv orec;
5005 => orec.port;
orec.listen();
orec.event("/debug") @=> OscEvent e;

<<<"Waiting">>>;
e => now;
<<<"Received">>>;

python_client.py:

from pythonosc import osc_message_builder
from pythonosc import udp_client

client = udp_client.UDPClient('localhost', 5005)
msg = osc_message_builder.OscMessageBuilder(address="/debug")
msg = msg.build()
print('Sending')
client.send(msg)

python_server.py:

from pythonosc import dispatcher
from pythonosc import osc_server

dispatcher = dispatcher.Dispatcher()
dispatcher.map("/debug", lambda _: print('Received'))

print('Waiting')
server = osc_server.ThreadingOSCUDPServer(
    ('localhost', 5005), dispatcher)
print("Serving on {}".format(server.server_address))
server.serve_forever()

Solution

  • This appeared to be a bug in python-osc 1.5. In version 1.6 the provided example just works. Reference: https://github.com/attwad/python-osc/issues/31