Hey, I am trying to synchronize all my Synths/Effects with a global clock. I came up with the following code. The first Ndef as well as the Tdef synchronize to the t.tempo. In the second Ndef, I try to synchronize an envelope-trigger with the global clock, but it doesnt work. Does anyone know what that could be? Thank you very much
p = Ndef.dictFor(s);
p.makeTempoClock;
t = p.clock;
TempoClock.default = p.clock;
t.tempo = 1;
//works
Ndef(\out, { Ringz.ar(Impulse.ar(Ndef(\tempo).kr), [501, 500], 1/Ndef(\tempo).kr) * 0.1 }).play;
//works
(
Tdef(\klink, { loop {
(note: 10, sustain: 0.05).play;
"klink".postln;
1.wait
} }).play(t);
)
//if I want to trigger an envelope, it doesnt work
(
Ndef(\sound, {arg time = 1;
var sig, env, gate;
gate = Impulse.ar(Ndef(\tempo).kr/time); // this doesnt work
//gate = Impulse.ar(1/time); // this works
env = EnvGen.ar(Env([0, 0.75, 0.75, 0],[time/2, 0 , time/2], curve: \sine ), gate: gate);
sig = SoundIn.ar(0)*env;
Out.ar(0, PanAz.ar(4, sig, env));
}).play;
)