I want to add 12 to a stream of numbers once

Jul 28, 2011 at 11:04am

I want to add 12 to a stream of numbers once

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

#58209
Jul 28, 2011 at 1:09pm

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.

#209059
Jul 29, 2011 at 7:59pm

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

#209060
Aug 6, 2011 at 8:07pm

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

#209061
Aug 6, 2011 at 8:52pm

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

#209062
Aug 7, 2011 at 2:43am
– Pasted Max Patch, click to expand. –
#209063
Aug 7, 2011 at 3:45am

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. –
#209064

You must be logged in to reply to this topic.