class:: Trig1 summary:: Timed trigger. related:: Classes/Trig categories:: UGens>Triggers Description:: When a nonpositive to positive transition occurs at the input, Trig1 outputs 1 for the specified duration, otherwise outputs 0. classmethods:: method::ar, kr argument::in Trigger. Trigger can be any signal. A trigger happens when the signal changes from non-positive to positive. argument::dur Duration of the trigger output. Examples:: code:: { Trig1.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play To create a fixed duration gate ( SynthDef("trig1",{ arg dur=0.125; var gate; gate = Trig1.kr(1.0,dur); OffsetOut.ar(0, SinOsc.ar(800, 0.3) * EnvGen.kr( Env([0,0.1,0.1,0],[0.01,1.0,0.01],[-4,4],2), gate, doneAction: Done.freeSelf) ) }).add; Routine({ 1.0.wait; 100.do({ s.sendBundle(0.05,["s_new", "trig1" ,-1,0,0,0,rrand(0.02,0.25)]); 0.25.wait }) }).play(SystemClock) ) This should sound like a continuous sine wave, although it is actually a series of 0.25 second synths. ( SynthDef("trig1",{ var gate; gate = Trig1.kr(1.0,0.25); OffsetOut.ar(0, SinOsc.ar(800, 0.3) * EnvGen.kr( Env([0,0.1,0.1,0],[0.01,1.0,0.01],[-4,4],2), gate, doneAction: Done.freeSelf) ) }).add; Routine({ 1.0.wait; 100.do({ s.sendBundle(0.05,["s_new", "trig1" ,-1]); 0.25.wait }) }).play(SystemClock) ) ::