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

Re: [sc-users] BinaryOpUGen (instead of ==) confusion



"if(condition, { true }, { false })" evaluates either the true or false branch once, at the time the SynthDef is compiled. Then the result is hardcoded into the SynthDef.

For that to happen, the Boolean value of the condition has to be known when the SynthDef is compiled. But the condition depends on values that don't exist until the Synth is played. By wrapping true and false in functions, you're inadvertently asking the language to evaluate a condition now for values to be calculated later, which is impossible.

BinaryOpUGen('==', doppler, 1) is not a Boolean -- it's a signal that will be 0 for false and 1 for true. You can use this with if, but as noted in the earlier post, if you do that, the true and false branches must both be signals, not functions or any other kind of object.

So, take out the curly braces :)
hjh


On Jun 16, 2009, at 8:28 AM, e deleflie wrote:

Hi James,

yeah, that's the post I was referring to that I read .... unfortunately for my pea sized brain, it was just too much ... I thought I'd understood from that post that all I needed to do was use:

BinaryOpUGen('==', doppler, 1)

but that just creates an "ERROR: Non Boolean in test."

Etienne

On Tue, Jun 16, 2009 at 10:20 PM, James Harkins <jamshark70@xxxxxxxxx> wrote:
Perennial topic - I wrote a bedtime story about it once :)


(You're still writing if(condition, { true }, { false }) which is not valid inside a SynthDef.)



: H. James Harkins
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman