I’m using a SendTrig and HPZ1 to trigger a finite Routine when a Phasor loops. They should match in time, as the Routine loops 4 times with a 1 second wait, and the Phasor is 4 seconds long—but I’m wanting to use this approach to ensure that they are always perfectly lined up.
Sometimes, without any apparent pattern, the Routine seems to play twice, and therefore reaches its end halfway through the Phasor’s period.
(
~rout = Routine({4.do{ |i|
i.asInteger.postln;
1.wait;
}});
SynthDef(\phasor, {
var sig;
sig = Phasor.ar(0, 1, 0, s.sampleRate * 4);
SendTrig.ar(HPZ1.ar(sig).neg);
}).add;
OSCdef(\looped, { |msg|
~rout.stop;
~rout.reset;
~rout.play(SystemClock);
msg.postln;
}, '\tr');
)
Synth(\phasor);
I don’t think that it’s the SendTrig triggering the OSCdef twice, as the post window only shows the trigger message once when this doubling occurs. It always looks like this, but sometimes two numbers from the routine are posted at the same time:
[ /tr, 1005, 0, 0.0 ]
0
1
2
3
What could be causing this? The purpose of this is so that Routine will trigger some synths metronomically that I don’t want to drift from the Phasor looping (which is playing a sample). Is there a different approach to keep things lined up with a Phasor?