Controllng filter envelope , midi values

Since I am a beginner I am probably doing it all wrong
Using a midi number range 0-127 appended with .midicps correctly converts linear frequency values , but I also want to modulate them with an evelope
.I get a loud click at the start , so I assume this is not the correct way of doing it .
Ididn’t scale the envelope becasue of this which I assume would be in the range 0-127 for midi values)
I also noticed ( second block of code ) that the plot doesn’t work , maybe becasue of this click ?

(
{
	var sig,sig1,mod;
	mod=EnvGen.kr(Env([0,3,0],[0.001,5],[0,-5]));
	sig=Saw.ar([48,48].midicps);
	sig1=LPF.ar(sig,((80.midicps)*mod));
}.play)
///
(
{
	var sig,sig1,mod;
	mod=EnvGen.kr(Env([0,1,0],[0.001,5],[0,-5]));
	sig=Saw.ar([48,48].midicps);
	sig1=LPF.ar(sig,(80.midicps*mod));
}.plot(0.2))
///

https://doc.sccode.org/Classes/LPF.html#*ar

LPF.ar(in: 0.0, freq: 440.0, mul: 1.0, add: 0.0)
[…]
freq: Cutoff frequency in Hertz. WARNING: due to the nature of its implementation frequency values close to 0 may cause glitches and/or extremely loud audio artifacts!

your frequency input to LPF is near 0 at the start of the synth.

I am aware that the filter freq values are in Hertz
The point is that I am using midicps to convert hertz to midi values , 80 mdicps in filtercode block , and I want to scale the evleope accordingly , so in the range 1-127 (log midi values )
The envelope has a low value , because higher values give me loud pops
If you run the code , you would have noticed that + the reason why the plot doesn’t giva a graph back .( it’s blank )
So , I am still looking for a way to scale the envelope to range 1-127

here’s a fully opened filter using 127.midicps , so why is the manual stating it’s hertz only ?

(
{
	var sig,sig1,mod;
	 
	sig=Saw.ar([48,48].midicps);
	sig1=LPF.ar(sig,120.midicps);
}.play
)

And one modulated with Line , I just can’t achieve the same result with EnvGen

(
{
	var sig,sig1,mod;
	 
	sig=Saw.ar([48,48].midicps);
	sig1=LPF.ar(sig,Line.kr(120,30,10).midicps);
}.play
)

Got it working ,

////
(
{
	var sig,sig1,mod,justaline,anotherline;
	anotherline=EnvGen.kr(Env([127,30],[10],[0]));
	justaline=Line.ar(120,30,10);
	sig=Saw.ar([48,48].midicps);
	sig1=LPF.ar(sig,anotherline.midicps);
}.play
)
///

I can just use the midicps in the envelope , directly after the value array

(
{
	var sig,sig1,mod,anotherline;
	anotherline=EnvGen.kr(Env([100,1,0].midicps,[1],[0,0]));
	sig=Saw.ar([48,48].midicps);
	sig1=LPF.ar(sig,anotherline);
	
}.play
)
///

it’s all floating point numbers. the documentation is saying the value is interpreted as a frequency in hz.

just to be clear, this will give you linear motion in frequency space and not pitch space; they are not interchangeable.

i did run the code, what makes you think i didn’t?

for linear motion in the pitch space if you would want to specify \exp for the curves

anotherline=EnvGen.kr(Env([100,1,0].midicps,[1],[\exp,\exp]));

matter of taste but anyhow

Yes, though an exponential line segment may not touch or cross 0. The second segment there will give bad values. Oops, I was reading on a small screen and didn’t see the midicps. With midicps it’s fine. Never mind…

hjh