hey, im creating this multichannel phase by either using LFSaw
or Phasor
and was wondering why i have to add a little increment to the upper bound of .wrap
(here SampleDur.ir
) for the Phasor
, otherwise the first phase is excluded. I thought wrapping between 0 and 1 would be correct. Are there in general any advantages of using LFSaw
vs Phasor
or vice versa for this purpose?
(
var multiChannelPhase = { |numChannels, rate|
numChannels.collect{ |i|
var localRate, localPhase, localTrig, hasTriggered;
localRate = rate / numChannels;
// compare with LFSaw
//localPhase = LFSaw.ar(localRate, ((1 - (i / numChannels + 0.5)) * 2)).linlin(-1, 1, 0, 1);
localPhase = (Phasor.ar(DC.ar(0), localRate * SampleDur.ir) + (1 - (i / numChannels))).wrap(0, 1 + SampleDur.ir);
localTrig = HPZ1.ar(localPhase) < 0;
hasTriggered = PulseCount.ar(localTrig) >= 1;
localPhase * hasTriggered;
}.reverse;
};
{
var numChannels = 4;
var overlap = \overlap.kr(2);
var rate = \rate.kr(100);
var phases = multiChannelPhase.(numChannels, rate) * (numChannels / overlap);
IEnvGen.ar(Env([0, 1, 0], [0.5, 0.5], \sin), phases);
}.plot(0.2);
)