Conditional statements at signal rate (like if/else...)

Ludo's icon

Hi !

I would like to implement at signal rate a transfer function i actually generate for lookup with max.

Example of (arbitrary) function (sIn = signal between 0. and 1., sOut = output signal, Px = parameters):
if (sIn< 0.2) sOut = sIn*P1...
else if(sIn <=0.4) sOut = sIn/P2+P3...
else sOut = ....

Is that possible with objects like <~, <=~, gate~, selector~,... ?
If yes, what would be the best design pattern in maxmsp to operate this conditional statement at signal rate ?

Many thanks by advance !

double_UG's icon

you can try it with gen~ codebox

Ludo's icon

Thanks !

I am a max4live user, I don't have access to gen~ (i can use it but not edit or create). It seems to be a must-have as soon as i go further in dsp processing.

But in any case, i would really like to know if it would be possible (and trusty) directly with maxmsp ?

double_UG's icon

Max Patch
Copy patch and select New From Clipboard in Max.

Ludo's icon

Exactly what i was searching for !!!

If i have well understood the logic, the addition of results of conditionals statements will open the right inlet in selector~ :)

Just a last question (i am new with concept of signal rate against max priorities with operations):

Is there a risk that the result of an operation on a given input sample wouldn't be synced with the inlet it as selected in selector~ ? (ex: a sample of 0.1 selects inlet 1 and before the operation <0.2~ is finished, a 0.3 value selects inlet 2) ?

Thanks again