Teaser: ddwPlug quark

FWIW – I just added temporary SynthDef caching for Plugs based on functions.

Before today’s change, the following pattern would generate a new SynthDef for the Plug for every event. With the change, only the first event creates a SynthDef and the rest reuse the same one.

(
p = Pbind(
	\type, \syn,
	\instrument, \default,
	\freq, Pexprand(200, 500, inf),
	\freqPlug, { |freq|
		// closed function here, possible to hit cache
		Plug({ |freqSynthArg|
			freqSynthArg * LFDNoise3.kr(3).exprange(0.95, 1.05)
		}, [freqSynthArg: freq])
	},
	\dur, Pexprand(0.2, 0.8, inf),
	\legato, Pexprand(0.7, 1.4, inf)
).play;
)

p.stop;

One usage had to be deprecated, though:

(
p = Pbind(
	\type, \syn,
	\instrument, \default,
	\freq, Plug {
		exprand(200, 500) * LFDNoise3.kr(3).exprange(0.95, 1.05)
	},
	\dur, Pexprand(0.2, 0.8, inf),
	\legato, Pexprand(0.7, 1.4, inf)
).play;
)

Without caching, there’s a new exprand value per event. Now there’s only one, the first time. I think it’s a good trade-off, though, because, when Jordan’s improved SynthDefs optimizations land, it will be more expensive to build the same SynthDef repeatedly. Now it will skip the rebuild in common sequencing cases.

hjh

1 Like

This is a really cool idea!

Does this depend on any other quarks?

One thing I was thinking about was that it would be nice to have some kind of recommendations or spotlight for quarks, perhaps that updates 3 times a year? This could be linked to in the help browser, but still be a webpage. As both the quarks gui and this forum aren’t ideal to search through.


FYI, you will be able to disable certain optimizations.

I’ll also add a little helper to do this with useful defaults for this exact situation, where you need reasonably fast compile times.

Something like this…

Synthdef.newFast(...)

Another option might be to disable the deduplication (which is the slow bit) when you have less than, say 20 ugens?

for searching Quarks there’s https://baryon.supercollider.online