Env inside Pbindef/Pdef

Hi, is it possible to use Env inside Pbindef like it’s possible inside Pbind - or a similar control?

// works ok
(
Pbind(
	\degree, Pseq([0,2,4,6,8,5,3],inf),
	\amp, Env(#[0,0.4,0], #[10,10]),
	\dur, 1
).play
)

// this does not produce sound, althought the synths are instantiated
(
Pbindef(\onetest,
	\degree, Pseq([0,2,4,6,8,5,3],inf),
	\amp, Env(#[0,0.4,0], #[10,10]),
	\dur, 1
).play
)

Any insight greatly appreciated!

Ah, didn’t encounter that so far. Pbindef doesn’t seem to like Envs, Penv and Ptime. As a quick workaround you can use Pseg at least.

(
Pbindef(\onetest,
	\degree, Pseq([0,2,4,6,8,5,3],inf),
	\amp, Pseg(Pseq([0, 0.4, 0]), 10),
	\dur, 1
).play
)

Thanks! This works ok. In order for the Pbind to NOT stop, I need to add a Pn as the last element:


(
Pbindef(\onetest,
	\degree, Pseq([0,2,4,0,0,-1],inf),
	\amp, Pseg(Pseq([0, 0.4, 0.1, Pn(0.1)]), 10, \cub),
	\dur, Pseq([1/4],inf)
).play
)

Pbindef(\onetest, \amp, Pseg(Pseq([0.1, 0.4, Pn(0.1)]), 4, \cub))

// to cycle the 'envelope':
Pbindef(\onetest, \amp, Pseg(Pseq([0.1, 0.4, 0.1],inf), 4))

// to end it.
Pbindef(\onetest, \amp, Pseg(Pseq([0.1, 0.4, 0]), 8, \cub))

thank you @dkmayer!!!

Add-on: Ptime does work and can help to use Pfunc with Env as an alternative workaround. I think it just didn’t work with my first test as the Pbindef/Pdef has to be cleared.

Pdef.removeAll

(
e = Env([60, 70, 60], [2, 2]);

Pbindef(\test,
	\dur, Pn(0.2, 25),
	\tm, Ptime(),
	\midinote, Pfunc { |ev| e[ev[\tm]] }
).play
)

I’ve filed a bug report at GitHub

Julian has already found the solution. You can fix it yourself by adding this method in Env.sc:

	streamArg {
		^this.asStream
	}