[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] conditional statement in SynthDef
Look at the end of the 'if' helpfile. if inside a synthdef works a
little differently, and won't really give you what you want (at least
according to this example):
SynthDef("ifTest", {arg outBus = 0, high = 1;
var freq;
freq = if(high, 440, 220);
Out.ar(outBus, SinOsc.ar(freq, 0, 0.5));
}).send(s);
i = Synth.new("ifTest", [\high, 1]); //->440
i = Synth.new("ifTest", [\high, 0]); //->220
i = Synth.new("ifTest", [\high, 0.5]); //->330
Hope that helps,
Josh
******************************************
Joshua D. Parmenter
http://homepage.mac.com/joshpar/
"...Some people think a composer's supposed to please them, but in a
way a composer is a chronicler... He's supposed to report on what
he's seen and lived."
-Charles Mingus
On Aug 30, 2005, at 8:44 PM, Brian E Willkie wrote:
i = Synth.new("ifTest", [\high, 1]);