deQuencher is a rewrite of an application I initially coded with the processing language. My first project with openframeworks and I loved every moment of it.
The source code includes some abstractions for communicating with SuperCollider, so those who want to create synths buffers etc and control parameters on scserver can benefit from that code I think.
I am trying to send OSC messages to SuperCollider, right now every message that is sent from OF is displayed in the post window but I cannot use it to control a synth, for example.
void testApp::mousePressed(int x, int y, int button){
ofxOscMessage m;
m.setAddress("/mouse/button");
m.addStringArg( "mouse clicked" );
m.addIntArg( "440" );
oscSender.sendMessage( m );
}
And in SuperCollider I define a SynthDef with the name “sin” and use this bit of code to receive the message:
(
var ofAddress = NetAddr("127.0.0.1", 57120);
var oscFreq;
oscFreq = 0;
o = OSCresponder(ofAddress, '/mouse/button', { arg time,responder,msg,addr;
oscFreq = msg[2]; //Message two, the int argument
oscFreq.postln;
a = Synth("sin", [\freq, oscFreq]);
a.run;
}).add;
)
But all I get is “mouse clicked” posted in the post window in SC. All I want to be able to do is run a synth sound on a mouse click and then I can develop it from there. Any help would be much appreciated.
i tried the ofxosc addon with supercollider but only get this
FAILURE /mouse/button Command not found
message in supercolider post window i tried the above posted code in supercolider and also the code from the berio blog.
but all that had the same effect. can anyone give me a hint what i am doing wrong?
ok i think i have managed that supercollider now gets the right messages to the right port. before i used port 57110 which is not the right port. now i use 57120 but i still get no sound or supercollider reaction. i use the following sc code:
(
var ofAddress = NetAddr("127.0.0.1", 57120);
var oscFreq;
oscFreq = 0;
o = OSCresponder(ofAddress, '/mouse/button', { arg time,responder,msg,addr;
oscFreq = msg[2]; //Message two, the int argument
oscFreq.postln;
a = Synth("sin", [\freq, oscFreq]);
a.run;
}).add;
)
is there something wrong with the listening ip or port? maybe someone has an idea.
i tried different combinations of code and now it works. one thing that i learned was, that sometimes i got no result because something crashed. after restarting of and sc there were results where before were no effects.
so i used the standart ofxosc addon an dfired up an “/test” message.
here is my sc code: