FAILURE IN SERVER /s_new SynthDef not found, message "play" not understood

So I was following along with a video, but when it came to actually sequencing everything I noticed that every time I tried to trigger anything the console would just return “FAILURE IN SERVER /s_new SynthDef not found”.
I also get “ERROR: message ‘play’ not understood”, full error below.

-> a Routine
ERROR: Message 'play' not understood.
Perhaps you misspelled 'post', or meant to call 'play' on another receiver?
RECEIVER:
   Symbol 'snare'
ARGS:
   Integer 1
PATH: E:/L.M.B.scd
CALL STACK:
	DoesNotUnderstandError:reportError
		arg this = <instance of DoesNotUnderstandError>
	Nil:handleError
		arg this = nil
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Routine>
		arg error = <instance of DoesNotUnderstandError>
	Object:throw
		arg this = <instance of DoesNotUnderstandError>
	Object:doesNotUnderstand
		arg this = 'snare'
		arg selector = 'play'
		arg args = [*1]
	< FunctionDef in closed FunctionDef >
		var play = <instance of Function>
	Routine:prStart
		arg this = <instance of Routine>
		arg inval = 50.8237
^^ ERROR: Message 'play' not understood.
Perhaps you misspelled 'post', or meant to call 'play' on another receiver?
RECEIVER: snare


*** ERROR: SynthDef kick not found
FAILURE IN SERVER /s_new SynthDef not found
*** ERROR: SynthDef glitch1 not found
FAILURE IN SERVER /s_new SynthDef not found
*** ERROR: SynthDef snare not found
FAILURE IN SERVER /s_new SynthDef not found
*** ERROR: SynthDef glitch1 not found
FAILURE IN SERVER /s_new SynthDef not found

I guess that you forgot to call .add on the SynthDef kick and glitch1?
Here is a minimal example, please check if this works for you and then compare it with your local code.

(
SynthDef(\kick, {|out|
	var sig = Blip.ar(10.0, numharm: [4,5]) * EnvGen.ar(
		envelope: Env.perc,
		doneAction: Done.freeSelf,
	);
	sig = (sig*40).tanh * \amp.kr(0.2);
	Out.ar(out,sig);
// remember to call .add here to tell sclang to add this
// synth definition to the server.
}).add;
)

// play once
x = Synth(\kick);

// in a pattern
p = Pbind(\instrument, \kick, \dur, 0.5).play;
p.stop;

I hope this helps you a bit, if not, please share your code with us, then it will be easier.

I did not forget to call .add
Here’s the entire code:

//kick and snare
(
SynthDef(\kick, {
	var snd, duration;
	duration = \duration.kr(1.0);
	snd = SinOsc.ar(60 * (1 + (3 * Env.perc(0, 0.19, curve: -6).ar)) * (1 + (2 * Env.perc(0, 0.01).ar)) * XLine.ar(1, 0.7, 0.3));
	snd = snd * (1 + (5 * Env.perc(0, 0.05).ar));
	snd = snd.tanh;
	snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 8320, 0.3) * Env.perc(0.0001, 0.01).ar * 5.dbamp);
	snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 16320, 0.3) * Env.perc(0.02, 0.03).ar * -1.dbamp);
	snd = snd.clip2;
	snd = snd * Env.perc(0, 0.5).ar;
	snd = snd + LPF.ar(HPF.ar(DelayC.ar(snd * -20.dbamp, 0.1, [0.045, 0.065]), 100), 3000);
	snd = snd * Env.linen(0, duration, 0.005, curve: -4).ar(Done.freeSelf);
	snd = snd * -10.dbamp;
	Out.ar(\out.kr(0), snd);
}).add;

