On 2015-12-26 09:05, chanof wrote:
Actually i'm not in a synthdef, this is my case, do you think i need
select
or is possible something like this?
The two sin are not one per time, like i want, it don't work, when
envTrig[2] is playing envTrig[1] should be mute..
(play{
var env, osc, env2, osc2;
var trig = Impulse.ar(8);
var trig2 = Impulse.ar(0.5);
var vincr =Dseq((31) ,inf)!4;
var v = Demand.ar(trig2, 0, vincr);
var envTrig = BinaryDigits.ar(trig, v, 5);
if(envTrig[2]==1){envTrig[1]=0}{envTrig[1]=envTrig[1]};
if(envTrig[2]==1){envTrig[0]=0}{envTrig[0]=envTrig[0]};
env = EnvGen.ar(Env.perc(0, 0.125),envTrig[2]* trig);
osc = SinOsc.ar(380)*env;
env2 = EnvGen.ar(Env.perc(0, 0.125),envTrig[1]* trig);
osc2 = SinOsc.ar(440)*env2;
osc+osc2
})
Thanks
Gianmaria
I'm on the wrong laptop and I can't test this out, but a control statement like 'if' in a SynthDef is a sign that there is some client/server confusion going on.
If you're trying to set both envTrig[0] and envTrig[1] to 0 whenever envTrig[2] is 1, you can use Select.ar, or this math trick:
envTrig[0] = envTrig[0] * (1 - envTrig[2]); envTrig[1] = envTrig[1] * (1 - envTrig[2]); Regards, Nathan _______________________________________________ sc-users mailing list info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx archive: https://listarc.bham.ac.uk/marchives/sc-users/ search: https://listarc.bham.ac.uk/lists/sc-users/search/