Hi everyone, I am new in Supercollider.
I got a problem about FAILURE IN SERVER /n_set Node 1004 not found, maybe I’ve overlooked something stupid. Any way to solve this issue?
//Make sound between a frequency range
(y = {
arg noiseKR = 8, no1KR = 12;
var freq, amp, sig;
// freq = LFNoise0.kr(8,400, 600); or
freq = LFNoise0.kr(noiseKR).exprange(200,1000);
amp = LFNoise1.kr(no1KR).exprange(0.02,1);
// exprange: sound more distribution
sig = SinOsc.ar(freq)*amp;
//Make sound between 200-1000HZ
}.play;
)
y.set(\noiseHZ, exprand(4,64));
y.free;
This code should work fine if you execute it in order, although you are setting a control (noiseHZ) that doesn’t exist in the synth (you only have noiseKR and no1KR), so it won’t have any effect.
I suspect that you ran y.free or Cmd-period before running y.set(\noiseHZ, exprand(4,64));. If you run y.set after y has already been freed, it will give you FAILURE IN SERVER /n_set Node 1004 not found.
If you executed the code in order and it’s still not working:
Just to verify, after you execute the first code block, the synth should be playing on the server (you should hear it).
Now, while the synth is playing, run y.set(\noiseKR, exprand(4,64));. You should hear the change. If you’re still getting the error message at this point, please report back.
Hey! Thanks for helping me.
No, I just set the noiseHZ control of noiseKR and no1KR in the beginning of the code.
After I changed the order of two lines that you mentioned, it still occurs the same error.
The first point you’ve talked about works well(has sound)
As for the second point, without executing the y.free;, it seems to work, but I am not quite sure, because the sound might have been covered by the previous code.
Got it! Thanks.
Yes, I got no error when I run the separate blocks for the first time. So do I need to execute the first block, then second… , if I want to execute the blocks again?
Sort of. It is similar to the term “stop” but not to the method.
x = {SinOsc.ar}; \\a function
x.play; \\440 Hz sine tone
x.stop; \\a function
x.free; \\stops the synth playing
You free a synth, but you stop a routine or task, which this is not.
You should make this into a SynthDef so you can reuse it more conveniently.
(
SynthDef(\mySynth, { //name it whatever you like in the first argument to the SynthDef class
arg noiseKR = 8, no1KR = 12;
var freq, amp, sig;
// freq = LFNoise0.kr(8,400, 600); or
freq = LFNoise0.kr(noiseKR).exprange(200,1000);
amp = LFNoise1.kr(no1KR).exprange(0.02,1);
// exprange: sound more distribution
sig = SinOsc.ar(freq)*amp;
Out.ar(0, sig);
//Make sound between 200-1000HZ
}).add;
) \\now this is stored under whatever you named it
x = Synth(\mySynth);
x.free;
x=Synth(\mySynth, [\noiseKR, 10]);
x.set(\noiseKR, 2);
Sorry to be fussy about it, but it’s such a common point of confusion for new users (about play returning a new “player” object), better to be clear about it up front.
x = {SinOsc.ar}; // a function
y = x.play; // 440 Hz sine tone
y.stop; // a Synth, but no effect
y.free; // stops the synth playing