Forums > MaxMSP

I want to add 12 to a stream of numbers once

July 28, 2011 | 11:04 am

Hi,
I want to add 12 to a stream of numbers once, I guess using bang – int 12 – add or something, and then send 0 to int after the addition, but I want to to this at regular intervals.

Thanks


July 28, 2011 | 1:09 pm

How about:
expr $i1+(12*($i2!=0))

where the right inlet is a toggle for on/off. Using conditionals + multiplies in expr is a very handy trick to know.


July 29, 2011 | 7:59 pm

i would agree about the expr gate solution. quite elegant and more effective than using a gate.


August 6, 2011 | 8:07 pm

Thanks !

It seemed I had the answer right in front of me

– Pasted Max Patch, click to expand. –

So,
expr $i1+12*$i2
would be the same?

Cheers


August 6, 2011 | 8:52 pm

well why not just switch the right inlet of the [+] to 12/0 per condition or whatever?


August 7, 2011 | 2:43 am
– Pasted Max Patch, click to expand. –

August 7, 2011 | 3:45 am

somehow this forum hates good old "if" ;)

putting it all nto one expression is clever but maybe not so good for code transparency.

i´d do it somwehere in between.

– Pasted Max Patch, click to expand. –

Viewing 7 posts - 1 through 7 (of 7 total)