Hi there -

I have a PdefGui, playing back a Pbindef. I’d like to code it so that the Pbindef fades out when you close the PdefGui. I tried the following code, but I think I must be referencing something incorrectly. Does anyone see the error in my ways?

x = PdefGui(Pbindef(\f,
\instrument, \default,
\freq, 900,
\dur, 0.1));

Pbindef(\f).clear;


If you want to stop when the view is closed, you can use onClose. The only trick is finding the right THING to call onClose on. Try this:

~gui = Pbindef(\f).gui;


Yes, I’m afraid the issue is the fade envelope - not the GUI command. I should have made that more clear in the original post. Pbindef(\test).clear works perfeclty well - but Pbindef(\test).clear(10), for instance does not seem to obey the fadeTime control when a Pdef is inside a PdefGui. Maybe I am overlooking something important, though.

PdefGui(Pdef(\y, Pbind(\dur, 0.25, \degree, Pseq([3, 4, 5b]-2, inf))));

~f = { |start, end, time, curve = 0| Pseg(Pseq([start, Pn(end)]), time, curve) }