Pseg / Tdef interaction


I would like to control the Pseg params by a Tdef, in order to constantly change the segment values. So far it is working only with the duration param (\time) but not with the levels (dk why). The code is the following and as a newb, I am sure I am missing something:


		\instrument, \xxx,

	\fund, Pseg(Pseq([PL(\level1), PL(\level2)],inf), Pseq([ PL(\time)],inf), \exp, inf),

	\dur, Pfunc({ |ev| })


Tdef(\bbb, {

	var time, level1, level2;

	time = Prout({loop{ Pseg( Pseq([0.04, 1.5],inf), Pseq([1],inf), \linear).yield   } }).asStream;
	level1 = Prout({loop{ Pseg( Pseq([100, 150],inf), Pseq([1],inf), \linear).yield   } }).asStream;
	level2 = Prout({loop{ Pseg( Pseq([10, 30],inf), Pseq([1],inf), \linear).yield   } }).asStream;


~time =;
~level1 =;
~level2 =;


Second question: in a lot of cases I would like to sequence - independently - the duration value of the Task ".wait. " : like having a dedicated Pseq (or another Task) that would dynamically control its value.
How can i do that?

Thanks a lot

Oh wait, just took another look at this –

The above usage is not valid – it’s yielding the Pseg object, not yielding values from the Pseg. Perhaps you meant embedInStream where you wrote yield… (I guess)?