Trying to communicate with Max -> OSC -> Processing

edited May 2015 in Library Questions


I am having trouble getting Max and Processing to communicate

I have been working with a tutorial I found on the cycling 74 forums that outlines the process

this is the tutorial

When I copy-paste the finished example, everything works smoothly. But there is a little bit too much going on with the processing side of the code for me to know exactly where I should pull from to create the building blocks of my own Max~Processing OSC communication project.

So naturally, I am trying to start from square one, with the first portion of the example, where the goal is to simply send the message ’42’ via the /foo prepend. For some reason it’s not working for me.

The console reads:

[2015/5/29 2:5:41] PROCESS @ OscP5 stopped.

[2015/5/29 2:5:41] PROCESS @ UdpClient.openSocket udp socket initialized.

[2015/5/29 2:5:42] PROCESS @ UdpServer.start() new Unicast DatagramSocket created @ port 8080

[2015/5/29 2:5:42] PROCESS @ UdpServer is running @ 8080

[2015/5/29 2:5:42] INFO @ OscP5 is running. you ( are listening @ port 8080

[2015/5/29 2:5:42] PROCESS @ OscPlug plugging class sketch_150529b | addrPattern:/foo typetag:i method:foo

[2015/5/29 2:5:42] PROCESS @ OscP5 stopped.

[2015/5/29 2:5:42] PROCESS @ UdpClient.openSocket udp socket initialized.

[2015/5/29 2:5:43] ERROR @ UdpServer.start() IOException, couldnt create new DatagramSocket @ port 8080 Address already in use

[2015/5/29 2:5:43] INFO @ OscP5 is running. you ( are listening @ port 8080

[2015/5/29 2:5:43] PROCESS @ OscP5 stopped.

[2015/5/29 2:5:43] PROCESS @ OscP5 stopped.

[2015/5/29 2:5:43] PROCESS @ socket closed.

This is my source code, sorry for the funky formatting, it doesn't maintain the original spacing when I copy paste into the forum

import oscP5.*; import netP5.*;

OscP5 oscP5; NetAddress myRemoteLocation;

void setup() { size(400,400); frameRate(25);


oscP5 = new OscP5(this,8080); myRemoteLocation = new NetAddress("",8080); }

void initOsc(){ oscP5 = new OscP5(this, 8080); myRemoteLocation = new NetAddress("", 8080); oscP5.plug(this, "foo", "/foo"); }

public void foo(int value){ println("int received! =" + value); }

along with the v simple max patch

I have tried restarting, changing the ip, changing the port, all to which returns the same results. I have also looked at the send receive example in the oscP5 but to no avail. Comparing my source code with the finished example source code and nothing jumps out. I know that OSC communication works with my setup because both the finished example from ASH and the oscP5sendreceive example work.

What the dingus is happening?

Thanks for any and all help!!!


  • Answer ✓

    Hi, I would try 2 things: add draw() {} to your sketch so that processing keeps running after setup() and doesn't quit immediately, and remove oscP5 = ... after initOsc() since you dont want to initialize oscP5 twice.

  • thanks dude!!

Sign In or Register to comment.