home/ atoms/ sc-t-gate-trigger-argument

t_gate arguments in SuperCollider automatically reset to zero after one control cycle, enabling clean re-triggering

Declaring a SynthDef argument with the prefix t_ creates a TrigControl: when you call .set(\t_gate, 1), the value jumps to 1 and automatically returns to 0 approximately 64 samples later (one control period). This makes it easy to re-trigger fixed-length envelopes without manually cycling gate from 0 back to 1. However, t_ arguments are incompatible with sustained envelopes (Env.adsr): the automatic zero-return immediately triggers the release phase. Use t_ only for envelopes with a natural endpoint; use regular arguments for envelopes that need to sustain.

Examples

x = { arg t_gate=1; var env = EnvGen.kr(Env.perc(0.01, 0.5), t_gate); SinOsc.ar(880) * env }.play; x.set(\t_gate, 1); // retriggerable each call

Assessment

Why can’t you use a t_gate argument with Env.adsr to create a sustaining note? What type of argument should be used instead and how does it differ?

“t-underscore arguments, according to the SynthDef help file, "will be made as a TrigControl. Setting the argument will create a control-rate impulse at the set value."”
corpus · supercollider-tutorials-full-transcripts-and-code-eli-fields · chunk 9