How To "If Signal2 < Signal1 then output Signal3" in M4L?

Chauso Bonaparte's icon

Hi all,

I'm trying to execute the logic in the title. Wished I could do it with gen and codebox but apparently it's not available for M4L.

addiotnally:

  1. The "<" comparison should be for absaloute values regardless of polarity(+ or -), so -8>6.

  2. What would the proper way to sum stereo signals(signal2=is stereo signalX+stereo signalY actually). the +~ has two inputs but one output.

could anyone offer a solution?

Sébastien Gay's icon
How To "If Signal2 < Signal1 then output Signal3" in M4L?

Chauso Bonaparte's icon

Great! Thanks a lot.

Could u offer some help regarding the stereo question? I don't get this basic aspect of max.

Also, could there be an "else" for signal4 if 2 !<1

?

Sébastien Gay's icon

Could you clarify :

the +~ has two inputs but one output

That sounds quite logical to me ;-)

And :

"else" for signal4 if 2 !<1

==> 2 !<1 ?

Roman Thilenius's icon

the conditional statement is not complete.

in signal world there is no "then something", there is only a "then something, else 0".

but whatever, you example is really simple to do, because comparison operators provide the bool which gate~ needs to block or let pass.

Also, could there be an "else" for signal4 if 2 !<1

what works with [gate~] (pass or not) will also work work with [gate~ 2] (pass here or pass there) or [selector~ 2] (pass this or pass that) and any other possible combination.

in other words: you can do even more than you could do with the max [if] object, for example having multiple conditions or 5 different outputs (multiple else´s)

before you overuse comparison operators in conjunction with "if" jobs make sure you internalize what [minmax~], [minimum~], and [sah~] do.