Hi all,
I’d like to follow the concept of using Env().discretize to produce an array of frequency values, but I’d like to shape the envelope in real-time, so I can change the curve parameter of the Env with a UGen.
If Env().discretize is used to update the array of frequencies from the language side (from what I understand), it works fine:
(
~nf = 10;
SynthDef(\src,{
x = SinOsc.ar(\freq.kr(1!~nf));
x = Splay.ar(x) * -30.dbamp;
Out.ar(0,x);
}).add;
)
(
x = Synth(\src,[
\freq, Env([0,1],[1],1).exprange(70,3e3).discretize(~nf);
]);
)
(
{
(1,1.01..6).do{|i|
i.postln;
x.set(
\freq, Env([0,1],[1],i).exprange(70,3e3).discretize(~nf)
);
0.01.wait;
}
}.fork;
)
But if I want to control the Env’s curvature with a UGen:
(
~nf = 10;
SynthDef(\src,{
x = MouseY.kr(0,4);
x = Env([0,1],[1],x).exprange(70,3e3).discretize(~nf);
x = SinOsc.ar(x);
x = Splay.ar(x) * -30.dbamp;
Out.ar(0,x);
}).add;
)
it returns an error message.
Even if .discretize creates Signal[] with an array of values, those values can’t seem to be used as signals. Is that right?
In any case I’m not sure how to make this work, any help on how to solve this is appreciated!
Best,
cd