Yes, VarLag seems to work in a similar way to the use proposed by jamshark70 with EnvGen (thanks for these explanations!), both work well, the first is just a little more concise.
Lag (mysterious Lag Help: “lagTime: 60 dB lag time in seconds”) and Ramp work less linearly.
For a little comparison, if it’s of any use to anyone else…
//----VarLag
(
SynthDef(\ramp1,{
arg freq = 200, amp = 0.5, time = 1;
var sig, rampe;
rampe = VarLag.kr(freq, time);
sig = SinOsc.ar(rampe.midicps ! 2, mul: amp);
Out.ar(0, sig)}).add
);
x = Synth(\ramp1, [\freq, 60, \amp, 0.5, \time, 5]);
x.set(\freq, 48, \time, 10);
x.set(\freq, 72, \time, 1);
//----EnvGen
(
SynthDef(\ramp2,{
arg freq = 200, amp = 0.5, time = 1;
var sig, trig, rampe;
trig = Changed.kr(freq);
rampe = EnvGen.kr(Env([freq, freq], [time], \lin), trig);
sig = SinOsc.ar(rampe.midicps ! 2, mul: amp);
Out.ar(0, sig)}).add
);
y = Synth(\ramp2, [\freq, 60, \amp, 0.5, \time, 5]);
y.set(\freq, 48, \time, 10);
y.set(\freq, 72, \time, 1);
//----Lag
(
SynthDef(\ramp3,{
arg freq = 200, amp = 0.5, time = 1;
var sig, rampe;
rampe = Lag.kr(freq, time);
sig = SinOsc.ar(rampe.midicps ! 2, mul: amp);
Out.ar(0, sig)}).add
);
m = Synth(\ramp3, [\freq, 60, \amp, 0.5, \time, 5]);
m.set(\freq, 48, \time, 10);
m.set(\freq, 72, \time, 1);
//----Ramp
(
SynthDef(\ramp4,{
arg freq = 200, amp = 0.5, time = 1;
var sig, rampe;
rampe = Ramp.kr(freq, time);
sig = SinOsc.ar(rampe.midicps ! 2, mul: amp);
Out.ar(0, sig)}).add
);
w = Synth(\ramp4, [\freq, 60, \amp, 0.5, \time, 5]);
w.set(\freq, 48, \time, 10);
w.set(\freq, 72, \time, 1);
Yes, thank you, I’m also working on Patterns, but for Pseg you have to give the start point and the end point, I don’t know if it has the same properties as EnvGen.