Message "def" not Understood

I kinda fell off with SC recently, and am forcing myself to get back into it. I was just getting too frustrated not knowing what the hell is going on because I suck at programming. But here I am! Back for more punishment. As such, I’m a little rusty. SC is definitely NOT like “riding a bike” for me.

I’m getting a Message “def” not found error when playing this:

SynthDef(\demand1, {
	arg out=0, gate=1, freq=400;
	var x, y, env, sig;
	env =, gate, doneAction:2);
	y={ |a|,0,x))
	sig =[freq, freq+1]) * y.(1) * y.(3);, sig * env);

The code works and plays, but I can’t decipher this error.

ERROR: Message 'def' not understood.
Instance of Synth {    (000001E5DE3303F8, gc=B0, fmt=00, flg=00, set=03)
  instance variables [6]
    nodeID : Integer 1216
    server : instance of Server (000001E5D741FBE8, size=30, set=5)
    group : instance of Group (000001E5E1B59078, size=5, set=3)
    isPlaying : false
    isRunning : false
    defName : Symbol 'temp__5'
PATH: C:/SCandTidal/realsad.scd

	Meta_MethodError:new	000001E5DE0F8340
		arg this = DoesNotUnderstandError
		arg what = nil
		arg receiver = Synth('temp__5' : 1216)
	Meta_DoesNotUnderstandError:new	000001E5DE0FA300
		arg this = DoesNotUnderstandError
		arg receiver = Synth('temp__5' : 1216)
		arg selector = def
		arg args = [  ]
	Object:doesNotUnderstand	000001E5E0E42300
		arg this = Synth('temp__5' : 1216)
		arg selector = def
		arg args = nil
	SynthDef:addControlsFromArgsOfFunc	000001E5D70CF9C0
		arg this = SynthDef:demand1
		arg func = Synth('temp__5' : 1216)
		arg rates = nil
		arg skipArgs = 0
		var def = nil
		var names = nil
		var values = nil
		var argNames = nil
		var specs = nil
	SynthDef:buildUgenGraph	000001E5D70CF440
		arg this = SynthDef:demand1
		arg func = Synth('temp__5' : 1216)
		arg rates = nil
		arg prependArgs = [  ]
		var result = nil
		var saveControlNames = nil
	a FunctionDef	000001E5D70CDA80
		sourceCode = "<an open Function>"
	Function:prTry	000001E5D6ABE580
		arg this = a Function
		var result = nil
		var thread = a Thread
		var next = nil
		var wasInProtectedFunc = false
		arg this = <instance of DoesNotUnderstandError>
		arg this = nil
		arg error = <instance of DoesNotUnderstandError>
		arg this = <instance of Thread>
		arg error = <instance of DoesNotUnderstandError>
		arg this = <instance of DoesNotUnderstandError>
		arg this = <instance of Function>
		arg handler = <instance of Function>
		var result = <instance of DoesNotUnderstandError>
		arg this = <instance of SynthDef>
		arg ugenGraphFunc = <instance of Synth>
		arg rates = nil
		arg prependArgs = nil
		arg this = <instance of Interpreter>
		var res = nil
		var func = <instance of Function>
		var code = "(
SynthDef(\demand1, {
	arg ..."
		var doc = nil
		var ideClass = <instance of Meta_ScIDE>
		arg this = <instance of Main>
^^ The preceding error dump is for ERROR: Message 'def' not understood.
RECEIVER: Synth('temp__5' : 1216)

Any help much appreciated! Thank you thank you.

The second-to-last ) is misplaced – it should be immediately after }.

// *not* this
SynthDef(\demand1, { ... }.play);

// THIS one
SynthDef(\demand1, { ... }).play;

After more time programming, you might find that you develop a kind of sixth sense about brackets – when they’re unbalanced or misplaced, it “feels” wrong. This takes time, though.


Oh my god I feel so stupid. I was hunting this for EVER. Thanks as always jamshark70. Hope you’re doing well. Next time I’m just going to re-write the code from scratch. I would have found it that way.

HAHA. And, done. After months of no SC, I come back and create this broken early 60’s sci-fi horror:

SynthDef(\demand1, {
	arg out=0, gate=1, freq=200;
	var x, y, env, sig, sig2;
	env =, gate, doneAction:2);
	y={ |a|,0,x))
	sig = y.(1*y.(2))
	 *[freq, freq*0.5]);[freq*2+(freq/2) * y.(1) * y.(1/2),freq*2+freq * y.(1) * y.(1/4)]).fold2) * -6.dbamp;
	sig =, 0.005,,10.5),0.25*0.005,0.75*0.005) );
	sig2 = ( + sig).fold2/2;
	sig = (sig + sig2)/2;, sig * env);

sorry 'bout it.