Simple Question about Ndef

Im working on learning the in’s and out’s of working with Ndefs

made a Ndef with a simple beep that I passed thru Ndef with a CombC delay, works as I was expected. Then tried sending a Ndef with a Pbind and no error but no more delay on signal…


Ndef(\beep_sig,{SinOsc.ar([800, 802]) * LFPulse.kr(0.3, 0, 0.01)}).play(vol:0.1)

Ndef(\verb,{CombC.ar(Ndef.ar(\beep_sig,2),maxdelaytime:0.125,decaytime:20,mul:0.5)})

/// all ok 

Ndef(\c,Pbind(\instrument, \sq, \freq, Pseq([60, 67, 72], inf),\dur, 1,)).play(vol:0.1)

Ndef(\verb,{CombC.ar(Ndef.ar(\c,2),maxdelaytime:0.125,decaytime:20,mul:0.5)})

/// no dice 

Does your sq SynthDef have an out argument?

hjh

(
SynthDef(\sq,{
	var sig, env;
	env = Env.perc(0.01, 0.25,1, -2).ar;
	sig = Pulse.ar(\freq.ir(440) +[0, 0.2]);
	sig = sig * env;
	Out.ar(0,sig);
}).add;
)

The SynthDef is written as so… Was under the impression that Pdef handled that…

I just changed it and it’s now working thank you !

Glad you were able to fix it with that advice – in any case: if the output bus is hardcoded as 0, then there is no way for any class anywhere in sclang to override it. Best practice is always to provide an out argument and never, ever hardcode a bus number, ever.

“Never” types of advice are often exaggerated, but I think not in this case.

hjh

1 Like

Thank you for that useful advice. I put it as a arg up front as
|out = 0|
But curious if you have a way off expression them you prefer / feel works better