luka
December 10, 2020, 8:22pm
1
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!
dkmayer
December 10, 2020, 11:28pm
2
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
)
luka
December 10, 2020, 11:56pm
3
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 !!!
dkmayer
December 14, 2020, 5:15pm
4
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
opened 05:07PM - 14 Dec 20 UTC
closed 07:41AM - 07 Feb 22 UTC
bug
SC 3.11.1 on OS 10.15
Env and Penv are failing here:
```
(
Pbindef(\test,
…
\dur, 0.2,
\midinote, Env([60, 70, 60], [2, 2])
).play
)
-->
ERROR: Message '+' not understood.
RECEIVER:
Instance of Env
```
```
(
Pbindef(\test,
\dur, 0.2,
\midinote, Penv([60, 70, 60], [2, 2])
).play
)
-->
ERROR: Message '+' not understood.
RECEIVER:
Instance of Penv
```
As a workaround we can use Pseg and Ptime + Pfunc
```
Pdef.removeAll
(
Pbindef(\test,
\dur, 0.2,
\tm, Ptime(),
\midinote, Pfunc { |e| Env([60, 70, 60], [2, 2])[e[\tm]] }
).play
)
(
Pbindef(\test,
\dur, 0.2,
\midinote, Pseg(Pseq([60, 70, 60]), 2)
).play
)
```
dkmayer
December 15, 2020, 2:57am
5
Julian has already found the solution. You can fix it yourself by adding this method in Env.sc:
streamArg {
^this.asStream
}