hi,
i assume you were directed to the changes page because you are using code that has been changed since version 116 e.g. framerate() has been changed to frameRate(). all the syntax changes are described on this page, in case you are looking for more detailed explanations.
since you got directed to the changes page, the import of oscP5 and netP5 was successful, meaning the library was found by processing, hence the following code should work for you.
Code:
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
void setup() {
size(400,400);
frameRate(25);
oscP5 = new OscP5(this,12000);
myRemoteLocation = new NetAddress("127.0.0.1",12000);
}
void draw() {
background(0);
}
void mousePressed() {
OscMessage myOscMessage = new OscMessage("/test");
myOscMessage.add(mouseX);
oscP5.send(myOscMessage, myRemoteLocation);
}
// incoming osc message are forwarded to the oscEvent method.
void oscEvent(OscMessage theOscMessage) {
theOscMessage.print();
}
by clicking onto the black background you should see
Quote:-OscMessage----------
received from
/127.0.0.1:49279
addrpattern
/test
typetag
i
[0] 100
---------------------
if so, from here you can now start implementing your code to get processing to talk to supercollider and vice versa.
to communicate with supercollider i recommend daniel jones' sc_p5 library.
if you are looking for a more raw solution, here is a simple supercollider example that can be controlled from processing. take the above processing code and change the port number (12000) of myRemoteLocation to 57120
myRemoteLocation = new NetAddress("127.0.0.1",57120);
Code:
// supercollider code.
// create an OSC listener
(
o = OSCresponder(nil,'/test', {arg time, responder, msg, addr;
[addr.addr, addr.port].postln;
msg.postln;
x.set(\freq,msg[1]);
}).add;
)
// start the local server
Server.local.boot;
// create a synthDef that plays a pure sine wave.
x = SynthDef(\sine, {arg freq=400; Out.ar(1,SinOsc.ar(freq))}).play;