SynthDef(\snare, {
	var snd, duration;
	duration = \duration.kr(1.0);
	snd = SinOsc.ar(220 * XLine.ar(1, 0.7, 0.3) * XLine.ar(2, 1, 0.03));
	snd = snd * Env.perc(0.001, 0.1).ar;
	snd = snd + (SinOsc.ar(XLine.ar(3000, 100, 0.01)) * Env.perc(1e-3, 0.02).ar);
	snd = snd + (SinOsc.ar(XLine.ar(8000, 1000, 0.02)) * Env.perc(1e-3, 0.02).ar);
	snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 2320, 0.3) * Env.perc(0.01, 0.05).ar * 5.dbamp);
	snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 16320, 0.3) * Env.perc(0.07, 0.3).ar * -1.dbamp);
	snd = snd.clip2;
	snd = snd * Env.perc(0, 0.5).ar;
	snd = snd + PitchShift.ar(snd, 0.023, 1.5);
	snd = snd + PitchShift.ar(snd, 0.01, 1.2);
	snd = snd + PitchShift.ar(snd * -10dbamp, 0.045, [2.3, 2.4]);
	snd = snd + FreqShift.ar(CombC.ar(snd * -5.dbamp, 0.2, 1 /230, 0.1), 70);
	snd = snd * (1 + (5 * Env.perc(0, 0.05).ar));
	snd = snd.tanh
	snd = snd + LPF.ar(HPF.ar(DelayC.ar(snd * -20.dbamp, 0.1, [0.035, 0.045]), 200), 3000);
	snd = snd * Env.linen(0, duration, 0.005, curve: -4).ar(Done.freeSelf);
	snd = snd * -15.dbamp;
	Out.ar(\out.kr(0), snd);
}).add;

SynthDef(\glitch1 {
	var snd, duration;
	duration = \duration.kr(1.0);
	snd = Hasher.ar(Sweep.ar(Impulse.ar(60)) + [0.1]);
	snd = snd * Env([1, 0, 1], duration * [1, 1].normalizeSum, [-4, 4]).ar;
	snd = snd ! 2;
	snd = snd * Env.linen(0, duration, 0.005, curve: -4).ar(Done.freeSelf);
	snd = snd * -10.dbamp;
	Out.ar(\out.kr(0), snd);
}).add;

SynthDef(\glitch2, {
	var snd, duration;
	duration = \duration.kr(1.0);
	snd = Hasher.ar(Sweep.ar(Impulse.ar(42)) + [0.1]);
	snd = RHPF.ar(snd, XLine.kr(100, 3000, duration), 0.3);
	snd = snd * Env.linen(0, duration, 0.005, curve: -4).ar(Done.freeSelf);
	snd = snd * -15.dbamp;
	Out.ar(\out.kr(0), snd);
}).add;
)
//time handling.
(
var s, bpm, beat, tatum;
s = Server.default;
bpm = 178;
beat = 60 / bpm;
tatum = beat / 4;

Routine({
	var play;

	play = { |synthDef, tatums|
		s.bind { Synth(synthDef, [duration: tatum * tatums]) };
	};

	play.(\kick, 4);
	play.(\glitch1, 4);
	play.(\snare, 4);
	play.(\glitch1, 1);
	play (\snare, 1);
	play.(\glitch1, 1);
	play (\snare, 1);
}).play;
)

Sorry for messy code, I was just following along to something

You have a . between the play function variable and its arguments in five of the seven lines, remove those and you should be good. Might be good to remove the space between as well, maybe that’s how the periods got there in the first place, some kind of autocorrect?

1 Like

No, the dot is correct, it’s a shortcut for play.value(), referring to the function stored in the play variable declared just before that block. (The “‘play’ not understood” error would be the result without the dot.)

I haven’t looked in detail so I don’t have much of an idea what’s going wrong, though. Actually the missing dot in the two lines would cause the error. Not sure about the SynthDef problem though.

hjh

Thank you for the correction James, I think I had my glasses on the wrong way around…

The SynthDefs had some typos, missing semicolons and dots, they work like this:


