Forums > MaxMSP

abstraction for repeating an operation

August 14, 2010 | 4:46 pm

i need to make an abstraction which can help me to repeat a certain process, for example on numbers,
for a given amount.

as you can see, i dont even know the right term for it.

let me give you an example instead:

there is a processs, [+ 5] which is applied to numbers. now i want to route the output of the
number back into the input in order to repeat [+ 5] fpr 17 times.

you might say that is easy with [counter] and [gate] but i cant find a simple and effective solution.

even when i start involving [grab] and pvars i see buffer underruns :D

does anyone have something like this already?

max 4.x or jpg please!

-110


August 14, 2010 | 5:07 pm

How about a for loop in javascript?


August 14, 2010 | 5:10 pm

Hello Roman,

have you tried with [jit.matrix] ?

HTH.

[attachment=138850,967]

Attachments:
  1. test.png

August 14, 2010 | 8:49 pm

Counter and Uzi are pretty much made for this (do something N times.) Here's an example:

– Pasted Max Patch, click to expand. –

[attachment=138860,968]

Attachments:
  1. Iterate.png

August 16, 2010 | 10:34 am

aha, "iteration", right, i should have known that word.

thanks for your ideas.

js is not an option for max4 and might be bit slow for timecritical
applications. but "loop" rings a bell.

indeed counter and uzi seem straightforward, but if you try
to redo the above patcher to work with [+ ] as well as [zl sort] and
[spintf] you will understand my problem with this method. :)

jit.matrxi or table are also not wrong ideas, yet limited.

i might stick to counter as there seem to be no other way.


August 16, 2010 | 12:55 pm

Hello Roman,

i never used them, but "OO objects" maybe ?


August 16, 2010 | 5:29 pm

The above patch is using [+], but I have no idea how you would like to use [zl sort] or [sprintf]. Perhaps if you posted your patch, we could see where you’re going wrong.


August 23, 2010 | 5:57 am

I would use scripting and Chris’ method with counter, but with an deferlowed iteration (not as fast as uzi, but works). Then do a "script replace" on the operator (+) object to exchange it on the fly with another operator…
You could even script complex formulas by exchanging the + object with an expr object…

– Pasted Max Patch, click to expand. –
Attachments:
  1. Iteration.png

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