Running e.g.
(dur: 0.0001).play
at the default block size results in a non-sounding but omnipresent synth node. I feel this is not a great thing.
(especially since a beginner experimenting with language-side granular synthesis might quickly run into it and have no idea why at a certain point their patch devolves into FAILURE IN SERVER /s_new too many nodes
messages)
It can be sort of fixed by adding an impulse to the gate, which guarantees that the envelope will always fire and therefore the synth will always end:
SynthDef(\default, { arg out=0, freq=440, amp=0.1, pan=0, gate=1;
var z;
gate = gate + Impulse.kr(0);
z = LPF.ar(
Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3, 0.3)),
XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)
) * Linen.kr(gate, 0.01, 0.7, 0.3, 2);
OffsetOut.ar(out, Pan2.ar(z, pan, amp));
}, [\ir]).add;
This would probably be considered a breaking change since it could change the sound of existing code… Is there a better way?