.asMultichannelArray
is returning some strange format… .asMultichannelSignal
is working as expected, although for filling an Env
you need to have an Array.
After the .asMultichannelSignal
I can cast the Signal
into an Array
but it is giving me an Env
with tons of points, and not the “analytic” three point envelope specified before. Here Is the working “hack”:
(
var w;
w = Window("Bank of envelopes", Rect(0, 0, 630*2, 430*1.6));
w.view.decorator = FlowLayout(w.view.bounds);
(Env([1e-2,1,1e-2],[0,1], [[\lin, \exp, \sin, \wel, \sqr, \cub]]).asMultichannelSignal).do({ arg item, i;
i.postln;
item.postln;
b = EnvelopeView(w, Rect(0, 0, 200, 200))
.drawLines_(true)
.selectionColor_(Color.red)
.drawRects_(true)
.resize_(5)
.step_(0.01)
.mouseDownAction_({arg b; [b.index, b.value].postln; Ndef(\test, { SinOsc.ar([350, 351.3, 700, 703,4], 0, 0.2) + RLPF.ar(WhiteNoise.ar(0.1),350,0.0625)* EnvGen.ar(Env(item.as(Array)),doneAction: 2)}).play;}) /* for tweaking the behavior of action_() of a GUI check View help for more options */
.thumbSize_(10)
.setEnv(Env(item.as(Array)))
.grid_(Point(0.1, 0.1))
.gridOn_(true);
});
w.front;
)
And here is how I would like it to be:
(
var w;
w = Window("Bank of envelopes", Rect(0, 0, 630*2, 430*1.6));
w.view.decorator = FlowLayout(w.view.bounds);
([
Env([1e-9,1,1e-9],[0,1], \lin), Env([1e-2,1,1e-2],[1e-9,1.0], \exp), Env([1e-9,1,1e-9],[0,1], \sin), Env([1e-9,1,1e-9],[0,1], \wel), Env([1e-9,1,1e-9],[0,1], \sqr), Env([1e-9,1,1e-9],[0,1], \cub),
]).do({ arg i;
i.postln;
b = EnvelopeView(w, Rect(0, 0, 200, 200))
.drawLines_(true)
.selectionColor_(Color.red)
.drawRects_(true)
.resize_(5)
.step_(0.01)
.mouseDownAction_({arg b; [b.index, b.value].postln; Ndef(\test, { SinOsc.ar([350, 351.3, 700, 703,4], 0, 0.2) + RLPF.ar(WhiteNoise.ar(0.1),350,0.0625)* EnvGen.ar(i,doneAction: 2)}).play;}) /* for tweaking the behavior of action_() of a GUI check View help for more options */
.thumbSize_(10)
.setEnv(i)
.grid_(Point(0.1, 0.1))
.gridOn_(true);
});
w.front;
)
BTW: I’ve just find out that this is working properly:
Env([1e-9,1,1e-9],[0,1], \exp).plot;
However when inserted into EnvelopeView
I need to use something like Env([1e-2,1,1e-2],[0,1], \exp).plot;
in order to get a plot of an exponential curve. I am missing something with the way of plotting envelopes?