[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] conditional statement in SynthDef






Can anyone tell me why this doesn't work? Unless I hardcode a true
expression (i.e. if (true, ...) ) freq is always set to 220.


SynthDef("ifTest", {arg outBus = 0, high = 1;
      var freq;

      if(high == 1, {freq = 440}, {freq = 220});

      Out.ar(outBus, SinOsc.ar(freq, 0, 0.5));
      }).send(s);

i = Synth.new("ifTest", [\high, 1]);

Thanks,
Brian