jrs
Newbie
Karma: 0
Posts: 1
|
 |
« on: June 18, 2008, 10:41:12 PM » |
|
Hi All,
I'm pretty new to sc so please forgive me if im missing something obvious here but shouldnt the OSC responder below set the synth freq
// Dump OSC messages so we can see whats happening s.sendMsg("/dumpOSC", 0); s.sendMsg("/dumpOSC", 1);
( SynthDef("simpSinOsc", { arg freq=800, phase=0, mul=1, add=0; var osc; osc = SinOsc.ar(freq, 0, mul, add); // 800 Hz sine oscillator Out.ar([0,1], osc); // send output to audio bus zero. }).writeDefFile; // write the def to disk in the default directory synthdefs/
s.sendSynthDef("simpSinOsc"); )
// Some messages to test the synth is working s.sendMsg("/s_new", "simpSinOsc", 3000, 0, 0.5, "freq", 447); // create synth s.sendMsg("/n_set", 3000, "freq", -400); s.sendMsg("/n_free", 3000); // kill synth
// Setup an osc responder (im using an LFO object combined with an OSC send object in quartz composer to trigger it) ( var osc1_nodeID = 3000; a = OSCresponder(nil, '/objX', { |t, r, msg| s.sendMsg("/n_set", osc1_nodeID, "freq", round(600 + (msg[1] * 100)) ); msg[1].postln }).add; s.sendMsg("/s_new", "simpSinOsc", osc1_nodeID, 0, 1); // create synth )
// When this gets setup we can hear the 800hz sine tone - but as soon as the OSCresponder sets the freq there is no sound - we can test // this using the below messages - the first two should silence the synth and the second works as expected - if you watch the server // window you can see the messages are the same so why do they work differently?
n = NetAddr("127.0.0.1", 57120); n.sendMsg("/objX", 1.3); s.sendMsg("/n_set", 3000, "freq", 590);
//------------------------------- // Some code to remove everything ( var osc1_nodeID = 3000;
s.sendMsg("/n_free", osc1_nodeID); // kill synth
a.remove; b.remove; )
|