From Max to Processing (processing.org)

master29's icon

Hi Folks,

i just can`t get a propper OSC connection between Max and Processing.

I tried to use CNMAT but couldnt figure out which patch to use. Also, since i am working on Mac OS X 10.4.11, i dont which adress to use to send OSC Messages? When sending to a other computer i used the IP and a certain port. DO i have to use localhost now?

Thanks for helping!

Guillaume Evrard's icon

hi peter,

i managed to do this easily, be sure you have installed the oscP5 library for processing.
Then, try to open an example for processing, you will see in the code that a listener is created :

oscP5 = new OscP5(this,12000);

means you have to send your osc messages to port 12000.

this is done with the udpsend object :

[udpsend localhost 12000].

here, you have a one side communication from max to processing.

if you want to send osc messages from processing to max :

myRemoteLocation = new NetAddress("127.0.0.1",13000);

will declare the port max/msp is listening to, then :

OscMessage myMessage = new OscMessage("/test");

myMessage.add(123); /* add an int to the osc message */

/* send the message */
oscP5.send(myMessage, myRemoteLocation);

you will receive the messages in max/msp with the udpreceive object :

[udpreceive 13000]

this should work very well.

cheers

g