Hi all -
I’d like to have an envelope of 5 points, that I can adjust accordingly in time. I’d like to be able to enter some numerical values to skew the lines between the points, to smooth or sharpen the transition.
I am having some trouble figuring this out - but I’m not exactly sure how to describe the error. Skewing at the moment is collapsing the envelope. I’ve tried a few other ideas, but none of it is quite working as expected.
Any insight into this problem would be appreciated. Thank you.
(
w = Window("", Rect(100, 100, 400, 400)).front;
~skew = 1;
~skew2 = 1;
~envView = Env([0, 0.5, 1, 0.5, 0], [2, 2, 2, 2], [2, -2, 2, -2]);
//nil node issues
StaticText(w, Rect(80, 10, 40, 10)).string_("skew");
NumberBox(w, Rect(80, 20, 80, 30)).action_({|t|
~skew1 = t.value;
~envView = Env(~envo.value[1], ~envo.value[0],[~skew1, ~skew2.neg, ~skew2, ~skew1.neg] );
~envo.setEnv(~envView);
});
NumberBox(w, Rect(80, 50, 80, 30)).action_({|t|
~skew2 = t.value;
~envView = Env(~envo.value[1], ~envo.value[0],[~skew1, ~skew2.neg, ~skew2, ~skew1.neg] );
~envo.setEnv(~envView);
});
~envo = EnvelopeView(w, Rect(10, 100, 200, 100))
.drawLines_(true)
.selectionColor_(Color.red)
.drawRects_(true)
.resize_(5)
.step_(0.05)
.setEnv(~envView)
.action_({
~envo.value.postln;
~envView = Env(~envo.value[1], ~envo.value[0],[~skew1, ~skew2.neg, ~skew2, ~skew1.neg] );
});
Button(w, Rect(230, 100, 40, 40))
.string_("play")
.action_({
{SinOsc.ar(400, 0, 0.1) * EnvGen.ar(~envView, timeScale: 4, doneAction:2)}.play;
});
Button(w, Rect(290, 100, 40, 40))
.string_("view")
.action_({
~envView.plot;
});
)