Using Done*Line to trigger a Ugen

Why I do hear the white noise in this version:

(
{
	var ampLine = Line.kr(1, 0, dur: 1);
	var sin = SinOsc.ar(mul: ampLine * 0.5);
	var noise = WhiteNoise.ar(Done.kr(ampLine) * 0.5);
	sin + noise
}.play
)

but not in this one, where I am multiplying the done with another line:

(
{
	var ampLine = Line.kr(1, 0, dur: 1);
	var sin = SinOsc.ar(mul: ampLine * 0.5);
	var noise = WhiteNoise.ar(Done.kr(ampLine) * Line.kr(0.5, 0, 1));
	sin + noise
}.play
)

I am not quite sure exactly which behavior you are looking for in the second example, but the Done.kr should be an arg to Line, not to WhiteNoise. I usually just use a number, either 0 for stay on the server, or 2 for remove from server when done, ie. Line.kr(0, 1, 1).kr(2) in this case.

I was thinking that if Done gets a tag from ampLine (possibly just a 1?!), this tag could be used to start the noise Ugen as a multiplier. So I thought i could also just multiply that sign with another Line to create a Ramp in the noise amplitude.

The problem is as soon as Done is triggered, the synth is removed from the server. You could use sweep or phasor to measure time instead and generate a trigger from sweep or phasor > ‘some value’. Just be aware that Phasor counts in samples and Sweep in seconds. Sorry but I don’t have time to draw up code today, but it should be pretty straight forward.

I don’t think that’s the case here. Done only reports whether the input UGen is finished or not. To free the synth in that case, use FreeSelf in conjunction with Done, or FreeSelfWhenDone.

hjh

@jamshark70 - thanks! I guess I am just so used to seeing Done with FreeSelf that I missed it.

@amt - so I as wrong about Done…in any case, to do something meaningful with a trigger, you need to trigger something, in this case the obvious thing is to trigger an Env, which design depends on the ramp and especially what should happen after the ramp, should the sound ramp back down, should the sound end all together? Here is an example of the latter

(
{
	var ampLine = Line.kr(1, 0, dur: 1);
	var sin = SinOsc.ar(mul: ampLine * 0.5);
	var trig = Done.kr(ampLine);
	var env = Env.perc(1, 0, curve: 4).kr(2, trig);
	var noise = WhiteNoise.ar * env;
	sin + noise
}.play
)

If you want a retriggerable sustaining synth, you will have use something other than Line, as this particular Ugen does not have a trigger arg, so It cannot be re-triggered, but plenty of other options if you need this. And nice to know that Done can be used in this way, I learned a new trick:)

Here is another variant basically doing the same thing, but closer to your original idea:

(
{
	var ampLine = Line.kr(1, 0, dur: 1);
	var sin = SinOsc.ar(mul: ampLine * 0.5);
	var noise = WhiteNoise.ar((Done.kr(ampLine)).lag(1));
	sin + noise
}.play
)