"Canceling trigger delay" (SC version of pd/max [delay])

Was just using Pure Data’s [delay] (which works differently from SC’s TDelay)

  • SC: “Delays a trigger by a given time. Any triggers which arrive in the time between an input trigger and its delayed output, are ignored.”
  • Pd: “Sending a bang to a delay which is already set will reschedule its output, replacing any previous setting.”

That is, SC delays the first of a burst of triggers; Pd delays the last. … which made me wonder how to get the same result in SC.

This seems to do it. It isn’t necessarily obvious so I thought I’d share:

	var t = Impulse.ar(1000);  // 10 in the time span
	var mask = TRand.ar(0.0, 1.0, t) > 0.5;
	var trig = t * mask;
	var delayed = TDelay.ar(trig, 0.0015);
	var pddelayed = HPZ1.ar(Sweep.ar(trig) > 0.0015) > 0;
	[trig, delayed, pddelayed]


1 Like