(
SynthDef(\kick, {
	var snd, duration;
	duration = \duration.kr(1.0);
	snd = SinOsc.ar(60 * (1 + (3 * Env.perc(0, 0.19, curve: -6).ar)) * (1 + (2 * Env.perc(0, 0.01).ar)) * XLine.ar(1, 0.7, 0.3));
	snd = snd * (1 + (5 * Env.perc(0, 0.05).ar));
	snd = snd.tanh;
	snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 8320, 0.3) * Env.perc(0.0001, 0.01).ar * 5.dbamp);
	snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 16320, 0.3) * Env.perc(0.02, 0.03).ar * -1.dbamp);
	snd = snd.clip2;
	snd = snd * Env.perc(0, 0.5).ar;
	snd = snd + LPF.ar(HPF.ar(DelayC.ar(snd * -20.dbamp, 0.1, [0.045, 0.065]), 100), 3000);
	snd = snd * Env.linen(0, duration, 0.005, curve: -4).ar(Done.freeSelf);
	snd = snd * -10.dbamp;
	Out.ar(\out.kr(0), snd);
}).add;

SynthDef(\snare, {
	var snd, duration;
	duration = \duration.kr(1.0);
	snd = SinOsc.ar(220 * XLine.ar(1, 0.7, 0.3) * XLine.ar(2, 1, 0.03));
	snd = snd * Env.perc(0.001, 0.1).ar;
	snd = snd + (SinOsc.ar(XLine.ar(3000, 100, 0.01)) * Env.perc(1e-3, 0.02).ar);
	snd = snd + (SinOsc.ar(XLine.ar(8000, 1000, 0.02)) * Env.perc(1e-3, 0.02).ar);
	snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 2320, 0.3) * Env.perc(0.01, 0.05).ar * 5.dbamp);
	snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 16320, 0.3) * Env.perc(0.07, 0.3).ar * -1.dbamp);
	snd = snd.clip2;
	snd = snd * Env.perc(0, 0.5).ar;
	snd = snd + PitchShift.ar(snd, 0.023, 1.5);
	snd = snd + PitchShift.ar(snd, 0.01, 1.2);
	snd = snd + PitchShift.ar(snd * -10.dbamp, 0.045, [2.3, 2.4]);
	snd = snd + FreqShift.ar(CombC.ar(snd * -5.dbamp, 0.2, 1 /230, 0.1), 70);
	snd = snd * (1 + (5 * Env.perc(0, 0.05).ar));
	snd = snd.tanh;
	snd = snd + LPF.ar(HPF.ar(DelayC.ar(snd * -20.dbamp, 0.1, [0.035, 0.045]), 200), 3000);
	snd = snd * Env.linen(0, duration, 0.005, curve: -4).ar(Done.freeSelf);
	snd = snd * -15.dbamp;
	Out.ar(\out.kr(0), snd);
}).add;

SynthDef(\glitch1, {
	var snd, duration;
	duration = \duration.kr(1.0);
	snd = Hasher.ar(Sweep.ar(Impulse.ar(60)) + [0.1]);
	snd = snd * Env([1, 0, 1], duration * [1, 1].normalizeSum, [-4, 4]).ar;
	snd = snd ! 2;
	snd = snd * Env.linen(0, duration, 0.005, curve: -4).ar(Done.freeSelf);
	snd = snd * -10.dbamp;
	Out.ar(\out.kr(0), snd);
}).add;

SynthDef(\glitch2, {
	var snd, duration;
	duration = \duration.kr(1.0);
	snd = Hasher.ar(Sweep.ar(Impulse.ar(42)) + [0.1]);
	snd = RHPF.ar(snd, XLine.kr(100, 3000, duration), 0.3);
	snd = snd * Env.linen(0, duration, 0.005, curve: -4).ar(Done.freeSelf);
	snd = snd * -15.dbamp;
	Out.ar(\out.kr(0), snd);
}).add;
)

I think I recognize the code, is it from Nathan Ho’s videos? The Routine doesn’t go anywhere in the current code (it only plays the synths once) but if you’re following a video I guess it will evolve into something sensible eventually. If not then let us know and I’m sure you’ll get some suggestions.

1 Like

Uff yeah sorry I must’ve been not been paying attention correctly and missed semicolons and such… Yes this is from Nathan Ho, and at this point he already triggered the synths (to see how they sound) and I was just following along,

Thank you! :3