thanks ive used your approach from another thread and its working fine

```
//frequency Envelope
freqEnv = EnvGen.kr(freqEnv, timeScale:time);
\syncDcy, 0.35,
\time, Pfunc { |ev| ev.use { ~syncDcy.value } / thisThread.clock.tempo }.trace,
```

the credits go to @elgiano for the clever idea

i was also playing around with GrainSin for achieving something similiar, is this correct?

```
(
h = Signal.hanningWindow(1024);
e = Buffer.loadCollection(s, h);
SynthDef(\windowsync, {
arg out=0, pan=0, freq=440, amp=0.1,
syncEgTop=8, syncRatio=2, syncDcy=0.5, shapeAmount=0.4, time=1,
overlap=0.5, envBuf=0;
var gainEnv = \gainEnv.kr(Env.newClear(8).asArray);
var freqEnv = \freqEnv.kr(Env.newClear(8).asArray);
var sig, fundamental, synced;
var k = 2 * shapeAmount / (1 - shapeAmount);
//frequency Envelope
freqEnv = EnvGen.kr(freqEnv, timeScale:time);
fundamental = GrainSin.ar(
numChannels: 1,
trigger: Impulse.ar(freq),
dur: 1 / freq,
freq: freq,
envbufnum: envBuf
);
synced = GrainSin.ar(
numChannels: 1,
trigger: fundamental,
dur: overlap / freq,
freq: freq * syncRatio * freqEnv,
envbufnum: envBuf
);
sig = synced.squared * fundamental;
sig = LeakDC.ar(sig);
// amp envelope
gainEnv = EnvGen.kr(gainEnv, doneAction:2);
sig = sig * gainEnv;
// waveshaper
sig = ((1 + k) * sig / (1 + (k * sig.abs)));
sig = Pan2.ar(sig, pan, amp);
sig = Limiter.ar(sig);
Out.ar(out, sig);
}).add;
)
(
Pdef(\windowsync,
Pbind(
\type, \hasEnv,
\instrument, \windowsync,
\shapeAmount, 0.4,
\dur, 1,
\legato, 0.8,
\atk, 0.01,
\sus, (1 - Pkey(\atk)) * Pexprand(0.35,0.55,inf),
\gainEnv, Pfunc{|e|
var rel = (1 - e.atk - e.sus);
var c1 = exprand(2,6);
var c2 = exprand(-2,-6);
Env([0,1,1,0],[e.atk, e.sus, rel],[c1,0,c2])
},
\syncEgTop, 75,
\syncRatio, 2,
\syncDcy, 0.35,
\time, Pfunc { |ev| ev.use { ~syncDcy.value } / thisThread.clock.tempo }.trace,
\freqEnv, Pfunc{|e|
Env([e.syncEgTop / e.syncRatio, 1], [e.syncDcy], \exp)
},
\midinote, 36,
\envBuf, e.bufnum,
\overlap, 0.9,
\amp, 0.5,
\out, 0,
\finish, ~utils[\hasEnv]
)
).play;
)
```