hey, ive spent already some time with this and not really able to figure it out.
Im creating a multiChannelPhase
for numChannels
by offsetting several Phasors and would like to use a sequence which should adjust the length each ramp takes to go from 0 to 1 per channel.
(
var sequencer = { |rate, array|
var durs = Dseq(array, inf) / rate;
var demand = Ddup(2, durs);
1 / Duty.ar(demand, DC.ar(0), demand);
};
var multiChannelPhase = { |numChannels, rate|
var localRate = rate / numChannels;
numChannels.collect{ |i|
var localPhase, localTrig, hasTriggered;
localPhase = (Phasor.ar(DC.ar(0), localRate * SampleDur.ir) + (1 - (i / numChannels)) - SampleDur.ir).wrap(0, 1);
localTrig = HPZ1.ar(localPhase) < 0;
hasTriggered = PulseCount.ar(localTrig) >= 1;
localPhase * hasTriggered;
}.reverse;
};
{
var numChannels = 4;
var overlap = min(\overlap.kr(1), numChannels);
var rate = \rate.kr(100);
var seq = sequencer.(rate, [5, 2, 3]);
var phases = multiChannelPhase.(numChannels, seq) * (numChannels / overlap);
IEnvGen.ar(Env([0, 1, 0], [0.5, 0.5], \sin), phases);
}.plot(0.3);
)
when i use overlap values == 1 its working as expected, each window is stretched in relation to the sequence and exactly ends where the new one begins (legato):
when i use overlap values < 1 its also working as expected, each window is stretched by the sequence but also “globally” compressed by the overlap value:
But when i use overlap values > 1 which is the whole point of creating this multichannel phase, to be able to overlap the windows inside the Synthdef, the phase gets distorted.
I was trying to concenptualise in different steps what should happen, but not really able to do so.
One thought was, that the Duty sequence should only advance per channel so Duty should probably also be multichannel expanded.
Does anybody could help me out with that? thanks alot.