Hello, I’m trying to use a Env Generator for wave-shaping. The reason for this is to be able to retrigger it with the gate argument (connecting to to a different frequency) to add harmonics to this. I borrowed this idea from some analogue-like synthesizers. However i get strange artifacts and especially the pitch is not correctly done.
The first code block shows how the indexer without the problems of the accuracy in the EnvGen.
Under this, i try to create the same indexer with a Env.ar, however i think the steps of time duration ‘0’, still add one frame to the total Env. This leads to an effect that the intended wave keeps shifting to the right with every iteration.
//this is how i want it to be looking like
({
var f, index, shape;
shape = 0.2;
f = 100;
index = LFSaw.ar(f,1);
index = index + LFPulse.ar(f*2,0.5,shape,2-(2*shape));
index = index + LFPulse.ar(f*2,0.5+shape,shape,(2*shape)+2);
index = index.wrap(-1,1);
}.plot(0.03))
//this is how my Env looks like, it has a minor shift
({
var f, index, shape;
shape = 0.2;
f = 100;
index = EnvGen.ar(Env(
[-1,-1,-0.5-shape,-0.5+shape,-0.5+(2*shape),-0.5-(2*shape),-0.5-shape,-0.5+shape,0.5-shape,0.5+shape,0.5+(2*shape),0.5-(2*shape),0.5-shape,0.5+shape,1,1],
[0,0.25-(shape/2),0,shape/2,0,shape/2,0,0.5-(shape),0,shape/2,0,shape/2,0,0.25-(shape/2),0],
0,14,0),1,timeScale:1/f);
index = index.wrap(-1,1);
}.plot(0.03))
My question, is there a better way of archieving a retriggerable Indexer or how do i bypass this problem with my Env.ar? Maybe a different method than .new? However i haven’t found another method that can loop.
Thank you very much!