Event \bufnum and SynthDef argument error

Hi, I suspect this is classic user error (I’m a bit rusty in SC; been a while!).

I have this small niggling issue when I first start up SC, and I create a buffer of a sample say, create a Pdef/Pbind, where the \instrument event references a SynthDef I’ve already stored in the SynthDesc Library. It’s a basic one-shot sample playing instrument, fed with a bufnum argument (amongst others). Nothing crazy, all pretty straightforward stuff.

But when I play the Pdef, I get Buffer UGen: no buffer data, which I know to mean that a buffer is expected to be passed to the PlayBuf ugen, via the argument.

But it’s only when I re-evaluate the SynthDef (I have a collection of them in a separate file), then the buffer comes through, and the sound is played.

Why is that? I thought that the SynthDesc is stored like a blueprint for event patterns. Why do I have to ‘refresh’ it? I don’t recall this happening before…or maybe it always did.

SynthDef(\tabplay, {| out=0, bufnum=0, amp=1, pan=0, start=0, loop=0, bus=0, rate=1, ffreq=2000, t_trig=1, fxMix=0|
	var player = Pan2.ar(PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum)*rate, t_trig, start, loop, doneAction: 2), pan, amp);
	var filtered = MoogFF.ar(player, ffreq, 1);
    Out.ar(out, filtered);
	Out.ar(bus, filtered * fxMix);
}).store;
~harderKicks = Pdef(\d, Pbind(
	\instrument, \tabplay,
	\degree, Pif(Pfunc({~coinVal.coin}), 0, \r),
	\bufnum, ~hardKick,
	\amp, Pwhite(0.7, 1, inf),
	\bus, ~dubBus,
	\fxMix, 0.3,
	\ffreq, Pwhite(200, 10000),
	\rate, Pseq([1, Pwhite(0.5, 2, 10)], inf),
	\dur, 0.25
));

Cheers

Are you leaving enough time (or using s.sync) between allocating the buffers and running the pattern?

Not using s.sync, but definitely leaving time between allocating the buffer, and working down through the code evaluating it and then playing it

I think this might have something to do with do with it though

Placing ~sdl = SynthDescLib.global.read; in the startup file was enough for it to work. I had this on my old laptop.