Slow oscP5 message

edited March 2016 in Python Mode

def oscSend(mess, addr, port=12000): global oscP5, loc oscP5 = OscP5(this, port) loc = NetAddress('127.0.0.1', port) msg = OscMessage('/%s' % addr) if isinstance(mess, int): msg.add('%i' % mess) elif isinstance(mess, float): msg.add('%f' % mess) else: for i, c in zip(mess, range(1, len(mess) + 1)): msg.add(c) msg.add(';'.join(map(str, i))) oscP5.send(msg, loc)

Hello I have this oscSend function in Python mode. It works but it seems to be taking forever to send even the shortest message. If I use it into a for loop I eventually run into a runtime exception error. I am not sure why it is taking processing so long to send messages over osc. Any idea?

Answers

  • I don't know anything about that library, but I doubt it's a good idea to create new network connections every time you want to send a message. I'd guess that's something you do one time, during setup().

  • That makes a lot of sense. I will try it and see how it goes. Thank you!

  • It does work much faster as you suggested. I know you said you are not familiar with the oscP5 library and I am having trouble receiving messages with it (it works fine to send). Do you have any suggestions on how to easily send and receive osc to and from max?

  • Answer ✓

    see my response in your other post, receive-osc

Sign In or Register to comment.